Refactoring
Skill s-hiraoku/synapse-a2a/plugins/synapse-a2a/skills/refactoring
npx -y skills add s-hiraoku/synapse-a2a --skill refactoringAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 9 stars9 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
Guide for safe and effective code refactoring. Focuses on improving code structure without changing external behavior. Covers patterns like extraction, inlining, and naming improvements.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
1.9 KB, as published. Nobody here has run it
Refactoring Guide Skill
Refactoring is the process of restructuring existing computer code—changing the factoring—without changing its external behavior.
Core Refactoring Patterns
1. Composing Methods
- Extract Method: If a method is too long or complex, turn a fragment of it into its own method.
- Inline Method: If a method body is as clear as its name, move the body into the callers and delete the method.
2. Moving Features Between Objects
- Move Method/Field: Relocate logic to the class where it most naturally belongs to reduce coupling.
3. Simplifying Expressions
- Decompose Conditional: Extract complex conditional logic into clearly named methods.
- Consolidate Conditional Expression: Merge multiple conditional checks that lead to the same result.
4. Clean Code & Naming
- Rename: Use clear, intention-revealing names for variables, methods, and classes.
- Replace Magic Number with Symbolic Constant: Use named constants instead of literal numbers.
Safe Refactoring Workflow
- Verify Tests: Ensure you have a solid test suite that passes before starting.
- Small Steps: Make one tiny change at a time.
- Run Tests: Execute the test suite after every small change to catch regressions immediately.
- Commit Often: Commit your changes once a small refactoring step is complete and verified.
When to Refactor
- Rule of Three: Refactor when you find yourself doing something for the third time.
- Code Smells: Refactor when you encounter long methods, large classes, or duplicated code.
- Adding Features: Refactor before adding new functionality to make the implementation easier.