refactor-expert
Skill26 starsChanged 4 months agoMITView on GitHub
Identifies unnecessarily complicated code and proposes cleaner implementations while preserving behavior. Use when code works but is harder to read or change than it should be.
In this repository119 other files it gives its agents.
- adr-writerSkill
- architecture-reviewerSkill
- cache-strategy-plannerSkill
- cost-optimization-auditorSkill
- cqrs-event-sourcing-designerSkill
- disaster-recovery-plannerSkill
- event-driven-architectSkill
- feature-flag-lifecycle-managerSkill
- migration-plannerSkill
- multi-tenant-data-partitionerSkill
- project-plannerSkill
- rate-limiting-architectSkill
- tech-debt-assessorSkill
- zero-downtime-migration-plannerSkill
- api-designerSkill
- bug-hunterSkill
- code-reviewerSkill
- concurrency-race-detectorSkill
- database-architectSkill
- dependency-auditorSkill
- error-handling-architectSkill
- graphql-schema-designerSkill
- legacy-code-refactorerSkill
- memory-leak-detectorSkill
- microservices-boundary-definerSkill
- performance-auditorSkill
- pr-reviewerSkill
- resilience-circuit-breaker-designerSkill
- security-auditorSkill
- sql-query-optimizerSkill
- state-machine-designerSkill
- typescript-guardianSkill
- websocket-protocol-designerSkill
- adr-generatorSkill
- changelog-generatorSkill
- codebase-glossary-builderSkill
- commit-message-expertSkill
- contributor-guide-writerSkill
- documentation-writerSkill
- executive-summary-writerSkill
- readme-builderSkill
- release-notes-writerSkill
- rfc-proposal-writerSkill
- runbook-generatorSkill
- sdk-getting-started-writerSkill
- status-update-writerSkill
- ci-cd-pipeline-optimizerSkill
- context-window-optimizerSkill
- git-conflict-resolverSkill
- interview-question-generatorSkill
- meeting-notes-distillerSkill
- monorepo-workflow-architectSkill
- onboarding-guide-generatorSkill
- on-call-handover-writerSkill
- prompt-enhancerSkill
- retro-facilitatorSkill
- task-breakdown-assistantSkill
- tech-debt-burndown-plannerSkill
- cognitive-bias-detectorSkill
- decision-makerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Before adding a new feature to code that's already showing signs of strain — refactor first, then extend.
- Distinctive: line 26
Before/after code side by side (or before, then after).
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Purpose
Find code that is more complicated than the problem it solves, and propose a concrete simpler implementation that preserves the exact same behavior. This is not a bug hunt or a style pass — the target is unnecessary complexity.
When to Use
- Code works correctly but is hard to read, extend, or reason about.
- A function has grown organically and accumulated conditional branches, indirection, or duplication that no longer earns its keep.
- Before adding a new feature to code that's already showing signs of strain — refactor first, then extend.
What to Analyze
- Unnecessary complexity — deep nesting, excess conditionals, indirection that doesn't pay for itself, premature abstraction/over-generalization for a case that doesn't need it.
- Duplication — repeated logic that should be a shared function/module.
- Dead or unreachable branches — conditions that can never be true, parameters that are always the same value.
- Better-fitting language/library features — a manual loop that a built-in method expresses more clearly, a class where a plain function would do, or vice versa.
- Behavior preservation — confirm the proposed refactor produces identical output for all the same inputs, including edge cases, before proposing it.
Output Format
- Before/after code side by side (or before, then after).
- One-line explanation of why the after version is simpler, not just that it is.
- Explicit note confirming behavior is preserved, and calling out any edge case where extra care was needed to keep it that way.
Avoid
- Refactoring style you personally prefer without a genuine complexity reduction.
- Proposing a "cleaner" version that subtly changes behavior without flagging it.
- Over-abstracting in the other direction — don't replace simple, readable code with a "clever" one-liner that's harder to follow.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

