/improve banner
anipotts anipotts

/improve

Data community intermediate

Description

looks at your recent git history, session data, and current CLAUDE.md to figure out what instructions are missing, outdated, or wrong. proposes a diff -- never auto-commits. credit: Boris Cherny tip #

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

Repository README

This is the README for anipotts/claude-code-tips, shared by 6 entries in this directory. It describes the repository, not this entry specifically.


name: improve description: improve CLAUDE.md from git history allowed-tools:

  • Bash
  • Read
  • Glob
  • Grep

/improve

looks at your recent git history, session data, and current CLAUDE.md to figure out what instructions are missing, outdated, or wrong. proposes a diff -- never auto-commits.

credit: Boris Cherny tip #2 (self-improvement loops).

what it does

  1. reads git log for the last N commits (default 20)
  2. identifies patterns -- what got reverted, what got fixed immediately after, what caused loops
  3. reads your CLAUDE.md and checks if it covers the patterns it found
  4. cross-references mine.db session data if available (error patterns, wasted sessions)
  5. proposes additions, removals, and edits to CLAUDE.md
  6. presents the diff for your approval -- never auto-commits

how to use it

analyze the last 20 commits (default):

/improve

analyze more history:

/improve last 200 commits

focus on a specific area:

/improve focus on testing patterns

the prompt

When the user runs /improve, analyze recent project history and propose improvements to CLAUDE.md (or create one if it doesn't exist).

## Phase 1: Gather evidence

1. Read the current CLAUDE.md (or note that it doesn't exist):
   ```bash
   cat CLAUDE.md 2>/dev/null || echo "NO CLAUDE.md FOUND"
   ```

2. Read recent git history (default 20 commits, or whatever the user specified):
   ```bash
   git log --oneline -20
   ```

3. Find reverts and immediate fix-ups -- these reveal instructions Claude keeps getting wrong:
   ```bash
   git log --oneline -200 | grep -iE 'revert|fix|undo|oops|wrong|broken'
   ```

4. Find commit pairs where a fix came within 5 minutes of a change (rapid fire-fix cycles):
   ```bash
   git log --format='%H %ai %s' -100
   ```

5. Check for patterns in commit messages -- repeated phrases suggest repeated issues:
   ```bash
   git log --oneline -200 | sed 's/^[a-f0-9]* //' | sort | uniq -c | sort -rn | head -20
   ```

6. Check for conversation patterns -- what does the user keep telling Claude?
   Look at recent git diffs for signs of repeated corrections:
   ```bash
   git log --all --oneline -50 | grep -iE 'style|format|convention|pattern|always|never|dont|do not'
   ```

7. If ~/.claude/mine.db exists, check for error patterns:
   ```bash
   sqlite3 -header -column ~/.claude/mine.db "
     SELECT tool_name, error_message, COUNT(*) as occurrences
     FROM errors
     WHERE session_id IN (
       SELECT id FROM sessions
       WHERE project_dir LIKE '%$(basename $PWD)%'
       AND start_time >= date('now', '-14 days')
     )
     GROUP BY tool_name, error_message
     ORDER BY occurrences DESC
     LIMIT 10;
   " 2>/dev/null
   ```

8. Check for wasted sessions (high tokens + many errors):
   ```bash
   sqlite3 -header -column ~/.claude/mine.db "
     SELECT s.first_user_prompt,
            s.total_input_tokens + s.total_output_tokens AS tokens,
            (SELECT COUNT(*) FROM errors e WHERE e.sessi