/cstk:apply-insights [area especifica: bugfix | migrations | conventions | hooks | all]from cstk
Applies Claude Code usage insights to improve CLAUDE.md, hooks, and workflows. Consumes native /insights output to surface friction patterns and recommend project-specific fixes.
Ships in cstk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Analyze the current project and apply relevant insights from usage patterns to improve Claude Code effectiveness.
$ARGUMENTS should optionally specify a focus area:
There are TWO possible sources. Prefer the facets digest — it reflects the
user's ACTUAL recent sessions (current, structured, project-specific), whereas
the curated .md is hand-written and often stale / from a different project.
/insights output)The native /insights command writes per-session analyses to
~/.claude/usage-data/facets/*.json (fields: goal_categories, outcome,
friction_counts, friction_detail, claude_helpfulness,
user_satisfaction_counts, …). Aggregate them into a digest:
# Resolve the skill dir: installed copy first, repo source when developing.
DIGEST="$HOME/.claude/skills/apply-insights/scripts/digest-facets.sh"
[ -x "$DIGEST" ] || DIGEST="$(git rev-parse --show-toplevel 2>/dev/null)/plugins/cstk/skills/apply-insights/scripts/digest-facets.sh"
"$DIGEST" # markdown digest on stdout; optional: --top N --samples N
If it prints a digest (non-empty stdout), use it as the primary, data-driven
input. The ranked friction_counts + concrete friction_detail samples are
the key signal for recommendations (which friction recurs, with examples).
digest-facets.sh exits 0 with empty stdout when jq or the facets dir are
absent — so branch on emptiness:
~/.claude/insights/usage-insights.md (curated; may be stale) — and
say so to the user.When both exist, prefer the digest (current data); you may cross-check the
curated .md for narrative context. Tell the user WHICH source you used.
CLAUDE.md (if exists) to understand current state.claude/settings.json or .claude/settings.local.json for existing hooks.claude/skills/go.mod, internal/, cmd/package.json, tsconfig.json, build config (vite/webpack/next)requirements.txt, pyproject.toml, setup.pyCargo.toml, src/main.rspom.xml, build.gradle, build.gradle.kts*.csproj, *.sln.gitmodules, pnpm-workspace.yaml, lerna.json, or multiple service dirsMakefile, package.json scripts, README, or CI config)Compare what the project already has vs. what the insights recommend:
Check if the project's CLAUDE.md includes:
Check if .claude/settings.json or .claude/settings.local.json has hooks for
the project's stack. Common patterns (suggest only ones relevant to the detected stack):
Check if the project has relevant skills in .claude/skills/ or referenced via
global skills. Suggest gaps based on the project's workflow — not a fixed list:
/bugfix — structured multi-layer bug fix protocolDo not recommend skills by fixed name. Look at the project's actual workflow
and propose skills that would remove friction the insights data documents
(ranked friction_counts + friction_detail samples in the facets digest).
Check if ~/.claude/projects/*/memory/ has relevant memories:
Based on the gap analysis, generate a prioritized list:
For each missing section, propose the exact text to add, adapted to the project's specific stack and structure. Do NOT add generic text — tailor it:
For each missing hook, propose the exact JSON to add to settings.json. Only suggest hooks relevant to the project's actual stack. Examples:
Based on the project's characteristics, suggest:
For each recommendation:
# Insights Analysis: {project-name}
## Current State
- Project type: {type}
- CLAUDE.md: {exists/missing}
- Hooks: {count} configured
- Skills: {count} available
## Recommendations
### CLAUDE.md ({N} additions suggested)
1. **{section name}** — {why it's relevant}
> {proposed text preview}
### Hooks ({N} suggestions)
1. **{hook name}** — {what it does}
> {JSON preview}
### Workflows ({N} patterns)
1. **{pattern name}** — {when to use}
## Apply?
Reply with the numbers you want to apply, or "all" to apply everything.
Every suggestion must be tailored to the current project: real service names, real build commands, real language conventions. Generic boilerplate ("Add a bug fix section to CLAUDE.md") produces noise, not value.
Don't apply changes directly. Show the proposed diff, wait for "apply 1,2,4" or "all", and only then edit files. Auto-applying destroys trust in the skill.
Duplicating existing CLAUDE.md sections or re-adding hooks the project has is ruido. Read the current state first, diff against insights, propose only the delta.
Not every project needs recommendations. A project with comprehensive CLAUDE.md, relevant hooks, and appropriate skills should hear "your setup looks solid — nothing to add" instead of forced suggestions. Honesty > output volume.
Prefer scripts/digest-facets.sh (aggregates the native /insights facets —
current and project-specific). Only when its stdout is empty (no jq, no facets
dir) fall back to the curated ~/.claude/insights/usage-insights.md; when that
too is missing, use general best practices but label them clearly as generic /
not data-driven. Don't pretend insights exist when they don't, and don't lean
on a stale curated .md when fresh facets are available — that was the original
bug (April-era summary applied to a different stack).
Do not assume every project needs /bugfix, /review-pr, etc. Look at the insights data (the facets digest's friction_counts / friction_detail, or the curated file): which tasks keep getting re-explained? Which workflows have friction logged? THOSE are the skill candidates — not a checklist copied from another project.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub jotjunior/cstk --plugin cstk24 skills in this plugin
/advisorStrategic critique of an idea/plan/decision. Triggers: "me aconselhe", "critique meu plano", "avalie minha ideia", "feedback estrategico", "advisor". Skip for technical tasks (use bugfix/execute-task)./agente-00c-runtimeInternal POSIX runtime helpers for agente-00c/feature-00c orchestrators (state, lock, validation, hashes, secrets filter). NOT user-invocable./analyzeCross-artifact SDD consistency analysis (spec/plan/tasks/constitution) — read-only. Triggers: "analyze", "cross-check", "auditar artefatos", "validar spec vs tasks". Skip for single-document validation (use validate-documentation)./briefingStructured project discovery interview (vision, users, constraints, stack). Triggers: "briefing", "discovery", "iniciar projeto", "kickoff". Skip if briefing already complete and user did not ask for update./bugfixMulti-layer bug investigation and fix (traces across services before patching). Triggers: "bugfix", "fix bug", "corrigir bug", "debug", "investigar bug". Skip for new feature work (use execute-task/specify)./checklistRequirements quality gate ("unit tests for English") by domain (ux/api/security/performance/a11y). Triggers: "checklist", "validar requisitos", "quality gate". Validates REQUIREMENT quality, not code.Other plugins' skills for the same job