macalbert/envilder/code-refactoring
Claude Code and agent skill by macalbert/envilder
- community
Checking that the SKILL.md file is still in the repository.
Code-smell detection and safe incremental refactoring patterns. Use when reviewing or implementing a PURE_REFACTOR contract, reducing technical debt, or assessing structural findings. Covers SOLID principles and behavior-preserving execution.
Install
npx vskill@latest install macalbert/envilder/code-refactoringSKILL.md
Code Refactoring
Detect concrete code smells and improve structure while preserving all observable behavior. common-verification-first governs intent, protected artifacts, and evidence.
When to Use
- Implementing an approved
PURE_REFACTOR. - Reviewing a candidate for justified structural findings.
- Reducing technical debt within approved scope.
- Reducing complexity flagged by CRAP evidence.
Preconditions
- Establish an existing-suite baseline before solution edits.
- Freeze and protect behavioral verification; do not rewrite it for the
refactor.
- State architecture constraints and the behavior that must remain unchanged.
- Only
@Implementerapplies workflow changes.@Reviewerremains read-only
and reports findings to the orchestrator.
Smell Catalog
| Smell | Indicator | |
|---|---|---|
| Long method | Excessive branches, mixed levels, or multiple responsibilities | |
| Large class | Multiple independent reasons to change | |
| Duplicated logic | The same decision or transformation exists in multiple places | |
| Tight coupling | High-level behavior depends directly on replaceable details | |
| Mixed abstraction | Policy and low-level mechanics are interleaved | |
| Architecture violation | A dependency crosses a prohibited layer boundary | |
| Feature envy | Behavior primarily manipulates another owner's data | |
| Shallow module | Interface complexity approaches implementation complexity | |
| Primitive obsession | Domain concepts lack meaningful types and invariants | |
| Speculative generality | Abstraction exists without a current requirement |
Review Method
- Read target files, callers, verification contract, and architecture rules.
- Identify only concrete smells with maintenance or correctness risk.
- Apply the deletion test to shallow modules: retain an abstraction when
removing it concentrates complexity; inline it when removal merely shortens the call path.
- Report location, evidence, proposed structural outcome, and risk.
- Accept
no changes requiredwhen the candidate is already clear and
cohesive.
Implementation Method
For each approved structural change:
- Make one coherent transformation.
- Keep protected verification artifacts unchanged.
- Run the targeted existing verification.
- Run the stack formatter and static or build checks in the appropriate mode.
- Continue only while behavior and architecture constraints remain protected.
- Run the broader relevant suite before completion.
If a behavioral test must change, stop. The task may be a behavior change, the test may be coupled to private structure, or the contract may be defective. Route that decision to the orchestrator instead of silently reclassifying it.
Stack Checks
| Stack | Typical verification | Formatter | |
|---|---|---|---|
| TypeScript core, Node.js SDK, website | Targeted Vitest or build, type check | pnpm format | |
| .NET SDK | Targeted and broader dotnet test, build | dotnet format | |
| Python SDK | Targeted and broader pytest, mypy | make format-sdk-python |
Constraints
- Never change observable outputs, side effects, compatibility, or domain
invariants.
- Respect Domain -> Application -> Infrastructure dependency rules.
- Do not add tests merely to raise coverage or satisfy a refactoring ritual.
- If important behavior truly lacks evidence, report a separate verification
need; do not expand the frozen refactor contract.
- Do not force a modification after review; no findings is valid.
SOLID Reference
| Principle | Check | |
|---|---|---|
| Single Responsibility | Does this unit have one reason to change? | |
| Open/Closed | Can required variation be added without unstable branching? | |
| Liskov Substitution | Can subtypes replace the abstraction without surprises? | |
| Interface Segregation | Do clients depend only on operations they need? | |
| Dependency Inversion | Does policy depend on abstractions rather than details? |
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/code-refactoring/SKILL.md
Popularity
- Repository stars
- 135
- Repository forks
- 4
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/macalbert/envilder/code-refactoring)