From 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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ardent:cleanupThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Simplify code for clarity, consistency, and maintainability while preserving behavior.
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.
npx claudepluginhub ardent-ai/ardent-claude-plugins --plugin ardentSimplifies recently modified code for clarity, consistency, and maintainability while preserving functionality. Auto-invokes or runs on demand.
Refines existing code for clarity, readability, and maintainability without changing behavior, interfaces, or outputs. Use for simplify, clean up, refactor for readability requests.
Simplifies code for clarity by reducing complexity while preserving exact behavior. Use when refactoring functional but hard-to-read code, during reviews, or for maintenance.