kit/plugins/code-simplifier/skills/code-simplifier/SKILL.md
Analyzes code for smells and complexity. Creates a prioritized refactoring plan targeting the worst offenders. Use when the user asks to simplify code, reduce complexity, or refactor.
npx skillsauth add shawn-sandy/agentics code-simplifierInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze code for structural quality issues and code smells. Create a prioritized refactoring plan with specific improvement steps and before/after code examples. After developer approval, apply the approved changes. Adapt analysis depth to the code's complexity and scope.
Before analyzing, identify which files to check using this priority order:
Explicit path in message — If the user named a file or directory, use it
directly. For directories, use Glob to list source files within them
(exclude binaries, lock files, generated files, node_modules/, dist/,
.git/). Skip to Step 1.
Local changes (git status) — If no file was specified, run:
git status --short
Branch diff — Run each in order until files are returned:
git diff main...HEAD --name-onlygit diff master...HEAD --name-onlygit diff HEAD~1 --name-only
If files are returned, show the list and confirm before analyzing. If all
return empty or fail, continue to step 4.Fallback — Use AskUserQuestion to ask: "Which file or files would you
like me to analyze for code smells?"
Once target files are confirmed, proceed to Step 1.
EnterPlanMode is a deferred tool whose schema must be loaded before it can be
called. Use ToolSearch with select:EnterPlanMode first, then call
EnterPlanMode. Both steps happen silently with no user-visible output.
Call EnterPlanMode immediately after resolving target files. All analysis and
plan creation happen within plan mode to prevent premature edits. Do not read
or analyze files until plan mode is active.
Read references/smell-checklist.md for the full nine-category checklist. Apply each category to every file under review.
For each smell detected, record:
When analyzing multiple files, use Grep to check for duplicated patterns
across files and Glob to find related modules when assessing coupling.
Resolve the project's plans directory:
.claude/settings.json for a plansDirectory keydocs/plans/Write a plan file at <plansDirectory>/simplify-<scope-slug>.md where
<scope-slug> is derived from the target (e.g., simplify-session-manager.md,
simplify-utils-folder.md). The plan file must include:
Structure findings using the Analysis Format below. Include the plan file path so the developer can reference it.
Use AskUserQuestion to ask the developer to review the findings and plan:
I've analyzed the code and created a refactoring plan at
<path>. Here are the key findings: [1-2 sentence summary].
Offer three options:
If the developer requests adjustments, update the plan file and present the revised findings. Loop until the developer approves or discards.
If approved:
ExitPlanMode (ExitPlanMode is deferred — use ToolSearch with select:ExitPlanMode first, then call it; if it returns "You are not in plan mode", treat that as success and continue)Edit and WriteIf discarded:
ExitPlanMode (ExitPlanMode is deferred — use ToolSearch with select:ExitPlanMode first, then call it; if it returns "You are not in plan mode", treat that as success and continue)Structure the analysis output as follows:
Brief overview of the code's purpose and structural quality (1-2 sentences).
[Clean / Minor Issues / Needs Refactoring / Major Refactoring Needed] — One-sentence rationale.
Issues that significantly harm readability, maintainability, or performance. Must be addressed. For each:
Non-critical issues that would improve code structure and maintainability.
Link to the generated plan file with a step summary.
Structural patterns the code does well. Reinforce good practices.
See references/example-analysis.md for a complete sample demonstrating the expected output format.
Grep to find repeated patterns
that may not be obvious within a single filedata-ai
Craft-prompt: interviews users and assembles a structured AI prompt using Anthropic best-practice techniques. Use when the user runs /plan-agent:craft-prompt or asks to craft a prompt.
development
Generates a SOCIAL.md project sharing config by analyzing the codebase. Use when asked to set up social sharing preferences or create a SOCIAL.md file.
development
Explains how any project file, component, or concept works. Reads source files and synthesizes developer-friendly principles, social copy, and a dark-mode card. Use when asked 'how does X work' or 'explain X'.
development
Generate an HTML implementation-plan document. Produces a self-contained .html plan file with steps, acceptance criteria, and metadata. Use when the user asks to create a plan document, generate an HTML plan, or write a plan file — not for general planning questions.