SuperAPI AI Directory

code-simplify

Coding & development

View repository

Updated 11-06 16:22

About this skill

Code Simplify

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:

  1. If there are uncommitted changes: git diff --name-only + git diff --name-only --cached result (both staged and unstaged).
  2. If there are no uncommitted changes: Files changed in the most recent commit. git diff --name-only HEAD~1...HEAD result.

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:
      1. List of changed files
      2. Summary of the main refinements applied to each file

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 diff recommend 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