Parse a Claude Code Insights report and generate or improve skills, agents, hooks, and CLAUDE.md rules based on actual usage patterns. Use when the user wants to turn their insights report into actionable automations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/insights-to-automations:runThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Turn a Claude Code Insights report into concrete, installable automations — skills, agents, hooks, and CLAUDE.md rules — based on the user's actual behavioral patterns.
Turn a Claude Code Insights report into concrete, installable automations — skills, agents, hooks, and CLAUDE.md rules — based on the user's actual behavioral patterns.
The insights report path. Defaults to ~/.claude/usage-data/report.html if not specified via $ARGUMENTS.
Edit over create. Before generating anything new, check what already exists in .claude/skills/, .claude/agents/, and .claude/settings.json. If a relevant automation already exists, improve it based on the insights rather than creating a duplicate.
First, check if the report file exists at the specified path (or the default ~/.claude/usage-data/report.html). If it doesn't exist:
/insights first to generate one, then re-run /i2a:run."If the report exists, it will be large (typically 500+ lines of HTML). Do not try to read it all at once or re-read it multiple times. Instead, read it in sequential chunks (e.g., 200 lines at a time using offset/limit) and extract data as you go. Read each chunk exactly once — do not re-read lines you've already seen.
Extract structured data from these sections as you encounter them. The table below lists known landmarks as hints, not hard requirements — the report format may evolve. Use landmarks when present, but fall back to heading text, section structure, or content semantics to identify sections. If a section can't be found at all, skip it gracefully and work with what you have.
| Section | Likely Landmarks (hints) | What to Extract |
|---|---|---|
| Project areas | id="section-work", .project-area | Area names, session counts, descriptions |
| Usage stats | .stats-row, .chart-card | Languages, tools, session types, task types |
| Friction points | id="section-friction", .friction-category | Friction titles, descriptions, examples |
| Wins | id="section-wins", .big-win | What's working well (don't break these) |
| Suggested features | id="section-features", .feature-card | Already-identified automation opportunities |
| CLAUDE.md suggestions | .claude-md-section, .claude-md-item | Suggested rules with rationale |
| New patterns | id="section-patterns", .pattern-card | Workflow patterns with example prompts |
| Horizon ideas | id="section-horizon", .horizon-card | Ambitious future workflows |
| At a glance | .at-a-glance | Summary of what's working, what's hindering, quick wins |
The minimum viable parse is friction points and suggested features — those two sections carry the most actionable signal. If you can only find those, that's enough to proceed.
Read these specific paths to inventory what exists. Do not glob or search broadly — check exactly these locations:
~/.claude/skills/ and read each SKILL.md found one level down (e.g., ~/.claude/skills/*/SKILL.md)~/.claude/agents/ and read each .md file found (e.g., ~/.claude/agents/*.md)~/.claude/settings.json — look at the hooks key for existing hooks~/.claude/CLAUDE.md if it exists./CLAUDE.md in the current working directory if it exists./.claude/settings.json, ./.claude/CLAUDE.md in the current working directory if they exist
If any path doesn't exist, skip it — don't error or search for alternatives.Do not check for CLI tools in this phase. Only check for a specific CLI tool (e.g., which gh) later in Phase 3, at the point where you're about to recommend an MCP server that it would overlap with. Don't speculatively scan for tools upfront.
If Phase 1 produced no actionable patterns (no friction points, no recurring tasks, no suggested features), tell the user: "Your report doesn't surface patterns that would benefit from automation right now. This usually means things are working well as-is. Run /i2a:run again after your next batch of sessions." Then stop — do not proceed to Phase 4 or 5.
Otherwise, for each actionable pattern, decide the automation type and whether to create or edit.
| Signal from Report | Automation Type | Confidence |
|---|---|---|
| Recurring task type with 3+ sessions (e.g., "doc consistency sweeps") | Skill | High |
| Friction: "excessive changes" or "misunderstood scope" | CLAUDE.md rule | High |
| Friction: "wrong approach" on specific task type | Skill with guardrails | Medium |
| Suggested feature: hooks | Hook in settings.json | High |
| Suggested feature: MCP server | MCP recommendation (don't install) | Medium |
| Horizon: parallel agent workflow | Agent template | Medium |
| Horizon: autonomous iteration | Skill with agent delegation | Medium |
| Language/tool with high edit count but no lint hook | Hook | High |
All tiers require user approval before writing any files. Never auto-install. Present the full contents, get explicit confirmation, then write.
Before writing any file:
Present results in two steps: overview first, then one-by-one walkthrough.
Show a numbered summary table of all proposed automations across all confidence tiers:
| # | Type | Name | Confidence | One-line why |
|---|------|------|------------|--------------|
| 1 | CLAUDE.md | Scope rules | High | Friction: excessive changes (16 instances) |
| 2 | Skill | /scoped-rename | High | 14 doc sessions with recurring rename work |
| 3 | Hook | TS type-check | Medium | TS compilation errors caught late |
| ... | ... | ... | ... | ... |
After the table, ask the user: "Want to walk through these one by one, or skip any upfront?"
The user may:
For each non-skipped automation, present its full details and wait for approval before moving to the next:
High confidence items — show:
Medium confidence items — show:
Low confidence items — show:
After each item, ask: "Install this? (yes / no / modify)"
Only move to the next item after the current one is resolved.
Prefix all generated automation names with i2a- (insights-to-automations) so they're easily distinguishable from hand-built ones:
i2a-scoped-rename, i2a-reviewi2a-doc-checker## i2a: Scope RulesThis makes it easy to list, find, or clean up generated automations later. If the user removes the prefix when approving, that's fine.
Use the templates in this skill's directory as the starting structure for each automation type. Fill in the {placeholders} with values derived from the insights report.
Read templates lazily — only read a template file when you're about to generate that specific automation type. If the report only produces CLAUDE.md rules and a hook, don't read the skill or agent templates at all.
Also reference references/automation-schemas.md for full schema details (frontmatter fields, event types, exit codes, dynamic context injection, etc.). Only read this file if you need to look up a specific schema detail — don't read it preemptively.
/scoped-rename beats a /doc-rename.gh for GitHub).Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub maryamzi/claude-plugins --plugin insights-to-automations