code-simplifier
Skill0 starsChanged 2 months agoMITView on GitHub
Simplify and refine changed code for clarity, consistency, and maintainability while preserving all functionality. PR-scoped by default. Accepts an optional PR number, file glob, or base branch to narrow scope. Triggers on: "simplify code", "code simplifier", "clean up the code", "simplify the PR".
42 other projects use a version of this.
Adopted by
Most recently taken up by
- kopp0510/claude-ddtheir own version, first seen Oct 5, 2026
- aktsmm/Agent-Skillstheir own version, first seen Oct 4, 2026
- yeisonrestrepo/code-conductortheir own version, first seen Oct 3, 2026
- wty-yy/skillstheir own version, first seen Oct 2, 2026
- zvadaadam/az-skillstheir own version, first seen Sep 28, 2026
- rtk-ai/rtktheir own version, first seen Sep 22, 2026
Used with
Projects with it also use comment-analyzer, performance and 9 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.
lin30Skillcomment-analyzer
微博评论抓取与深度分析,生成可视化HTML报告。Use when user asks to analyze weibo comments, analyze social media comments, or requests sentiment analysis from weibo posts
Also in 3 projects that use this
pluginagentmarketplaceSkillperformance
Optimize application performance through caching strategies, load balancing, database scaling, and monitoring. Build systems handling thousands of concurrent users.
Also in 3 projects that use this
AWSSkillsetup-matt-pocock-skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
Also in 3 projects that use this
OpenAISkillverification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
Also in 4 projects that use this
AWSSkillto-spec
Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed.
Also in 3 projects that use this
GoogleSkillcode-review
Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.
Also in 9 projects that use this
- +2 more from aws
Other versions42 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 42
- rtk-ai/rtk★ 82ksame name
- getsentry/skills★ 1ksame name
- Azure/azqr★ 793same name
- microsoft/ghqr★ 529same name
- feiskyer/codex-settings★ 244same name
- FlorianBruniaux/ccboard★ 96same name
- zvadaadam/az-skills★ 49same name
- roman01la/skills-agents★ 48same name
- 1024XEngineer/bytemind★ 43same name
- kumaran-is/claude-code-onboarding★ 36same name
32 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 repository48 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- changelogSkill
- dependabot-sweepSkill
- markdownSkill
- merge-prSkill
- pre-prSkill
- pr-tldrSkill
- tldrSkill
- agents-searchSkill
- audit-and-fixSkill
- aws-specialistSkill
- azure-specialistSkill
- create-assessmentSkill
- create-auditSkill
- create-experimentSkill
- create-inspectionSkill
- crossplane-specialistSkill
- deploy-statusSkill
- detect-flakySkill
- fix-with-evidenceSkill
- flyctlSkill
- gcp-specialistSkill
- gitSkill
- ground-firstSkill
- handoffSkill
- kubernetes-specialistSkill
- local-attestSkill
- plan-graderSkill
- post-pr-reviewSkill
- pr-conductorSkill
- project-syncSkill
- pulumi-specialistSkill
- quality-reviewSkill
- release-conductorSkill
- reproduce-bugSkill
- review-prSkill
- review-prsSkill
- rollback-prodSkill
- security-auditSkill
- security-reviewSkill
- smoke-testSkill
- specSkill
- terraform-specialistSkill
- terragrunt-specialistSkill
- validate-specSkill
- veracity-auditSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. 0 are common, 13 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 40 edited versions we read keep these.
13
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
If $ARGUMENTS matches ^[0-9]+$ (a PR number), fetch the changed file list:
- Very specific: line 42
If $ARGUMENTS looks like a file glob (contains *, ?, or / without being a valid ref), expand it:
- Very specific: line 49
If $ARGUMENTS is a branch name or empty, diff against the base:
- Distinctive: line 67
Gate: if zero files are in scope, stop: "No changed code files detected — nothing to simplify."
- Distinctive: line 73
Read the project's CLAUDE.md (if present) to discover language-specific coding standards, naming conventions, formatting preferences, and …
- Distinctive: line 75
If no CLAUDE.md exists, apply universal simplification principles only.
- Distinctive: line 79
Read each file identified in step 1 in full.
- Distinctive: line 89
Use whichever command matches the input mode from step 1.
- Distinctive: line 96
Eliminate redundancy: remove duplicate logic, consolidate repeated patterns
- Distinctive: line 98
Remove dead code: delete unreachable code, unused imports, commented-out blocks — but only within the changed scope
- Distinctive: line 100
Avoid nested ternary operators — prefer switch statements or if/else chains for multiple conditions
- Distinctive: line 103
Remove noise comments: delete comments that describe what the code obviously does
- Distinctive: line 105
Balance: do not over-simplify. Concrete examples of the boundary:
- Distinctive: line 126
MUST NOT change behavior: Only change how the code is expressed, never what it does.
- Very specific: line 127
MUST NOT auto-commit: Leave changes in the working tree.
- Distinctive: line 132
After all edits, provide a concise summary:
- Distinctive: line 149
If no simplification opportunities were found: "Code simplification: clean — no changes needed."
“Common” is measured: kept by at least 6 in 10 of the 40 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 and refine changed code for clarity, consistency, and maintainability while preserving all functionality. PR-scoped by default — operates only on files changed in the current branch.
Trigger: when the user asks to "simplify code", "clean up the code", "simplify the PR", or "run the code simplifier". Also triggered directly via /code-simplifier [arg].
Arguments: $ARGUMENTS — optional. Accepts a PR number (e.g. 42), a file glob (e.g. src/**/*.ts), or a base branch (e.g. origin/develop). If empty, defaults to files changed vs origin/main.
Steps
1. Detect scope
Determine which files to simplify. First, validate $ARGUMENTS if provided — reject values that start with - or contain shell metacharacters (; & | > < \ `` ``); they indicate injection attempts.
If $ARGUMENTS matches ^[0-9]+$ (a PR number), fetch the changed file list:
gh pr diff "$ARGUMENTS" --name-only
MERGE_BASE="" # not applicable for PR# modeIf $ARGUMENTS looks like a file glob (contains *, ?, or / without being a valid ref), expand it:
git ls-files -- "$ARGUMENTS"
MERGE_BASE="" # not applicable for glob modeIf $ARGUMENTS is a branch name or empty, diff against the base:
BASE="${ARGUMENTS:-origin/main}"
# Fallback if the specified base doesn't exist
if ! git rev-parse --verify "$BASE" >/dev/null 2>&1; then
BASE=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/||')
if [ -z "$BASE" ]; then
echo "ERROR: cannot determine base branch. Pass a base branch as argument."
exit 1
fi
fi
MERGE_BASE=$(git merge-base HEAD "$BASE")
git diff "$MERGE_BASE" --name-onlyFilter to code files only — skip binary files, images, lockfiles (*.lock, package-lock.json), and any generated artifact paths listed in the project's CLAUDE.md. Do not assume project-specific paths.
Gate: if zero files are in scope, stop: "No changed code files detected — nothing to simplify."
Report: "Scope: N files changed."
2. Read project conventions
Read the project's CLAUDE.md (if present) to discover language-specific coding standards, naming conventions, formatting preferences, and any generated-artifact paths to exclude. Do not assume any language or framework — let the project's own instructions guide your simplification choices.
If no CLAUDE.md exists, apply universal simplification principles only.
3. Read changed files
Read each file identified in step 1 in full. For large files (>500 lines), focus on the changed hunks by reading the diff:
# Branch/base mode — $MERGE_BASE is defined
git diff "$MERGE_BASE" -- <file>
# PR# mode — use gh to fetch the hunk
gh pr diff "$ARGUMENTS" -- <file>Use whichever command matches the input mode from step 1.
4. Analyze for simplification opportunities
For each file, identify opportunities to improve clarity without changing behavior:
- Reduce nesting: flatten deeply nested if/else chains, extract early returns
- Eliminate redundancy: remove duplicate logic, consolidate repeated patterns
- Improve naming: rename unclear variables and functions to express intent
- Remove dead code: delete unreachable code, unused imports, commented-out blocks — but only within the changed scope
- Simplify control flow: replace overly clever constructs with straightforward alternatives
- Avoid nested ternary operators — prefer switch statements or if/else chains for multiple conditions
- Choose clarity over brevity — explicit code is better than dense one-liners
- Consolidate related logic: group related statements, reduce unnecessary indirection
- Remove noise comments: delete comments that describe what the code obviously does
Balance: do not over-simplify. Concrete examples of the boundary:
- ✓ Replace
a ? b : c ? d : ewith an if/else chain - ✓ Extract a guard clause instead of wrapping the entire function body in
if (ok) { ... } - ✗ Don't merge two 5-line functions into one 15-line function to "reduce files"
- ✗ Don't combine unrelated logic to reduce line count
Also avoid:
- Creating overly clever solutions that are harder to understand
- Combining too many concerns into single functions
- Removing helpful abstractions that improve organization
- Making the code harder to debug or extend
5. Apply edits
Edit each file using the Edit tool. One edit per logical simplification — do not batch unrelated changes into a single edit.
Hard rules:
- MUST NOT edit files outside the scope from step 1. This is the most important guardrail. If a simplification opportunity exists in an unchanged file, mention it in the report but do not touch it.
- MUST NOT change behavior. Only change how the code is expressed, never what it does. All original features, outputs, and behaviors must remain intact.
- MUST NOT auto-commit. Leave changes in the working tree. The user or calling skill (e.g.
/pre-pr) decides whether to commit. - MUST NOT add new dependencies, features, or abstractions beyond what the existing code already uses.
6. Report
After all edits, provide a concise summary:
Code simplification: <branch> (base: <base>)
Files analyzed: N
Files modified: M
Files skipped: K (no opportunities found)
Changes:
- <file>: <one-line description of what changed and why>
- <file>: <one-line description>
Out-of-scope opportunities (not applied):
- <file>:<line>: <description> (file not in changed set)If no simplification opportunities were found: "Code simplification: clean — no changes needed."
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.

