ワンクリックで
gh-simplify-code
Simplify and refine recently changed code for clarity, reuse, quality, and efficiency while preserving behavior.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Simplify and refine recently changed code for clarity, reuse, quality, and efficiency while preserving behavior.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Generate and critically evaluate grounded improvement ideas for the current project. Use when asking what to improve, requesting idea generation, exploring surprising improvements, or wanting the AI to proactively suggest strong project directions before brainstorming one in depth. Triggers on phrases like 'what should I improve', 'give me ideas', 'ideate on this project', 'surprise me with improvements', 'what would you change', or any request for AI-generated project improvement suggestions rather than refining the user's own idea.
Create structured plans for any multi-step task -- software features, research workflows, events, study plans, or any goal that benefits from structured breakdown. Also deepen existing plans with interactive review of sub-agent findings. Use for plan creation when the user says 'plan this', 'create a plan', 'write a tech plan', 'plan the implementation', 'how should we build', 'what's the approach for', 'break this down', 'plan a trip', 'create a study plan', or when a brainstorm/requirements document is ready for planning. Use for plan deepening when the user says 'deepen the plan', 'deepen my plan', 'deepening pass', or uses 'deepen' in reference to a plan.
[BETA] Execute work with external delegate support. Same as gh:work but includes experimental Codex delegation mode for token-conserving code implementation.
Execute work efficiently while maintaining quality and finishing features
Refresh stale or drifting learnings and pattern docs in docs/solutions/ by reviewing, updating, consolidating, replacing, or deleting them against the current codebase. Use after refactors, migrations, dependency upgrades, or when a retrieved learning feels outdated or wrong. Also use when reviewing docs/solutions/ for accuracy, when a recently solved problem contradicts an existing learning, when pattern docs no longer reflect current code, or when multiple docs seem to cover the same topic and might benefit from consolidation.
Document a recently solved problem to compound your team's knowledge or update CONCEPTS.md, the project's shared domain vocabulary.
| name | gh:simplify-code |
| description | Simplify and refine recently changed code for clarity, reuse, quality, and efficiency while preserving behavior. |
| argument-hint | [blank to simplify current branch changes, or describe what to simplify] |
You are an engineer that is an expert at simplifying code with a specific focus on enhancing code clarity, consistency, and maintainability while preserving exact functionality. Your expertise lies in applying project-specific best practices to simplify and improve code without altering its behavior. You prioritize readable, explicit code over overly compact solutions.
Review the changed code for reuse, quality, and efficiency. Fix any issues found. Then verify behavior is preserved by running the project's test suite.
Resolve the simplification scope in this order:
git diff origin/main... or against the configured upstream). This covers the common case of "simplify everything I've added on this feature branch before opening a PR." If the branch has no upstream or base ref, fall back to staged + unstaged changes (git diff HEAD).If none of the above produces a non-empty scope, stop and ask the user what to simplify rather than guessing.
Spawn the three reviewer agents below in a single message via the platform's subagent dispatch primitive — Agent/Task in Claude Code, spawn_agent in Codex, subagent in Pi via the pi-subagents extension. Pass each agent the full diff (or the resolved file set) so it has the complete context.
Model selection. Use the platform's mid-tier model for these reviewers: model: "sonnet" in Claude Code, the equivalent mid-tier on Codex (gpt-5.4-mini as of April 2026) via spawn_agent, the equivalent on Pi via subagent from the pi-subagents extension. On platforms where the model-override parameter is unavailable or the model name is unrecognized, omit the override — a working pass on the parent model beats a broken dispatch.
Permission mode. Omit the mode parameter on the dispatch call so the user's configured permission settings apply.
For each change:
Review the same changes for hacky patterns:
a ? x : b ? y : ...), nested if/else, or nested switch 3+ levels deep — flatten with early returns, guard clauses, a lookup table, or an if/else-if cascadeno-unused-vars / unused-imports, knip, ruff F401, tsc --noEmit --noUnusedLocals, golangci-lint unused, etc.). Otherwise prefer a structural search like ast-grep over plain text grep — grep produces false positives from string literals, comments, and substring matches in unrelated identifiers. Account for re-exports (export * from, barrel files), dynamic imports (import(), require(), template-string imports), and framework-specific exports (Next.js page exports, React Server Components, decorators). False positives here are higher-cost than missed catches; if uncertain, skip.Review the same changes for efficiency:
Wait for all three agents to complete. Aggregate their findings and fix each issue directly. If a finding is a false positive or not worth addressing, note it and move on. Do not argue with the finding or raise questions to the user, just skip it.
The premise of this skill is that simplification preserves exact functionality. After applying fixes:
Run typecheck and lint over the full project. They are usually fast and catch the most common simplification regressions — broken imports, unused exports, dropped type narrowings, dead code other modules still reference.
Run tests:
Surface any failure clearly with the failing check name and the relevant output. Do not relax assertions, weaken type signatures, or skip tests to make checks pass — that defeats the "preserves functionality" guarantee. Either fix the underlying break introduced by simplification, or revert the specific change that caused the regression.
If no test suite, lint, or typecheck is configured, state that explicitly in the summary; do not silently skip verification.
Briefly summarize what was good vs improved and fixed, including which checks were run and their results. If there were no findings to act on, confirm the code didn't require any changes.