simplify
Skill199 starsChanged 2 months agoMITView on GitHub
Simplify and refactor code while preserving functionality and library constraints.
119 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- thistleknot/skillstheir own version, first seen Nov 8, 2026
- PeanutGT/NutsSkillstheir own version, first seen Nov 8, 2026
- Ovich/charrettetheir own version, first seen Nov 8, 2026
- caidanw/skillstheir own version, first seen Nov 8, 2026
- Ovich/swarmstormtheir own version, first seen Nov 8, 2026
- alexandrosandre/agentic-engineeringtheir own version, first seen Nov 8, 2026
Used with
Projects with it also use clonedeps, verification-planning and 5 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.
mike22890Skillclonedeps
将项目依赖的第三方库源码克隆到本地,便于深入阅读和调试。当需要查看库的实现细节、阅读源码、调试第三方依赖、理解 SDK/framework 内部机制、查看 node_modules 之外的原始代码、分析开源库架构、学习他人代码、查看依赖的 TypeScript 类型定义时使用。
Also in 3 projects that use this
mdrubelamin2Skillverification-planning
Plans how to prove a change works or broke nothing: frames the claim, designs an evidence path from the system itself, and requires every check to be able to fail.
Also in 3 projects that use this
devbrother2024Skillartifact-design
단독 self-contained HTML 산출물(랜딩 페이지, 정적 문서·리포트, 독립 대시보드, 데모·게임, 개발 전 UX/UI 대안 비교 목업)을 만들 때 팔레트·타이포그래피·레이아웃을 의도적으로 설계하고 템플릿·AI스러운 디자인을 피하도록 돕는 디자인 가이드. HTML/CSS를 쓰기 전에 로드한다. "랜딩 만들어줘", "이 내용 단일 HTML로 예쁘게", "UX 대안 HTML로 비교해줘", "디자인 잡아줘"처럼 단독 HTML 아티팩트를 만들거나 비교하는 요청에 활성화하고, 기존 앱(React·Vue 등)의 인앱 컴포넌트 수정이나 순수 백엔드·로직 작업에는 쓰지 않는다.
Also in 3 projects that use this
codebycoreySkillbatch
Create multiple proposals from free-form feature descriptions. Use when planning several features at once, batch creating proposals, or setting up related changes.
Also in 4 projects that use this
mehd-ioSkilldataviz
Also in 3 projects that use this
JordanCoinSkillcodemap
Analyze codebase structure, dependencies, changes, cross-agent handoffs, and get code-aware intelligence. Use when user asks about project structure, where code is located, how files connect, what changed, how to resume work, before starting any coding task, when you need risk analysis and skill guidance, or when Codemap should tune project config before analysis.
Also in 4 projects that use this
Other versions119 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- gaebalai/claude-code-orchestrator★ 1889% same
- ilhae-ai/claude-code-orchestrator★ 1889% same
Wrote their own version · 117
- Z3Prover/z3★ 13ksame name
- aaddrick/claude-desktop-debian★ 5.5ksame name
- CherryHQ/cherry-studio-app★ 4.1ksame name
- elliothux/open-compute★ 3.3ksame name
- meta-pytorch/OpenEnv★ 2.8ksame name
- huggingface/OpenEnv★ 2.8ksame name
- bholmesdev/hubble.md★ 1.5ksame name
- kdlbs/kandev★ 1.1ksame name
- truffle-ai/dexto★ 659same name
- deadlock-mod-manager/deadlock-mod-manager★ 584same name
107 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 repository17 other files it gives its agents.
- .agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- catchupSkill
- checkpointingSkill
- codex-systemSkill
- context-loaderSkill
- design-trackerSkill
- featureSkill
- initSkill
- planSkill
- research-libSkill
- spikeSkill
- tddSkill
- team-executeSkill
- troubleshootSkill
- update-lib-docsSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 3 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 111 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 116
Read the file(s) to understand current structure
- Very specific: line 123
Check constraints in .claude/docs/libraries/
- Distinctive: line 131
Verify it doesn't break library usage
- Distinctive: line 203
Always preserve library features/constraints
- Very specific: line 205
Don't change behavior (refactoring only) — regressions[] is the evidence
- Very specific: line 206
Run --phase after again after each significant change.
“Common” is measured: kept by at least 6 in 10 of the 111 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
Simplify Code
Simplify and refactor $ARGUMENTS.
This skill edits source code while promising not to change behaviour and not to widen its own scope. Both promises are checked rather than asserted: Step 0 records a gate baseline and the declared target set, and Step 5 compares against it. A refactor whose baseline was never recorded cannot be reported as verified.
Declared Scope
Resolve $ARGUMENTS into a concrete list of files and/or directories before
editing anything, and pass each one as a --scope entry in Step 0. That list
is the answer to "was this a refactor or a rewrite" — anything else that changes
is reported as out_of_scope_files and fails Step 5.
Simplification Principles
- Single Responsibility - 1 function = 1 thing
- Short Functions - Target under 20 lines
- Shallow Nesting - Early return, depth ≤ 2
- Clear Naming - Clear enough to not need comments
- Type Hints Required - On all functions
Steps
0. Record the Baseline (mandatory, before any edit)
python3 .claude/skills/simplify/simplify_gate.py --phase before \
--scope {target file or dir} [--scope {another}] [--base main]It runs _shared/verify.sh and _shared/gather_diff.py and writes
.claude/logs/simplify-baseline.json: the gate status of every tool as it is
now, the current HEAD, the declared scope, and any file that was already
modified before you started. Without this, a gate that was red the whole time is
indistinguishable from a regression this refactor introduced.
Read the JSON:
overall_before—pass/fail/no_gates. Onfail, note which tools are in the baseline as failing; Step 5 will report them aspre_existing_failuresrather than blaming your refactor.pre_existing_changes[]— dirty files you did not touch, excluded from the scope check later.baseline_file,artifacts[].
Exit codes: 0 baseline recorded · 1 bad arguments, or --scope missing —
without a declared target set "no scope creep" cannot be checked · 2 no gate
could run at all, so the refactor would be unverifiable · 3 verify.sh /
gather_diff.py failed, or the baseline could not be written.
--baseline PATH moves the record elsewhere (default
.claude/logs/simplify-baseline.json); pass the same value to both phases when
two refactors are in flight. --project-root DIR relocates the repository root.
On exit 2, stop. Either configure the project's gates, or agree with the user
on the exact commands that will verify this refactor, run them, record each
command with its exit code, and re-run with --allow-no-gates so the payload
carries allow_no_gates: true. Do not edit code first and decide how to verify
it afterwards.
Steps 1-4 Are Delegated
Reading the target files, checking library behaviour, and applying the edits are
all past the triggers in .claude/rules/delegation.md — an unread file, a
codebase sweep, external lookup, more than ~30 lines of output. The lead keeps
Step 0, Step 5, and the "is this actually simpler" judgment; everything between
them is delegated, one delegation per scope entry, launched in parallel when the
scopes are independent:
Task tool:
subagent_type: "general-purpose-sonnet" # general-purpose-opus when the code carries
# security, concurrency, or data-integrity risk
prompt: |
Objective: Simplify {scope path} without changing observable behaviour.
Scope:
- Edit only these paths: {the same --scope entries passed in Step 0}.
- Refactor only. No new features, no API changes, no dependency changes.
- Do not modify, skip, or weaken any test.
Inputs:
- Read .claude/rules/coding-principles.md first.
- Library constraints: .claude/docs/libraries/ (check every library the target uses;
WebSearch only what those notes do not answer).
- Apply the Simplification Principles and the patterns in
.claude/skills/simplify/SKILL.md (early return, extract function).
Acceptance checks — run before returning:
bash .claude/skills/_shared/verify.sh
Output shape:
## Hotspots found (file:line -> problem)
## Changes applied (file:line -> what and why it reads better)
## Library constraints that shaped or blocked a change
## Anything deliberately left alone
Context discipline: return the summary only; do not paste diffs or file bodies.The reference material below is what the delegate follows — and what the lead applies directly when the target is a single already-open file of roughly 20 lines or fewer (Self-Handle List item 2).
1. Analyze Target Code
- Read the file(s) to understand current structure
- Identify complexity hotspots (deep nesting, long functions)
- List functions/classes to simplify
2. Check Library Constraints
- Identify libraries used in target code
- Check constraints in
.claude/docs/libraries/ - Web search for unclear library behaviors
3. Plan Refactoring
For each complexity issue:
- What change to make
- Why it improves readability
- Verify it doesn't break library usage
4. Execute Refactoring
Apply changes following these patterns:
Early Return:
# Before
def process(value):
if value is not None:
if value > 0:
return do_something(value)
return None
# After
def process(value):
if value is None:
return None
if value <= 0:
return None
return do_something(value)Extract Function:
# Before
def main():
# 50 lines of mixed concerns
...
# After
def main():
data = load_data()
result = process_data(data)
save_result(result)5. Verify Against the Baseline
python3 .claude/skills/simplify/simplify_gate.py --phase afterThe scope and base ref are read back from the baseline, so they cannot drift
between the two phases; --scope may be repeated here to narrow them further.
It re-runs the gates, re-collects the changed files, and attributes every
failure:
regressions[]— a gate that passed (or was skipped) before and fails now. This is the only list your refactor is responsible for. Fix it.pre_existing_failures[]— red before, red after. Report, do not fix here.fixed[]— red before, green now.gates—{tool: {before, after}}for every gate; quote it rather than re-typing statuses, soskippedis never reported aspass.changed_files[]/in_scope_files[]/out_of_scope_files[]— the diff this run produced.out_of_scope_filesis non-empty only when a file outside--scopechanged and was not already dirty at baseline.verify_log,diff_file— full gate output and the full patch, for reading rather than for context.warnings[]— includes "no file changed" and "HEAD moved between the two phases".
Exit codes: 0 no regression and no scope creep · 1 no readable baseline (run
--phase before first) · 2 a gate regressed, a file outside --scope changed,
or no gate could run · 3 verify.sh / gather_diff.py failed.
Then self-review diff_file yourself: the gate proves the tests still pass and
the scope held, not that the result is simpler. That judgment is yours.
Notes
- Always preserve library features/constraints
- Web search for unclear points
- Don't change behavior (refactoring only) —
regressions[]is the evidence - Run
--phase afteragain after each significant change; it is idempotent - The "under 20 lines" and "depth ≤ 2" targets are guidance, not thresholds to enforce mechanically. No bundled script measures them, deliberately: a rule that split every 20-line function would produce worse code than it found. Judge each hotspot on whether the extraction has a name worth having.
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.

