refactor
Skill2 starsChanged 8 days agoMITView on GitHub
Structural refactoring and code simplification pass. Use this skill whenever the user wants to review or clean up, simplify, refactor, restructure, or improve code clarity, consistency, maintainability, or efficiency.
195 other projects use a version of this.
Adopted by
Most recently taken up by
- chrisallenlane/claude-swe-workflowstheir own version, first seen Nov 29, 2026
- AnthonyDelaCruz/agent-setuptheir own version, first seen Nov 29, 2026
- Tomas542/lightning_hydra_templatetheir own version, first seen Nov 29, 2026
- alfa-reza/skillstheir own version, first seen Nov 29, 2026
- discountry/ritmex-skillstheir own version, first seen Nov 29, 2026
- rodri-oliveira-dev/agentic-engineering-skillstheir own version, first seen Nov 29, 2026
Used with
Projects with it also use debug-fix, ascii-diagram and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
zebbernSkilldebug-fix
Find and fix a bug or issue — from any source (GitHub issue, error message, user report, or observed behavior)
Also in 4 projects that use this
SethGammonSkillascii-diagram
Generate perfectly aligned ASCII diagrams — architecture, flow, sequence, box-and-arrow. Uses a programmatic character-grid approach so alignment is guaranteed by math, not token prediction. Includes post-render verification.
Also in 4 projects that use this
jidechaoSkillmodern-go
Modernize Go code by applying version-appropriate idioms and APIs (gofix-style transformations). Scans go.mod for the Go version, then transforms Go source files to use modern patterns—from Go 1.0 through 1.26+. Use when the user says "现代化","现代Go语言", "地道的", "idiomatic", "modernize", "modern-go", "update Go code", "gofix", or wants to upgrade Go idioms.
Also in 3 projects that use this
SethGammonSkillresearch-fleet
Parallel research using Fleet wave mechanics. Spawns multiple scout agents, each investigating a different angle of the same question. Findings are compressed between waves. Produces a unified research brief from multiple independent perspectives.
Also in 3 projects that use this
parcadeiSkillagent-context-isolation
Agent Context Isolation
Also in 3 projects that use this
parcadeiSkillagentica-infrastructure
Reference guide for Agentica multi-agent infrastructure APIs
Also in 3 projects that use this
- +6 more from parcadei
Other versions195 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 195
- github/awesome-copilot★ 42ksame name
- unkeyed/unkey★ 5.5ksame name
- parcadei/Continuous-Claude★ 3.9ksame name
- parcadei/Continuous-Claude-v2★ 3.9ksame name
- parcadei/Continuous-Claude-v3★ 3.9ksame name
- adobe/S3Mock★ 1.2ksame name
- SethGammon/Citadel★ 927same name
- poshan0126/dotclaude★ 871same name
- JordanCoin/codemap★ 715same name
- membrane/api-gateway★ 661same name
185 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository28 other files it gives its agents.
- ask-then-buildSkill
- automate-meSkill
- bazelSkill
- benchmarkingSkill
- blufSkill
- code-documentationSkill
- devils-advocateSkill
- find-bugs-diffSkill
- find-standardsSkill
- generalize-upstream-fixSkill
- grammar-checkSkill
- grillingSkill
- html-toolsSkill
- logging-best-practicesSkill
- memlab-memory-debuggingSkill
- merge-riskSkill
- no-over-abstractionSkill
- of-courseSkill
- postgresSkill
- production-readinessSkill
- prototypeSkill
- reliable-systemsSkill
- self-reviewSkill
- standupSkill
- systematic-debuggingSkill
- testingSkill
- triage-bug-reportSkill
- web-design-guidelinesSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 13 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 170 edited versions we read keep these.
13
Distinctive
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 10
Never change what the code does — only how it does it.
- Distinctive: line 14
Follow established coding standards from AGENTS.md and the surrounding codebase.
- Distinctive: line 20
Avoid nested ternary operators.
- Distinctive: line 22
Remove unnecessary comments that describe obvious code
- Distinctive: line 27
Treat these as heuristics, not rules.
- Distinctive: line 31
When logic is close to pure, pass its inputs explicitly and return results instead of relying on global state.
- Distinctive: line 41
Avoid over-simplification that reduces clarity or combines too many concerns.
- Distinctive: line 51
If reviewing recent work, run git diff (or git diff HEAD if there are staged changes) to see what changed.
- Distinctive: line 62
If the new code creates a shared helper, verify it has real reuse and is not just extracted private logic with a vague name
- Distinctive: line 77
Keep domain-specific logic close to its domain unless there is proven cross-domain reuse
- Distinctive: line 95
When done, briefly summarize what was fixed or confirm the code was already clean.
- Distinctive: line 99
Update broken references and links
- Distinctive: line 100
Add comments only where they ensure consistency or explain non-obvious decisions
“Common” is measured: kept by at least 6 in 10 of the 170 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Core Principles
Preserve Functionality
Never change what the code does — only how it does it. All original features, outputs, and behaviors must remain intact. Test changes before and after cleanup.
Apply Project Standards
Follow established coding standards from AGENTS.md and the surrounding codebase. Use consistent formatting, naming conventions, and patterns. Prefer explicit, readable code over compact or clever solutions.
Enhance Clarity
Simplify structure by reducing unnecessary complexity and nesting. Eliminate redundant code and abstractions. Consolidate related logic. Choose clarity over brevity — explicit code is easier to reason about and maintain.
- Avoid nested ternary operators; prefer early returns, switch statements, or if/else chains
- Break overly compact chains into named intermediate steps
- Remove unnecessary comments that describe obvious code
- Declare variables at the smallest possible scope
Simplify Function Boundaries
Treat these as heuristics, not rules. Preserve behavior and keep a function when its boundary makes the code clearer.
- Inline a helper used from one place. When work repeats across callers, first see whether the callers can share one path, perhaps through a small option or defaulted parameter, then inline the duplicate logic.
- Combine near-identical variants with meaningful parameters. Avoid flag-heavy functions that obscure distinct behavior.
- When logic is close to pure, pass its inputs explicitly and return results instead of relying on global state.
- For a shared function, use const-qualified inputs and methods where the language supports them and the function's contract allows it.
- Reduce branching and nesting. Prefer a consistent execution path when its extra work is minor; keep guards or fast paths when the avoided work matters.
Remove Duplication
Find duplicate code and consolidate it where a shared path is clearer in the adequate domain boundary. Repeated work should often go through one function or utility; a helper used from only one place should usually be inlined. Identify repeated patterns across files, and extract shared abstractions only when there is real cross-domain reuse. Merge similar configuration or setup instructions.
Maintain Balance
Avoid over-simplification that reduces clarity or combines too many concerns. Do not remove helpful abstractions that improve organization. Prioritize readability over line count.
Workflow
Scope
Focus only on the specified file(s) or directory. Do not make changes outside the target area unless duplication requires extracting a shared utility to an appropriate common location.
Phase 1: Identify Changes
If reviewing recent work, run git diff (or git diff HEAD if there are staged changes) to see what changed. If there are no git changes, review the most recently modified files or PR the user mentioned, or that were edited earlier in the conversation.
Phase 2: Launch Three Review Agents in Parallel
Analyze the code from three angles. Use the Task tool to launch all three agents concurrently in a single message. Pass each agent the relevant files so it has the complete context.
Agent 1: Code Reuse Review
- Search for existing utilities and helpers that could replace newly written code. Look for similar patterns elsewhere in the codebase — common locations are utility directories, shared modules, and files adjacent to the changed ones.
- Flag any new function that duplicates existing functionality. Suggest the existing function to use instead.
- Flag any inline logic that could use an existing utility — hand-rolled string manipulation, manual path handling, custom environment checks, ad-hoc type guards, and similar patterns are common candidates.
- If the new code creates a shared helper, verify it has real reuse and is not just extracted private logic with a vague name
Agent 2: Code Quality Review
Review the relevant file(s) for hacky patterns:
- Redundant state: state that duplicates existing state, cached values that could be derived, observers/effects that could be direct calls
- Parameter sprawl: adding new parameters to a function instead of generalizing or restructuring existing ones; too many parameters suggest the boundary is wrong
- Copy-paste with slight variation: near-duplicate code blocks that should be unified with a shared abstraction
- Leaky abstractions: exposing internal details that should be encapsulated, or breaking existing abstraction boundaries
- Stringly-typed code: using raw strings where constants, enums (string unions), or branded types already exist in the codebase
- Unnecessary JSX nesting: wrapper Boxes/elements that add no layout value — check if inner component props (flexShrink, alignItems, etc.) already provide the needed behavior
- Single-use helpers: helpers called from one place that would read better inlined, or duplicated work that should share one path
- Near-identical variants: function variants that differ by a flag or small branch and could combine with a meaningful parameter; flag-heavy functions that obscure distinct behavior
- Hidden inputs: helpers that read or mutate global state when explicit inputs and return values would keep them predictable
- Keep domain-specific logic close to its domain unless there is proven cross-domain reuse
Agent 3: Efficiency Review
Review the relevant file(s) for efficiency:
- Unnecessary work: redundant computations, complexity, repeated file reads, duplicate network/API calls, N+1 patterns
- Missed concurrency: independent operations run sequentially when they could run in parallel
- Hot-path bloat: new blocking work added to startup or per-request/per-render hot paths
- Recurring no-op updates: state/store updates inside polling loops, intervals, or event handlers that fire unconditionally — add a change-detection guard so downstream consumers aren't notified when nothing changed. Also: if a wrapper function takes an updater/reducer callback, verify it honors same-reference returns (or whatever the "no change" signal is) — otherwise callers' early-return no-ops are silently defeated
- Unnecessary existence checks: pre-checking file/resource existence before operating (TOCTOU anti-pattern) — operate directly and handle the error
- Memory: unbounded data structures, missing cleanup, event listener leaks
- Overly broad operations: reading entire files when only a portion is needed, loading all items when filtering for one
Phase 3: Fix Issues
Aggregate findings and fix each issue directly. If a finding is a false positive or not worth addressing, note it and move on — do not argue with the finding, just skip it. Verify nothing breaks during removal or consolidation.
When done, briefly summarize what was fixed or confirm the code was already clean.
Documentation Cleanup
- Update broken references and links
- Add comments only where they ensure consistency or explain non-obvious decisions
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.

