refactor
Skill2 starsChanged 58 days agoMITView on GitHub
Structural refactoring and code simplification pass. Use this skill whenever the user wants to clean up, simplify, refactor, restructure, or improve code clarity, consistency, maintainability, or efficiency. Triggers on phrases like "refactor", "clean up", "simplify", "improve readability", "remove duplication", "make this cleaner", "optimize this code", or any request to restructure, consolidate, or polish recently modified or existing code and documentation. Also trigger when reviewing changed code for reuse, quality, and efficiency issues.
111 other projects use a version of this.
Adopted by
Most recently taken up by
- AllThingsSmitty/proven-skillstheir own version, first seen Oct 6, 2026
- GUOJIE-HONG/skillstheir own version, first seen Oct 5, 2026
- morodomi/dev-crewtheir own version, first seen Oct 5, 2026
- Integralist/agent-skillstheir own version, first seen Oct 4, 2026
- AlvaroVFon/skillstheir own version, first seen Oct 3, 2026
- devantler-tech/ksailtheir own version, first seen Oct 3, 2026
Used with
Projects with it also use modern-go, to-design 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.
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
jidechaoSkillto-design
Generate a design document (design proposal) from a PRD, in the style of Go's official design proposals — Abstract / Background / Design / Rationale / Compatibility / Implementation, heavy on the 'why' and tradeoffs. Triggers on: to-design, prd-to-design, prd转设计文档, 生成设计文档, 写设计文档, design doc, design proposal, 设计提案, 技术设计文档.
Also in 3 projects that use this
chidekinaSkilltest-gen
Generate test cases from type constraints and specs. Creates boundary tests, edge cases, and fixtures automatically. Pact-lang inspired. Triggers on: generate tests, test from spec, create fixtures, boundary tests.
Also in 5 projects that use this
pvnarpSkillincident
Guides incident response and post-mortem analysis. Covers triage, mitigation, root cause analysis, and prevention. Use when responding to active incidents, writing post-mortems, or improving incident processes.
Also in 6 projects that use this
platformplatformSkilldb-query
Query the local Postgres database of the active Aspire worktree via psql.
Also in 3 projects that use this
JetBrainsSkillfix-bug
End-to-end bug fix workflow for the Exposed project. Accepts a GitHub issue (#NUMBER), YouTrack issue (EXPOSED-NUMBER), or YouTrack URL (https://youtrack.jetbrains.com/issue/EXPOSED-NUMBER). Fetches the issue, creates a failing reproducer test, commits on a new branch, implements the fix, validates, and opens a PR. Use this skill whenever the user wants to fix a bug from an issue tracker, mentions a EXPOSED issue number, or references a GitHub issue to fix.
Also in 6 projects that use this
- +2 more from jidechao
Other versions111 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 111
- github/awesome-copilot★ 40ksame name
- parcadei/Continuous-Claude-v3★ 3.9ksame name
- codeaholicguy/ai-devkit★ 1.6ksame name
- SethGammon/Citadel★ 922same name
- solatis/claude-config★ 909same name
- boshu2/agentops★ 447same name
- nwiizo/tfmcp★ 373same name
- smallnest/goal-workflow★ 287same name
- oasm-platform/open-asm★ 204same name
- sd0xdev/sd0x-harness★ 191same name
101 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 repository21 other files it gives its agents.
- .agents/skills/vercel-composition-patterns/AGENTS.mdAGENTS.md
- .agents/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- automate-meSkill
- bazelSkill
- benchmarkingSkill
- break-uiSkill
- code-documentationSkill
- devils-advocateSkill
- diagnoseSkill
- find-standardsSkill
- grammar-checkSkill
- html-toolsSkill
- logging-best-practicesSkill
- memlab-memory-debuggingSkill
- no-over-abstractionSkill
- production-readinessSkill
- testingSkill
- triage-bug-reportSkill
- vercel-composition-patternsSkill
- vercel-react-best-practicesSkill
- web-design-guidelinesSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 11 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 94 edited versions we read keep these.
11
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 14
Never change what the code does — only how it does it.
- Distinctive: line 18
Follow established coding standards from AGENTS.md and the surrounding codebase.
- Distinctive: line 24
Avoid nested ternary operators.
- Distinctive: line 26
Remove unnecessary comments that describe obvious code
- Distinctive: line 35
Avoid over-simplification that reduces clarity or combines too many concerns.
- Distinctive: line 45
If reviewing recent work, run git diff (or git diff HEAD if there are staged changes) to see what changed.
- Distinctive: line 56
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 69
Keep domain-specific logic close to its domain unless there is proven cross-domain reuse
- Distinctive: line 87
When done, briefly summarize what was fixed or confirm the code was already clean.
- Distinctive: line 91
Update broken references and links
- Distinctive: line 92
Add comments only where they ensure consistency or explain non-obvious decisions
“Common” is measured: kept by at least 6 in 10 of the 94 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
Refactor and Simplify
Refactor and simplify code to improve clarity, consistency, and maintainability while preserving exact functionality. This skill combines structural cleanup, duplication removal, and quality review into a single workflow. Fix any issues found.
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
Remove Duplication
Find and consolidate duplicate code into reusable functions or shared utilities. Identify repeated patterns across files and extract common abstractions. 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
- 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
- Parameter sprawl: passing too many parameters to a function, making it hard to read and maintain. Check whether the boundary is wrong
- 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.

