code-simplifier Invoke an agent to simplify/refine recently modified code. Keep functionality unchanged while improving readability, consistency, and maintainability.
Arguments
- scope (optional): Target directory or file pattern to refine. If omitted, the auto-detection logic below applies.
Execution Steps
Step 1: Detect Target Scope
If the user specified a scope, use that value as-is for $TARGET_SCOPE.
If there is no scope, auto-detect using the following priority:
- If there are uncommitted changes:
git diff --name-only+git diff --name-only --cachedresult (both staged and unstaged). - If there are no uncommitted changes: Files changed in the most recent commit.
git diff --name-only HEAD~1...HEADresult.
If the detected files are empty, notify the user that "there are no files to refine" and exit.
Step 2: Invoke code-simplifier Agent
Agent tool로 code-simplifier Invoke the agent:
- subagent_type:
code-simplifier - description: "Simplify and refine recent code"
- Content that must be included in the prompt:
- List of files to refine:
$TARGET_SCOPE - Never change functionality (preserve behavior, return values, API contracts, external side effects)
- Follow the project's coding standards (CLAUDE.md, etc.)
- Prioritize readability and clarity (clarity over brevity)
- Do not over-simplify - avoid nested ternary operators, overly compressed one-liners, etc.
- Content to output after completion:
- List of changed files
- Summary of the main refinements applied to each file
- List of files to refine:
Step 3: Report Results
Briefly summarize and show the result returned by the agent to the user:
- Number of changed files and their paths
- Summary of main improvements (1-2 lines)
- For review,
git diffrecommend checking and running tests
Important Notes
code-simplifierrefines only the structure and expression of the code without changing functionality- After changes, always run tests to confirm there are no regressions