/skills:improve-skillfrom skills
Iteratively refine and validate agent skill markdown files by implementing them in a sandbox, running validation checks (TypeScript, linting, build, browser tests), writing tests, reflecting on errors, and updating the skill documentation until it produces error-free code. Use this skill when you need to polish a skill, refine a skill, test a skill, improve skill documentation, validate a skill, debug skill instructions, or ensure a skill works end-to-end.
Ships in skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Takes a draft skill markdown file and iteratively implements it in a sandbox/ directory (its own git repo), validates the output, reflects on errors, updates the markdown, reverts, and retries — until the skill produces a clean, error-free implementation on a fresh run.
1. Point at a skill markdown file (e.g., v1-skills/auth/SKILL.md)
2. Sandbox initializes as its own git repo with a project scaffold
3. Loop: implement → validate → reflect → update markdown → revert → retry
4. Final polished skill saved to skills/<feature>/SKILL.md
┌─────────────────────────────────────────────────────────┐
│ SKILL POLISH LOOP │
│ │
│ ┌──────────┐ ┌───────────┐ ┌──────────────────┐ │
│ │ IMPLEMENT │───▶│ VALIDATE │───▶│ ERRORS FOUND? │ │
│ │ in sandbox│ │ tsc/lint/ │ │ │ │
│ └──────────┘ │ build/ │ │ YES ──▶ REFLECT │ │
│ ▲ │ browser │ │ & UPDATE │ │
│ │ └───────────┘ │ MARKDOWN │ │
│ │ │ ▼ │ │
│ │ │ REVERT │ │
│ │ │ SANDBOX │ │
│ └───────────────────────────│─────────┘ │ │
│ │ │ │
│ │ NO ──▶ FINALIZE │ │
│ └──────────────────┘ │
└─────────────────────────────────────────────────────────┘
Sandbox is its own git repo — reverts are instant via git reset.
sandbox/ directory (working area — becomes its own git repo)skills/ directory (output for polished skills)Verify the environment before starting.
# Check sandbox state
ls sandbox/
# If sandbox has a git repo with baseline commit, ask user:
# "Sandbox has baseline. Reuse it or start fresh?"
cd sandbox && git log --oneline -1 2>/dev/null && cd ..
# Verify output directory exists
ls skills/
CRITICAL: The sandbox is its own git repo, completely independent of the parent project. The parent project does NOT need to be a git repository.
User decision:
Agent instructions:
v1-skills/auth/SKILL.md)FEATURE_NAME from frontmatter name: fieldmkdir -p skills/<FEATURE_NAME>
cp <SOURCE_PATH> skills/<FEATURE_NAME>/SKILL.md
IMPORTANT: All markdown edits happen to skills/<FEATURE_NAME>/SKILL.md. Never modify the original.
Skip this phase if reusing existing baseline (user chose "Reuse" in Phase 0).
Agent instructions:
rm -rf sandbox/* sandbox/.* 2>/dev/null
# Example for Next.js:
cd sandbox && bunx create-next-app@latest . --typescript --tailwind --eslint --app --src-dir --no-import-alias --use-bun && cd ..
# Example for Node.js:
cd sandbox && bun init -y && cd ..
cd sandbox && bun run build && cd ..cd sandbox
git init
git add -A
git commit -m "baseline: scaffold for <FEATURE_NAME>"
cd ..
This baseline enables fast reverts without touching the parent project.
Set ITERATION=1 and MAX_ITERATIONS=10.
Read the current working markdown (skills/<FEATURE_NAME>/SKILL.md) and follow it exactly.
Agent instructions:
File mapping: All skill paths are relative to sandbox root:
src/lib/auth.tsx → sandbox/src/lib/auth.tsxRun the automated validation script:
./scripts/validate.sh
This script runs multi-tier validation and outputs structured error JSON. See VALIDATION.md for validation strategies.
Manual validation tiers (if not using script):
Tier 1 — TypeScript (always run):
cd sandbox && bunx tsc --noEmit 2>&1
Tier 2 — Linting (if configured):
cd sandbox && bunx biome check . 2>&1
# OR: bunx eslint . 2>&1
Tier 3 — Build (if build script exists):
cd sandbox && bun run build 2>&1
Tier 4 — Browser (if skill has TEST_PAGE.md):
# Start dev server in background
cd sandbox && bun run dev &
DEV_PID=$!
sleep 3
Use playwright-cli (runs via Bash, no MCP needed) to validate:
playwright-cli open http://localhost:3000/<test-route> → navigate to the test routeplaywright-cli snapshot → verify elements are present in the DOMplaywright-cli console → check for JS errors or warningsplaywright-cli screenshot --output screenshots/<feature>.png → capture visual stateplaywright-cli click <ref> → interact with UI elementskill $DEV_PID
Tier 5 — Test Writing (after Tiers 1-4 pass):
Once the implementation passes Tiers 1-4, write tests for the skill's code:
sandbox/__tests__/unit/): utility functions, lib helpers, validatorssandbox/__tests__/integration/): API routes, database queriessandbox/__tests__/e2e/): UI pages via playwright-clicd sandbox && bun test 2>&1
Test failures feed back into the reflection loop — classify as test-failure errors and update the skill markdown with fixes (missing exports, wrong function signatures, etc.).
Collect errors into structured format:
VALIDATION_ERRORS = [
{ source: "tsc", file: "...", line: N, message: "..." },
...
]
If VALIDATION_ERRORS is empty: → Skip to Phase 4: Finalize
If VALIDATION_ERRORS is not empty and ITERATION < MAX_ITERATIONS: → Continue to Step 3d: Reflect
If ITERATION >= MAX_ITERATIONS: → Stop and report:
"Reached maximum iterations (10). Remaining errors: [list]. Markdown saved but may need manual refinement."
CRITICAL: Analyze each error and determine what the skill markdown should have said to prevent it.
Agent instructions for each error:
Classify the error — see ERROR_CLASSIFICATION.md for types:
missing-dependency — Package not in Installation sectionmissing-file — Imported file not created by skilltype-error — TypeScript type mismatchapi-change — Library API changedmissing-config — Config file or env var missingwrong-path — File path mismatchmissing-step — Undocumented setup stepcode-error — Bug in code snippetDetermine the fix:
Apply the fix to skills/<FEATURE_NAME>/SKILL.md:
Reflection comment (add to markdown):
<!-- POLISH ITERATION {N}
Errors found: {count}
Fixes applied:
- {classification}: {brief description}
-->
Reset sandbox to baseline using its own git repo:
cd sandbox
git checkout -- .
git clean -fd
cd ..
Verify revert:
cd sandbox && git status --porcelain && cd ..
# Should be empty (clean working tree)
ITERATION = ITERATION + 1
→ Go back to Step 3a: Implement
Implementation passed all validation. Markdown is polished.
Agent instructions:
Clean up markdown:
<!-- POLISH ITERATION --> commentsupdated: dateRevert sandbox one final time:
cd sandbox
git checkout -- .
git clean -fd
cd ..
Skill polished successfully!
Feature: <FEATURE_NAME>
Iterations: {ITERATION}
Output: skills/<FEATURE_NAME>/SKILL.md
Changes made during polishing:
- {summary of key fixes}
The skill markdown now produces a clean, error-free implementation.
Sandbox baseline preserved for future runs.
skills/<feature>/SKILL.md (never modifies original)skills/<feature>/SKILL.mdWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
84 skills in this plugin
/add-featureParent skill for feature and project workflows. Use when the user wants to build a project, add a feature, polish a skill, test all skills, or browse the skill catalog. Routes to add-project (build project from idea), improve-skill (refine one skill in a sandbox), test-skills (validate full skill composition), or any child skill by name.
/add-projectEnd-to-end project builder: idea → spec → shell → ralph loop → secrets → report. SMS notification after every phase. Creates a project directory with symlinked skills and a ralph execution loop. Does NOT scaffold Next.js — ralph does that as step 1.1 of the plan. Use when the user says "build project", "build a project", "new project", "create project", "build from idea", "scaffold and notify", "spec a project", "plan a project", or "scaffold project".
/npx claudepluginhub mattwoodco/skills --plugin skills