بنقرة واحدة
improve
Plan and improve existing code with quality gates.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Plan and improve existing code with quality gates.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Audit a project against a canon's rules and checklist. Read-only — produces prioritized report without fixing. Works with any canon (nextjs, sql, typescript, etc.).
Lens home base - status, help, and setup
Plan and build a new feature with quality gates.
Simple changes done right. Make the change, clean up after yourself, report what happened.
Review against canons + quality gate, fix findings, verify. Claude-native — no external models.
13-dimension comprehensive code scanner. Read-only — reports CODE_SCAN_INDEX without making changes. Language-agnostic with rubric augmentation via AUTO-DETECT.md.
| name | improve |
| description | Plan and improve existing code with quality gates. |
Plan and improve existing code with quality gates, canon review, and verification.
No arguments? Describe this skill and stop. Do not execute.
/cleanup catchesDon't use for: New features → /build | Simple changes → /change | Review + fix against canons → /cleanup
| Flag | Purpose |
|---|---|
--dry-run | Show the improvement plan without making changes |
--rollback | Restore from last improve stash |
Read ALL files in the target path. Understand:
Check files in scope for technology signals:
| Signal | Canon |
|---|---|
.ts, .tsx, tsconfig.json | typescript, javascript |
.js, .jsx, .mjs | javascript |
.cs, *.csproj | csharp-depth |
.java | java |
angular.json, *.component.ts | angular |
.sql files OR SQL strings in source | database |
.css, .scss, .html with components | ui-ux |
*.test.*, *.spec.* | testing patterns |
.md, README | writing, docs |
Load matching canon SKILL.md files from .claude/canon/. Extract anti-patterns and core principles. These become {CANON_CRITERIA}.
If .claude/rubric/AUTO-DETECT.md exists, load matching rubrics.
Load lessons from .claude/universal-lessons.md and .claude/lessons.md if they exist.
Produce a numbered improvement plan. For each item:
Order by risk: low-risk changes first, high-risk last.
Present the plan to the conversation.
If --dry-run, display the plan and stop. Emit IMPROVE_DRY_RUN.
Before modifying any files:
git stash push -m "improve:$(basename {TARGET}):$(date +%s)"
Report the stash ref.
If --rollback was specified instead:
git stash list | grep "improve:" | head -1
# Extract stash ref and pop it
git stash pop <ref>
Then stop.
Apply improvements in plan order. For each item:
Follow the quality gate rules to pass on the first attempt:
SECURITY (instant fail):
NAMING:
SIZE LIMITS:
CODE QUALITY:
Run the quality gate:
tsx .claude/scripts/quality-gate.ts {TARGET} 2>&1
If the gate script is not at that path:
find . -path "*/.claude/scripts/quality-gate.ts" 2>/dev/null | head -1
Parse violations. If any exist, fix them and rerun. Max 2 retries.
Review ALL changed files against:
{CANON_CRITERIA}.claude/rubric/)Produce findings:
FINDING: {severity} | {category} | {file:line} | {description} | {suggested fix}
Severity levels:
Fix by priority: CRITICAL → HIGH → MEDIUM (if contained) → LOW (if trivial).
Scope constraint: Only modify code directly related to findings. Do not refactor unflagged code.
Complexity budget: Net-zero or net-negative lines/functions/types. Security fixes exempt.
Rerun the gate:
tsx .claude/scripts/quality-gate.ts {TARGET} 2>&1
Must pass. Max 2 retries. If still failing after retries, report remaining violations.
npm run lint 2>&1 || true
npm test 2>&1 || true
If lint errors or test failures were caused by changes, fix them. Do not modify existing tests to match new code unless the test was testing the old (now-improved) behavior.
## /improve Report: {target}
### Plan
{numbered list from Step 3}
### Changes Applied
| # | File | What Changed | Why | Risk |
|---|------|-------------|-----|------|
| 1 | src/foo.ts | Extracted validation | clarity canon | low |
### Gate Results
| Gate | Status |
|------|--------|
| Gate #1 | {pass | N violations → fixed} |
| Gate #2 | {pass | N violations → fixed} |
### Review Findings
| # | Severity | File:Line | What | Canon |
|---|----------|-----------|------|-------|
| 1 | MEDIUM | src/foo.ts:30 | Inlined single-use wrapper | refactoring |
### Verification
- Lint: {pass | N warnings | N errors}
- Tests: {pass | N failures}
### Rollback
Rollback: /improve --rollback
IMPROVE_COMPLETE
| Workflow | When to Use |
|---|---|
/improve | Planned enhancements to existing code — identifies what should change |
/cleanup | Review + fix what exists against canons — reacts to what's wrong |
/build | New feature from description/PRD — creates new files |
/change | One small change, done right |