agentleFS
denenis-labdenenis-lab/my-claude-skills/analyze-patterns/SKILL.md

analyze-patterns

Skill2 starsChanged 5 months agoMITView on GitHub

Analyze Claude Code session transcripts for repeating behavioral patterns and create GitHub Issues with suggestions

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. agent-0x/claude-recall★ 4same name
    2. garavitgabriel/clay-backend-plugin★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When the user invokes /analyze-patterns or says "analyze sessions" / "find patterns":

    line 9
  2. Distinctive:

    Run the extractor script, save to a temp file:

    line 13
  3. Very specific:

    Use --full if the user says "all sessions" / "full" / "--full".

    line 23
  4. Very specific:

    Default is incremental. The --user-only flag extracts only user messages (smaller output).

    line 24
  5. Very specific:

    Read /tmp/pattern-extract.json — it contains JSON with this structure:

    line 26
  6. Distinctive:

    Read the script output and find 4 types of patterns:

    line 44
  7. Distinctive:

    Ask the user: "Create GitHub Issues for these patterns?"

    line 75
  8. Distinctive:

    Before creating, check for duplicates:

    line 107
  9. Distinctive:

    After a successful analysis:

    line 115
  10. Very specific:

    No new sessions → "No new sessions since last analysis.

    line 124

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Analyze Patterns

When the user invokes /analyze-patterns or says "analyze sessions" / "find patterns":

Step 1: Extract messages from sessions

Run the extractor script, save to a temp file:

# Incremental (only new sessions since last run):
python3 ~/.claude/skills/analyze-patterns/scripts/pattern-detector.py --user-only --stats > /tmp/pattern-extract.json

# Or full rescan (all sessions):
python3 ~/.claude/skills/analyze-patterns/scripts/pattern-detector.py --full --user-only --stats > /tmp/pattern-extract.json

Use --full if the user says "all sessions" / "full" / "--full". Default is incremental. The --user-only flag extracts only user messages (smaller output).

Read /tmp/pattern-extract.json — it contains JSON with this structure:

{
  "session_count": 124,
  "projects": {
    "ProjectName": {
      "message_count": 25,
      "user_count": 25,
      "messages": [{"role": "user", "text": "..."}]
    }
  }
}

IMPORTANT: The file can be large (~400-500 KB). Read project by project, analyzing the largest ones first.

Step 2: Analyze patterns

Read the script output and find 4 types of patterns:

1. REPEATED_CORRECTION

User corrects Claude the same way in 2+ different sessions. Examples: "write shorter", "don't ask for confirmation", "use bun". → Suggestion: add to CLAUDE.md or create a rule file

2. FREQUENT_TOOL

The same workflow/skill/tool is used frequently. Examples: constantly calls /browser, always runs the same test command. → Suggestion: create an auto-trigger or shortcut

3. ABANDONED_TASK

Work started but not finished, errors left unfixed. Examples: config change started — session ended, bug found — not fixed. → Suggestion: create an issue to complete the work

4. CLAUDE_RESISTANCE

Claude didn't understand or the user had to explain again. Examples: Claude asks permission when told not to, writes in the wrong language. → Suggestion: improve the prompt/rule

Step 3: Show results to the user

For each pattern found, show:

  • Type (REPEATED_CORRECTION / FREQUENT_TOOL / ABANDONED_TASK / CLAUDE_RESISTANCE)
  • Short title
  • Evidence quotes from user messages
  • Specific action suggestion
  • Priority (high / medium / low)

Ask the user: "Create GitHub Issues for these patterns?"

Step 4: Create GitHub Issues (after confirmation)

For each confirmed pattern:

gh issue create \
  --repo <OWNER>/<REPO> \
  --title "Pattern: <title>" \
  --label "pattern" \
  --body "$(cat <<'EOF'
## Type: <TYPE>

**Priority:** <priority>
**Projects:** <projects, comma-separated>

## Evidence

- "quote 1"
- "quote 2"

## Suggested Action

<specific suggestion>

---
_Generated by /analyze-patterns on <date>_
EOF
)"

Before creating, check for duplicates:

gh issue list --repo <OWNER>/<REPO> --label pattern --state all --json title -q ".[].title"

Step 5: Update state

After a successful analysis:

python3 ~/.claude/skills/analyze-patterns/scripts/pattern-detector.py --full --update-state --stats > /dev/null

This marks all sessions as analyzed. The next incremental run will only pick up new ones.

Error handling

  • No new sessions → "No new sessions since last analysis. Use --full for a full rescan."
  • Empty script output → check that ~/.claude/projects/ exists and contains .jsonl files

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.