Continuous Improvement
Audit a codebase, find real improvements, implement the best ones as PRs, self-review, and assess merge safety. This is a journey skill — it orchestrates a full workflow from audit to PR-ready.
Input: "$ARGUMENTS"
Before Starting
- Read the repo's
CLAUDE.md for conventions (commit format, branch naming, style rules)
- Read this skill's
feedback.md if it exists — apply all rules from prior feedback before proceeding
- Check git status — must be on a clean working tree. If there are uncommitted changes, stop and tell the user.
Phase 1: AUDIT
Scan the codebase for improvements. Use the same methodology as the codebase-tasks skill:
Scope: If a path is provided, scan that area. If --focus is set, narrow to that category. Otherwise scan the full repo.
Categories to scan:
| Category |
What to Look For |
| Security |
Empty catch blocks hiding errors, SQL/injection risks, auth gaps, hardcoded secrets, missing input validation at boundaries |
| Performance |
N+1 queries, unnecessary re-renders, missing indexes hinted at by query patterns, synchronous I/O in hot paths |
| Tech debt |
TODOs/FIXMEs older than 3 months, commented-out code, dead exports, duplicated logic, mixed patterns in same directory |
| Dependencies |
Major version bumps available, deprecated packages, unused dependencies |
| Tests |
Skipped tests, missing error path coverage, test files that import modules that no longer exist |
How to scan:
- Use Grep for explicit markers (TODO, FIXME, HACK, skip, xdescribe)
- Use Read on key files to find implicit issues (empty catches, dead code, consistency gaps)
- Use Bash for
git log to find areas that change frequently (fragile code)
- Check package.json / pyproject.toml for dependency issues
Phase 2: PRIORITIZE
Score each finding on two axes:
- Impact (1-5): How much does fixing this improve the codebase?
- Confidence (0-100): How sure are you this is a real issue, not intentional?
Drop anything below 80 confidence. When in doubt, leave it out.
Categorize:
| Tier |
Criteria |
Action |
| Do now |
Quick win: <15 lines, high confidence, clear improvement, no risk |
Implement automatically if --auto-pr |
| Propose |
Real issue but bigger change, needs discussion, or moderate risk |
Present to user for decision |
| Note |
Valid but low urgency, or context-dependent |
List briefly, don't act |
| Skip |
Noise, intentional, or linter territory |
Don't mention |
Present findings as a TLDR:
## Continuous Improvement — [repo name]
**Found:** X items (Y do-now, Z propose, W note)
### Do Now (quick wins)
| # | File:Line | Issue | Fix | Impact |
|---|---|---|---|---|
| 1 | src/api.ts:42 | Empty catch swallows auth error | Add error logging | Reliability |
### Propose (needs discussion)
| # | File:Line | Issue | Why Discuss | Impact |
|---|---|---|---|---|
| 1 | lib/db.ts:80 | N+1 query in user listing | Requires schema understanding | Performance |
### Notes
- [Lower priority items, one line each]
If --dry-run was passed, stop here. Present findings and exit.
Phase 3: IMPLEMENT
For each "do now" item (if --auto-pr is passed, or user approves):
- Branch: Create
fix/<scope>/<description> from the current base branch
- Fix: Apply targeted changes using Edit. Fix the issue, don't refactor the neighborhood.
- Verify:
- If the repo has a type checker configured, run it:
npx tsc --noEmit or equivalent
- If the repo has tests, run relevant ones:
npm test or equivalent
- If verification fails: revert the change, move the item to "propose" tier, note why
- Commit: Follow the repo's CLAUDE.md commit format. One commit per logical fix or group of related fixes.
Group related fixes into one PR when they're in the same area (e.g., 3 empty catches in the same file → one PR). Don't create 15 single-line PRs.
Phase 4: PR + SELF-REVIEW
For each branch with changes:
Create PR: gh pr create --title "..." --body "..." with:
- Clear title following repo conventions
- Body listing what was found and fixed, with file:line references
- Label if the repo uses labels
Self-review (apply the pr-fix methodology):
- Re-read every changed file in full (not just the diff)
- Check: did the fix introduce a new bug? Miss an edge case? Break an import?
- Score each concern 0-100 confidence. Fix anything above 80.
- If self-review finds issues, fix them and push.
Phase 5: MERGE SAFETY
For each PR created, assess merge safety (apply the pr-safety methodology):
- Rate: blast radius, regression potential, data safety, rollback difficulty
- Check for red flags (migrations, API changes, auth changes)
- Add the assessment to the PR description (not as a separate comment)
Phase 6: REPORT
Summarize everything done:
## Continuous Improvement — Complete
### PRs Created
| PR | Title | Risk | Changes |
|---|---|---|---|
| #42 | fix(api): add error logging to auth catch blocks | LOW | 3 files, +12/-3 |
| #43 | fix(deps): update deprecated uuid package | LOW | 1 file, +1/-1 |
### Proposed (needs your input)
| # | Issue | Why It Needs Discussion |
|---|---|---|
| 1 | N+1 query in user listing | Multiple valid approaches, need to pick one |
### Summary
- Scanned: [X] files across [Y] directories
- Found: [A] items total, [B] implemented, [C] proposed, [D] noted
- PRs: [E] created, all LOW/MEDIUM risk
Feedback
After the user responds to the results (approves, rejects, modifies, or gives verbal feedback):
- Record the feedback in this skill's
feedback.md
- Format: date, what the feedback was, how to apply it going forward
- Keep feedback.md under 50 lines — distill old entries into concise rules
Rules
- Read the repo's CLAUDE.md — every repo has its own conventions. Respect them.
- High confidence only — drop findings below 80 confidence. A false positive wastes more time than a missed true positive.
- Minimal fixes — fix the issue, not the file. Don't refactor surrounding code.
- Group, don't spam — related fixes go in one PR. Don't create 15 PRs for 15 one-line changes.
- Verify before pushing — run type checker and tests. If they fail, revert.
- No style nits — skip anything a linter or formatter would catch.
- No speculative improvements — only fix things that are objectively wrong or clearly improvable.
- Clean tree required — don't start if there are uncommitted changes.
- Never force-push, never push to main — always branch, always PR.
1---2name: continuous-improvement3description: Audit a codebase for improvements, implement the best ones as PRs with auto-review and merge safety analysis. Loops in user for approval at key moments.4---56# Continuous Improvement78Audit a codebase, find real improvements, implement the best ones as PRs, self-review, and assess merge safety. This is a journey skill — it orchestrates a full workflow from audit to PR-ready.910**Input:** "$ARGUMENTS"1112## Before Starting13141. Read the repo's `CLAUDE.md` for conventions (commit format, branch naming, style rules)152. Read this skill's `feedback.md` if it exists — apply all rules from prior feedback before proceeding163. Check git status — must be on a clean working tree. If there are uncommitted changes, stop and tell the user.1718## Phase 1: AUDIT1920Scan the codebase for improvements. Use the same methodology as the `codebase-tasks` skill:2122**Scope:** If a path is provided, scan that area. If `--focus` is set, narrow to that category. Otherwise scan the full repo.2324**Categories to scan:**2526| Category | What to Look For |27|---|---|28| **Security** | Empty catch blocks hiding errors, SQL/injection risks, auth gaps, hardcoded secrets, missing input validation at boundaries |29| **Performance** | N+1 queries, unnecessary re-renders, missing indexes hinted at by query patterns, synchronous I/O in hot paths |30| **Tech debt** | TODOs/FIXMEs older than 3 months, commented-out code, dead exports, duplicated logic, mixed patterns in same directory |31| **Dependencies** | Major version bumps available, deprecated packages, unused dependencies |32| **Tests** | Skipped tests, missing error path coverage, test files that import modules that no longer exist |3334**How to scan:**35- Use Grep for explicit markers (TODO, FIXME, HACK, skip, xdescribe)36- Use Read on key files to find implicit issues (empty catches, dead code, consistency gaps)37- Use Bash for `git log` to find areas that change frequently (fragile code)38- Check package.json / pyproject.toml for dependency issues3940## Phase 2: PRIORITIZE4142Score each finding on two axes:43- **Impact** (1-5): How much does fixing this improve the codebase?44- **Confidence** (0-100): How sure are you this is a real issue, not intentional?4546**Drop anything below 80 confidence.** When in doubt, leave it out.4748Categorize:4950| Tier | Criteria | Action |51|---|---|---|52| **Do now** | Quick win: <15 lines, high confidence, clear improvement, no risk | Implement automatically if `--auto-pr` |53| **Propose** | Real issue but bigger change, needs discussion, or moderate risk | Present to user for decision |54| **Note** | Valid but low urgency, or context-dependent | List briefly, don't act |55| **Skip** | Noise, intentional, or linter territory | Don't mention |5657**Present findings as a TLDR:**5859```60## Continuous Improvement — [repo name]6162**Found:** X items (Y do-now, Z propose, W note)6364### Do Now (quick wins)65| # | File:Line | Issue | Fix | Impact |66|---|---|---|---|---|67| 1 | src/api.ts:42 | Empty catch swallows auth error | Add error logging | Reliability |6869### Propose (needs discussion)70| # | File:Line | Issue | Why Discuss | Impact |71|---|---|---|---|---|72| 1 | lib/db.ts:80 | N+1 query in user listing | Requires schema understanding | Performance |7374### Notes75- [Lower priority items, one line each]76```7778**If `--dry-run` was passed, stop here.** Present findings and exit.7980## Phase 3: IMPLEMENT8182For each "do now" item (if `--auto-pr` is passed, or user approves):83841. **Branch:** Create `fix/<scope>/<description>` from the current base branch852. **Fix:** Apply targeted changes using Edit. Fix the issue, don't refactor the neighborhood.863. **Verify:**87 - If the repo has a type checker configured, run it: `npx tsc --noEmit` or equivalent88 - If the repo has tests, run relevant ones: `npm test` or equivalent89 - If verification fails: revert the change, move the item to "propose" tier, note why904. **Commit:** Follow the repo's CLAUDE.md commit format. One commit per logical fix or group of related fixes.9192**Group related fixes into one PR when they're in the same area** (e.g., 3 empty catches in the same file → one PR). Don't create 15 single-line PRs.9394## Phase 4: PR + SELF-REVIEW9596For each branch with changes:97981. **Create PR:** `gh pr create --title "..." --body "..."` with:99 - Clear title following repo conventions100 - Body listing what was found and fixed, with file:line references101 - Label if the repo uses labels1021032. **Self-review** (apply the `pr-fix` methodology):104 - Re-read every changed file in full (not just the diff)105 - Check: did the fix introduce a new bug? Miss an edge case? Break an import?106 - Score each concern 0-100 confidence. Fix anything above 80.107 - If self-review finds issues, fix them and push.108109## Phase 5: MERGE SAFETY110111For each PR created, assess merge safety (apply the `pr-safety` methodology):112113- Rate: blast radius, regression potential, data safety, rollback difficulty114- Check for red flags (migrations, API changes, auth changes)115- Add the assessment to the PR description (not as a separate comment)116117## Phase 6: REPORT118119Summarize everything done:120121```122## Continuous Improvement — Complete123124### PRs Created125| PR | Title | Risk | Changes |126|---|---|---|---|127| #42 | fix(api): add error logging to auth catch blocks | LOW | 3 files, +12/-3 |128| #43 | fix(deps): update deprecated uuid package | LOW | 1 file, +1/-1 |129130### Proposed (needs your input)131| # | Issue | Why It Needs Discussion |132|---|---|---|133| 1 | N+1 query in user listing | Multiple valid approaches, need to pick one |134135### Summary136- Scanned: [X] files across [Y] directories137- Found: [A] items total, [B] implemented, [C] proposed, [D] noted138- PRs: [E] created, all LOW/MEDIUM risk139```140141## Feedback142143After the user responds to the results (approves, rejects, modifies, or gives verbal feedback):144- Record the feedback in this skill's `feedback.md`145- Format: date, what the feedback was, how to apply it going forward146- Keep feedback.md under 50 lines — distill old entries into concise rules147148## Rules149150- **Read the repo's CLAUDE.md** — every repo has its own conventions. Respect them.151- **High confidence only** — drop findings below 80 confidence. A false positive wastes more time than a missed true positive.152- **Minimal fixes** — fix the issue, not the file. Don't refactor surrounding code.153- **Group, don't spam** — related fixes go in one PR. Don't create 15 PRs for 15 one-line changes.154- **Verify before pushing** — run type checker and tests. If they fail, revert.155- **No style nits** — skip anything a linter or formatter would catch.156- **No speculative improvements** — only fix things that are objectively wrong or clearly improvable.157- **Clean tree required** — don't start if there are uncommitted changes.158- **Never force-push, never push to main** — always branch, always PR.