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.
ExitPlanMode is a deferred tool. Only call it if currently in plan mode — skip this step entirely when not in plan mode. When calling: use ToolSearch with select:ExitPlanMode first, then call ExitPlanMode silently.
If approved:
ExitPlanMode (conditional — see above)Edit and WriteIf discarded:
ExitPlanMode (conditional — see above)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 filedevelopment
Checks whether the branch's PR is ready and merges it when green. Runs the readiness gate, lint, and an approval prompt. Use when the user asks "merge?" or if a PR is ready to merge.
development
Implements a plan file that already exists. Walks its steps, ticks the spec, re-renders, and runs the completion gates. Use when asked to implement an existing plan.
development
Audits and optimizes CLAUDE.md project memory files. Checks adherence to Claude Code best practices and produces actionable fixes. Use when the user asks to audit, optimize, or diagnose a CLAUDE.md.
development
Converts an HTML artifact or Markdown file into a draft post for a static site. Scopes CSS to keep interactive blocks alive and escapes prose for MDX. Use when asked to turn an artifact into a post.