Code quality refactor

GoalCoding · Find redundant JavaScript and refactor it cleanly.

Help me improve the quality of [code or file]. Known context: [language and framework version]. First find duplicated code, deep nesting, and missing types, then give refactor options in priority order with before-and-after snippets and the reason for each change. State assumptions when context is missing, avoid unused dependencies, and do not change external behavior.

Open this template in the optimizer →

Placeholders to fill in

  • code or file
  • language and framework version

Placeholders stand for your own facts. Never invent figures, sources or credentials the model was not given.

How to use it

  1. Copy the template, or open the optimizer and it is filled in for you.
  2. Replace every placeholder in brackets with your own material.
  3. Add constraints such as length, audience, tone, and what must not change.
  4. Generate, then refine in three directions and copy the result.

Adapted from LobeHub agent “JS 代码质量优化” by canisminor1990 (MIT)

More coding goals

Browse other tasks

Canonical version: https://www.prompt.dx3906.net/zh/templates/coding/purpose-js-code-quality