pattern-detect — скилл для Claude Code: что делает и как установить
Скилл анализирует сессии агентов через API Agent Monitor. Он находит повторяющиеся цепочки вызовов, частые ошибки и привычки распределения задач.
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill pattern-detect -a claude-codeЧто делает pattern-detect
Инструмент запрашивает данные у бэкенда Agent Monitor через эндпоинты /api/sessions и /api/workflows/{sessionId}. Скилл строит матрицу переходов между инструментами. Он сразу выявляет повторные вызовы одних и тех же утилит при сбоях.
Аналитика охватывает пять категорий: цепочки утилит, сценарии сессий, каскады ошибок, связки субагентов и временные пики. На выходе формируется отчёт из десяти главных паттернов. Каждый пункт получает оценку влияния и совет по устранению антипаттерна.
Без работающего сервиса Agent Monitor скилл бесполезен. Все расчёты он забирает из готовых ответов его API. Вызов можно сузить до конкретной темы или задать число последних сессий через аргументы.
Какие задачи решает
- выявить антипаттерны и зацикливания при вызовах инструментов
- найти уровни вложенности агентов, где чаще всего возникают ошибки
- оценить привычки делегирования задач между моделями и субагентами
- обнаружить триггеры сжатия контекста в длинных сессиях
Примеры запросов агенту
- Запусти pattern-detect tools для последних 20 сессий
- Проверь каскады сбоев: pattern-detect errors
- Собери полный отчёт по паттернам через pattern-detect all
Как установить pattern-detect
1Через Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill pattern-detect -a claude-code2Вручную: положить файлы
~/.claude/skills/pattern-detect/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/pattern-detect/
1Через Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill pattern-detect -a codex2Вручную: положить файлы
.agents/skills/pattern-detect/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill pattern-detect -a cursor2Вручную: положить файлы
.cursor/skills/pattern-detect/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install hoangsonww/Claude-Code-Agent-Monitor pattern-detect2Вручную: положить файлы
.github/skills/pattern-detect/SKILL.md1Через Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill pattern-detect -a gemini-cli2Командой платформы
gemini skills install https://github.com/hoangsonww/Claude-Code-Agent-Monitor --path plugins/ccam-insights/skills/pattern-detectВручную: положить файлы
.devin/skills/pattern-detect/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill pattern-detect -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о pattern-detect
Как установить pattern-detect в Claude Code?
Выполните в терминале команду npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill pattern-detect -a claude-code. Она добавит скилл в рабочее окружение.
Что делает pattern-detect?
Он запрашивает метрики Agent Monitor и формирует сводку из десяти частых паттернов. Скилл оценивает переходы инструментов, цепочки сбоев и причины переполнения контекста.
Что нужно запустить перед использованием скилла?
Требуется работающий локальный сервис Agent Monitor с доступными эндпоинтами /api/sessions, /api/analytics и /api/workflows/{sessionId}. Без этого API скилл не сможет получить данные сессий.
Исходный текст
SKILL.md · MIT
---
name: pattern-detect
description: >
Detect recurring patterns using the Agent Monitor's workflow intelligence —
toolFlow transitions (tool A → B frequency matrices), recurring workflow
patterns, agent co-occurrence pairs, model delegation habits, error
propagation paths by agent depth, and compaction triggers. Use to discover
habitual usage patterns and anti-patterns.
---
# Pattern Detect
Identify recurring patterns using the Agent Monitor's workflow intelligence engine.
## Input
The user provides: **$ARGUMENTS**
Options: "all", "tools", "errors", "workflows", "last N sessions".
## Data Sources
| Endpoint | Returns |
|----------|---------|
| `GET /api/sessions?limit=200` | Session list with status, model, cwd, metadata |
| `GET /api/analytics` | tool_usage top 20, event_types, agent_types |
| `GET /api/workflows/{sessionId}` | 11 datasets per session (see below) |
### Workflow datasets used for pattern detection
| Dataset | Pattern insight |
|---------|----------------|
| `toolFlow` | **Tool transition matrix**: tool A → tool B with counts — reveals sequential habits |
| `patterns` | **Detected workflow patterns**: recurring sequences with frequency scores |
| `cooccurrence` | **Agent co-occurrence**: which agents frequently run together |
| `modelDelegation` | **Model habits**: which models are chosen for which task types |
| `errorPropagation` | **Error patterns**: where errors start and how they cascade by agent depth |
| `effectiveness` | **Subagent patterns**: which types succeed most, avg duration per type |
| `compaction` | **Compaction triggers**: what causes context overflow |
| `complexity` | **Complexity patterns**: session complexity scores over time |
## Pattern Categories
### 1. Tool Chain Patterns (from `toolFlow`)
- **Most common sequences**: Top 10 tool transitions (e.g., Read → Edit: 145 times)
- **Starter tools**: First tool used in sessions (indicates task type)
- **Finisher tools**: Last tool before Stop event
- **Anti-patterns**: Tool → same Tool repeated (retries/failures)
- **Co-occurrence**: Tools that always appear together in sessions
### 2. Workflow Patterns (from `patterns`)
- **Named patterns**: Workflow sequences the API has detected with frequency
- **Session archetypes**: Common session shapes (short edit, long debug, subagent-heavy)
- **Project-specific**: Patterns that appear in specific working directories
### 3. Error Patterns (from `errorPropagation` + `event_types`)
- **Error origins**: Which agent depth level produces most errors
- **Cascade patterns**: Errors that trigger chains of follow-up errors
- **APIError frequency**: quota hits, rate_limit, overloaded — by time of day
- **Recovery patterns**: How errors are typically resolved (tool retry vs agent switch)
### 4. Agent Patterns (from `cooccurrence` + `effectiveness`)
- **Agent pairs**: Which agents are spawned together frequently
- **Delegation patterns**: Main agent → subagent task delegation habits
- **Success by type**: Which subagent types (task/explore/code-review) work best for which tasks
### 5. Temporal Patterns (from session timestamps + `daily_sessions`)
- **Peak hours**: When sessions cluster
- **Duration patterns**: Short vs long session distribution
- **Day-of-week trends**: Productive days vs quiet days
## Output
**Pattern Report** with top 10 patterns ranked by frequency × impact:
- Pattern name and description
- Frequency (occurrences across analyzed sessions)
- Impact: positive (reinforce), negative (eliminate), or neutral (observe)
- Actionable recommendation for each
© hoangsonww · MIT · hoangsonww/Claude-Code-Agent-Monitor