/ardent:cleanupfrom ardent
Simplify and refine recently modified code for clarity and maintainability while preserving behavior. Use for requests like "simplify this", "clean this up", "reduce complexity", or readability-focused refactors.
Ships in ardent. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Simplify code for clarity, consistency, and maintainability while preserving behavior. Default focus is recently modified code unless the user specifies a different scope.
Branch: !git branch --show-current
Arguments: $ARGUMENTS
Determine target files in this order:
git diff --name-onlygit diff --cached --name-onlygit diff --name-only origin/main...HEADExclude test files unless the user explicitly asks to simplify tests.
Choose strategy based on file count:
| Files | Strategy |
|---|---|
| 1-8 | Single pass — handle all files yourself, sequentially |
| 9+ | Parallel — chunk files and spawn cleanup agents |
Announce: "Simplifying {N} files — using {single pass / parallel} strategy."
Read each target file and surrounding context before making changes.
Allowed transformations:
Avoid over-simplification. Do not:
Run from repo root after edits:
npm run lint:fixnpm run typecheckFix any issues introduced by simplification.
Provide:
Run this command, replacing {FILE_LIST_CMD} with the command that produces your file list (e.g., git diff --name-only origin/main...HEAD):
{FILE_LIST_CMD} | grep -v '\.test\.' | grep -v '__tests__' | awk -v max=8 '
{ bin = int((NR-1) / max) + 1; print "CHUNK_" bin "\t" $0 }
END { for (i = 1; i <= bin; i++) printf "SUMMARY\tCHUNK_%d\t%d files\n", i, (i < bin ? max : NR - (bin-1)*max) }
'
This splits files into groups of 8 (round-robin by input order). Each CHUNK_N block becomes one agent.
Spawn one agent per chunk in a single message (all run_in_background: true).
Each agent prompt:
You are a cleanup agent. Simplify the assigned files for clarity and maintainability while preserving behavior.
## Your assigned files
{CHUNK_FILES — one per line}
## Instructions
1. Read each file.
2. Apply ONLY these behavior-preserving transformations:
- Remove dead code, unused locals, unreachable branches
- Flatten unnecessary nesting (prefer early returns)
- Inline trivial one-use variables/helpers that obscure intent
- Collapse redundant conditional/branching logic
- Remove one-off abstractions or wrappers that add indirection without value
3. Edit each file with your simplifications.
4. Skip files that are already clean — do not force changes.
## Guardrails
- Preserve exact behavior (including evaluation order and side effects)
- Do not add features, validation, fallback behavior, or broader refactors
- Do not change public APIs, exported contracts, or signatures
- Do not touch tests
- Respect CLAUDE.md / AGENTS.md constraints (read them first: {CLAUDE_MD_PATHS})
- Prefer clear control flow over compact clever expressions
- No nested ternaries, no over-clever one-liners
- Three clear lines > one dense line
## Output
End your response with:
AGENT: Cleanup {N}/{TOTAL}
FILES_CHANGED: {count}
CHANGES:
- {file}: {what you simplified}
- ...
Wait for all agents to complete. Then run from repo root:
npm run lint:fix
npm run typecheck
Fix any issues. Report total files simplified and key changes across all agents.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ardent-ai/ardent-claude-plugins --plugin ardent24 skills in this plugin
/address_pr_feedbackAnalyze PR changes and comments, create a plan, and implement feedback/archiveUpload HTML docs to the team's GitHub Pages archive for permanent browsing and sharing. Use when the user says "archive this", "upload to archive", or /archive./brainstormExplore requirements and approaches through collaborative dialogue before planning/compoundDocument a recently solved problem to compound your knowledge/deepen-planEnhance a plan with parallel research agents for depth, best practices, and implementation details/design-reviewValidate the high-level design of an existing plan or in-progress feature before buildingOther plugins' skills for the same job