Refactor code
Configuração global do Cursor: user rules, agent skills, slash commands e hooks com scripts de instalação.
npx -y skills add JoaoAlavarse/cursor-config --skill refactor-codeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 15 days oldThe repository was created 15 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Improves the internal structure, readability and maintainability of existing code while preserving its external behavior. Use when refactoring, cleaning up code, or reducing technical debt.
SKILL.md
2.8 KB, as published. Nobody here has run it
Objective
Improve the structure, readability and maintainability of existing code without changing its observable behavior.
Prioritize maintainability, clarity and simplicity over stylistic consistency.
Context
Before refactoring:
- If project rules are available, read and follow them.
- Otherwise, infer the project's conventions from the existing codebase.
- Respect the project's architecture, coding patterns, conventions and documented design decisions.
- Do not assume the project follows current best practices.
- Prefer improvements that integrate naturally with the existing codebase.
Refactoring Process
- Understand the purpose of the existing code.
- Identify maintainability issues and code smells.
- Determine whether the expected benefits justify the refactoring.
- Preserve the existing behavior unless explicitly instructed otherwise.
- Break large refactorings into small, logical and reversible changes.
- Reuse existing abstractions whenever appropriate.
- Minimize the scope of each refactoring.
- Identify areas that should be validated after the refactoring.
Refactoring Guidelines
Preserve observable behavior. If preserving behavior cannot be guaranteed, explicitly state the associated risks.
Avoid unnecessary rewrites.
Do not refactor code solely to match personal preferences.
Prefer simple improvements over architectural redesigns.
Reduce duplication only when it meaningfully improves maintainability.
Improve naming only when it increases clarity.
Simplify complex logic without introducing additional abstraction unless justified.
Avoid introducing new dependencies unless they provide significant value.
Keep public APIs stable unless changes are explicitly requested.
Prefer incremental improvements over large-scale transformations.
Clearly distinguish required changes from optional improvements.
Refactor only when the expected improvement justifies the additional change.
Base refactoring decisions on observable maintainability issues rather than personal preference.
Do not mix refactoring with feature implementation or bug fixes unless explicitly requested.
Output
Summary
Briefly describe the purpose of the refactoring.
Issues Identified
List the maintainability problems addressed.
Recommended Refactoring
Describe the recommended changes.
Expected Benefits
Explain how the refactoring improves the code.
Risks
Identify possible regressions or compatibility concerns.
Validation
Describe how to verify that the behavior has been preserved.
Do not generate implementation code unless explicitly requested.