# Analyze Patterns

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

- **Type:** Skill
- **Install:** `agentstack add skill-denenis-lab-my-claude-skills-analyze-patterns`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [denenis-lab](https://agentstack.voostack.com/s/denenis-lab)
- **Installs:** 0
- **Category:** [Developer Tools](https://agentstack.voostack.com/c/developer-tools)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [denenis-lab](https://github.com/denenis-lab)
- **Source:** https://github.com/denenis-lab/my-claude-skills/tree/main/analyze-patterns

## Install

```sh
agentstack add skill-denenis-lab-my-claude-skills-analyze-patterns
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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:

```bash
# 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:
```json
{
  "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:

```bash
gh issue create \
  --repo / \
  --title "Pattern: " \
  --label "pattern" \
  --body "$(cat 

**Priority:** 
**Projects:** 

## Evidence

- "quote 1"
- "quote 2"

## Suggested Action

---
_Generated by /analyze-patterns on _
EOF
)"
```

Before creating, check for duplicates:
```bash
gh issue list --repo / --label pattern --state all --json title -q ".[].title"
```

## Step 5: Update state

After a successful analysis:
```bash
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

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [denenis-lab](https://github.com/denenis-lab)
- **Source:** [denenis-lab/my-claude-skills](https://github.com/denenis-lab/my-claude-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-denenis-lab-my-claude-skills-analyze-patterns
- Seller: https://agentstack.voostack.com/s/denenis-lab
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
