Borda/AI-Rig/plugins/cc_foundry/skills/distill/SKILL.md
distill
One-time snapshot extracting patterns from work history and accumulated lessons, distills into concrete improvements — new agent/skill suggestions, memory pruning, consolidating lessons into rules/agent updates, or performing bin/ extraction from /audit --efficiency candidates. Roster boundary analysis → /foundry:audit agents (Check 34).
- Source repository stars
- 25
- Declared platforms
- 0
- Static risk flags
- 1
- Last source update
- 2026-08-24
- Source checked
- 2026-08-28
Decision brief
What it does: where it fits
One-time snapshot extracting patterns from work history and accumulated lessons, distills into concrete improvements — new agent/skill suggestions, memory pruning, consolidating lessons into rules/agent updates, or performing bin/ extraction from /audit --efficiency candidates. Roster boundary analysis → /foundry:audit agents (Check 34).
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/Borda/AI-Rig --skill "plugins/cc_foundry/skills/distill"Inspect the Agent Skill "distill" from https://github.com/Borda/AI-Rig/blob/1bb724c28af29d9037a9ad192551e9c7f83b65bf/plugins/cc_foundry/skills/distill/SKILL.md at commit 1bb724c28af29d9037a9ad192551e9c7f83b65bf. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
Step 1: Inventory existing agents and skills
Use Glob tool to enumerate agents and skills across all sources — project-local AND plugin-namespaced — to avoid false-gap findings when candidate already exists in plugin:
Project-local: pattern agents/.md, path .claude/; pattern skills//SKILL.md, path .claude/Plugin source (workspace): pattern /agents/.md, path plugins/; pattern /skills//SKILL.md, path plugins/Installed plugin cache (if accessible): resolve cache root — PLUGINCACHE="${CLAUDEPLUGINROOT:-plugins/ccfoundry}" — then use Glob tool on $PLUGINCACHE for pattern /agents/.md and /skills//SKILL.md - 02
Step 2: Analyze work patterns
Mode-token normalization — all mode dispatches below compare against the first whitespace-delimited token of the stripped ARGUMENTS (after --eager removal). Use this single rule consistently; do not rely on exact equality of the full $ARGUMENTS string, since trailing flags/space…
Mode-token normalization — all mode dispatches below compare against the first whitespace-delimited token of the stripped ARGUMENTS (after --eager removal). Use this single rule consistently; do not rely on exact equali…If first token equals executables (i.e. executables alone or executables , NOT a path or word that merely starts with the string executables): skip Steps 2–5 entirely and go to "Mode: Executables Extraction" below.If first token equals prune: skip Steps 2–5 entirely and go to "Mode: Memory Pruning" below. - 03
Step 3: Gap analysis
For each identified pattern, check:
Already covered? — search existing agent/skill descriptions for overlapFrequent enough? — recurring ≥ 3 times or clearly domain-specialized (See Step 2 heuristics — combine ≥3 occurrences with effort/frequency signals from Steps 1–2)Would specialist add quality? — does it require deep domain knowledge? - 04
Step 4: Check for duplication
Before recommending anything, run overlap check and anti-pattern checklist:
Role vs task confusion: agents are roles, not tasks. Do not create agent for every different topic.Near-duplicate: candidate duplicates existing agent with slightly different name. Enhance existing instead.Thin wrapper: candidate skill just calls one agent with fixed args. Not enough value to justify new skill file. Exception: skills that add measure-first/measure-after bookends, multi-mode dispatch across 3+ agents, or s… - 05
Step 5: Report
Review the “Step 5: Report” section in the pinned source before continuing.
Review and apply the “Step 5: Report” source section.
Permission review
Static risk signals and limitations
Runs scripts
The documentation asks the agent to run terminal commands or scripts.
python "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}/bin/load_shared_doc.py" foundry skills/_shared task-hygiene.md # timeout: 5000Runs scripts
The documentation asks the agent to run terminal commands or scripts.
git log --oneline -50Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 91/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 25 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- Borda/AI-Rig
- Skill path
- plugins/cc_foundry/skills/distill/SKILL.md
- Commit
- 1bb724c28af29d9037a9ad192551e9c7f83b65bf
- License
- Apache-2.0
- Collected
- 2026-08-28
- Default branch
- main
View the original SKILL.md
Analyze how Claude Code is used and surface concrete improvements — new agents/skills to reduce repetition, or consolidate lessons into governance files (rules, agent instructions, skill updates) — without duplicating what exists.
NOT for single-file edits or quality checks — use /foundry:audit for config quality checks. NOT for audit-only scan for extraction candidates (use /foundry:audit --efficiency instead of distill executables for detection-only).
- $ARGUMENTS: optional. Modes:
- Omitted — analyze existing patterns and agents; generate suggestions proactively.
prune [--eager]— evaluate project memory file for stale, redundant, or verbose entries. Default: advisory diff + apply prompt.--eager: score every entry (Usage likelihood × Impact → Tier P0/P1/P2), print full scored table with#column, let user select by tier or item numbers, delegate edits tofoundry:curator.memory [--eager]— read.notes/lessons.mdand memory feedback files, distill recurring patterns into proposed rule files, agent instruction updates, and skill workflow changes.--eager: include Pattern count, Strength, and Tier columns in proposal table; let user select clusters to promote by tier or item numbers; delegate writes tofoundry:curator.external <source> [--eager]— analyse external plugin, skill, or agentic resource and produce structured adoption proposal.<source>is URL, file path, or local directory.--eager: lower adoption bar — recommend partial adoption even for single useful components.executables [--eager] [<run-dir-or-report-path>]— perform bin/ extraction from/foundry:audit --efficiencyCheck 33 candidates. Auto-detects latest run dir under.reports/audit/; pass optional path to target a specific run dir or report file. Runs inline Check 33 scan when no report exists. Default gates on HIGH/MEDIUM verdict.--eager: also surface LOW verdict clusters as extraction candidates. Spawnsfoundry:sw-engineerper cluster. Skip to Mode: Executables Extraction below.[--eager] <recurring task description>— use description as context when generating suggestions.--eager: lower frequency threshold from 3+ to 2+ occurrences; single high-effort occurrence also qualifies.--project— inpruneandmemorymodes, show an interactive project picker: enumerate all slugs under~/.claude/projects/*/memory/with MEMORY.md size in tokens, then let user select which project(s) to operate on. Omit to operate across all projects automatically. Has no effect on other modes.
Task hygiene: load and follow the protocol below.
# loads: compaction-contract.md
# audit-skip: resilience-replication
python "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}/bin/load_shared_doc.py" foundry skills/_shared task-hygiene.md # timeout: 5000
export CSID="${CLAUDE_CODE_SESSION_ID:-$PPID}"
KEEP_ITEMS=""
if [[ "$ARGUMENTS" =~ --keep[[:space:]]\"([^\"]+)\" ]]; then
KEEP_ITEMS="${BASH_REMATCH[1]}"
fi
ARGUMENTS=$(echo "$ARGUMENTS" | sed 's/--keep "[^"]*"//g')
rm -f .temp/state/skill-contract.md # clear stale contract (compaction-contract.md §Lifecycle) # timeout: 5000
mkdir -p "${TMPDIR:-/tmp}/distill-state-${CSID}"
echo "$KEEP_ITEMS" > "${TMPDIR:-/tmp}/distill-state-${CSID}/keep-items"
EAGER=false
[[ "$ARGUMENTS" == *"--eager"* ]] && EAGER=true
ARGUMENTS=$(echo "$ARGUMENTS" | sed 's/--eager//g' | xargs) # timeout: 3000
echo "EAGER=$EAGER" # shell vars don't persist across Bash calls — read from stdout
echo "ARGUMENTS_STRIPPED=$ARGUMENTS"
Note:
EAGERand strippedARGUMENTSare set by this Bash block, but shell variable state does not persist across separate Bash() tool calls. After this block runs, read its stdout (EAGER=true/false,ARGUMENTS_STRIPPED=...) and carry those values as model-context references for all subsequent mode dispatch and threshold decisions. Do not rely on$EAGERas a live shell variable in later steps — substitute the literal boolean value read from stdout.
PROJECT_FLAG=false
if echo "$ARGUMENTS" | grep -qE -- "--project"; then
PROJECT_FLAG=true
ARGUMENTS=$(echo "$ARGUMENTS" | sed 's/--project//' | xargs)
fi
echo "PROJECT_FLAG=$PROJECT_FLAG"
echo "ARGUMENTS_FINAL=$ARGUMENTS"
Note:
PROJECT_FLAGdoes not persist across Bash calls. Read its value from the stdout linePROJECT_FLAG=true/falseand carry as model-context reference. Whentrue, the mode must run the interactive picker before operating.
Step 1: Inventory existing agents and skills
Use Glob tool to enumerate agents and skills across all sources — project-local AND plugin-namespaced — to avoid false-gap findings when candidate already exists in plugin:
- Project-local: pattern
agents/*.md, path.claude/; patternskills/*/SKILL.md, path.claude/ - Plugin source (workspace): pattern
*/agents/*.md, pathplugins/; pattern*/skills/*/SKILL.md, pathplugins/ - Installed plugin cache (if accessible): resolve cache root —
PLUGIN_CACHE="${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}"— then use Glob tool on$PLUGIN_CACHEfor pattern*/agents/*.mdand*/skills/*/SKILL.md
For each agent/skill found, extract: name, description, tools, purpose. Tag each entry with plugin namespace (e.g. foundry:sw-engineer, oss:resolve) — used in Step 3 gap analysis to prevent recommending duplicates of plugin-namespaced agents/skills.
Step 2: Analyze work patterns
Mode-token normalization — all mode dispatches below compare against the first whitespace-delimited token of the stripped
ARGUMENTS(after--eagerremoval). Use this single rule consistently; do not rely on exact equality of the full$ARGUMENTSstring, since trailing flags/spaces from prior parsing may differ.
If first token equals executables (i.e. executables alone or executables <path>, NOT a path or word that merely starts with the string executables): skip Steps 2–5 entirely and go to "Mode: Executables Extraction" below.
If first token equals prune: skip Steps 2–5 entirely and go to "Mode: Memory Pruning" below.
If first token equals memory: skip Steps 2–5 entirely and go to "Mode: Memory Distillation" below.
If first token equals external (i.e. external <source>, NOT a word that merely starts with the string external): skip Steps 2–5 entirely and go to "Mode: External Distillation" below.
Otherwise, look for signals of repetitive or specialist work. First three git commands are independent — run in parallel:
# timeout: 3000
# --- run these three in parallel ---
git log --oneline -50
git log --name-only --pretty="" -30 | sort | uniq -c | sort -rn | head -20
git log --oneline -100 | cut -d' ' -f2 | sort | uniq -c | sort -rn | head -15
Then use Glob tool (pattern todo_*.md, path .plans/active/) to list active task files; read each with Read tool. Also read .notes/lessons.md (if exists) for task history and conversation hints.
If $ARGUMENTS provided, use as additional context for pattern analysis.
Frequency Heuristics
- 3+ occurrences of pattern in recent history → candidate for automation
- 2+ different projects using same manual process → cross-project skill
- significant manual effort per occurrence (subjective — use git history context) → high-value automation target
- Domain-specific knowledge required → candidate for specialist agent (not just skill)
With --eager (lower thresholds):
- 2+ occurrences → candidate for automation
- 1 occurrence with significant manual effort → qualifies as high-value candidate
- Domain-specific threshold unchanged
export CSID="${CLAUDE_CODE_SESSION_ID:-$PPID}"
IFS= read -r _KEEP < "${TMPDIR:-/tmp}/distill-state-${CSID}/keep-items" 2>/dev/null || _KEEP=""
_PRESERVE="run-dir=n/a"
[ -n "$_KEEP" ] && _PRESERVE="$_PRESERVE; user-keep: $_KEEP"
mkdir -p .temp/state # timeout: 5000
{
echo "## Active Skill Contract"
echo "- skill: foundry:distill · phase: gap-analysis (after work-pattern scan)"
echo "- run-dir: n/a"
echo "- preserve: $_PRESERVE"
echo "- next: gap analysis (Step 3) → duplication check (Step 4) → report (Step 5)"
} > .temp/state/skill-contract.md
Step 3: Gap analysis
For each identified pattern, check:
- Already covered? — search existing agent/skill descriptions for overlap
- Frequent enough? — recurring ≥ 3 times or clearly domain-specialized (See Step 2 heuristics — combine ≥3 occurrences with effort/frequency signals from Steps 1–2)
- Would specialist add quality? — does it require deep domain knowledge?
- Too narrow? — single-use task doesn't warrant persistent agent
Thresholds for recommendation:
- New agent: recurring specialist role, complex decision-making, 5+ distinct capabilities
- New skill: workflow orchestration, multi-step process with fixed structure
- No new file needed: one-off or already covered by existing agent
Step 4: Check for duplication
Before recommending anything, run overlap check and anti-pattern checklist:
For each candidate agent/skill:
- Does any existing agent cover >50% of its scope? → enhance existing instead
(with --eager: lower to >30%; any shared single named capability → flag as boundary issue)
- Is the name/description confusingly similar to an existing one? → rename existing
Anti-pattern checklist — reject candidate if any apply:
- Role vs task confusion: agents are roles, not tasks. Do not create agent for every different topic.
- Near-duplicate: candidate duplicates existing agent with slightly different name. Enhance existing instead.
- Thin wrapper: candidate skill just calls one agent with fixed args. Not enough value to justify new skill file. Exception: skills that add measure-first/measure-after bookends, multi-mode dispatch across 3+ agents, or safety breaks (retry limits, validation gates) justify wrapper even if only one agent executes for given invocation.
Step 5: Report
## Agent/Skill Suggestions
### Existing Coverage (no gaps found)
- [agent/skill]: covers [pattern] well — no new file needed
### Recommend: New Agent — [name]
**Trigger**: [what recurring pattern or gap justifies this]
**Gap**: [what existing agents don't cover]
**Scope**: [what it would do — 3-5 bullet points]
**Suggested tools**: [Read, Write, Edit, Bash, etc.]
**Draft description**: "[one-line description for frontmatter]"
### Recommend: New Skill — [name]
**Trigger**: [what repetitive workflow justifies this]
**Gap**: [why existing skills don't cover it]
**Scope**: [what workflow steps it would orchestrate]
**Draft description**: "[one-line description for frontmatter]"
### Recommend: Enhance Existing — [agent/skill name]
**Add**: [specific capability missing from current version]
**Why**: [what recurring task would benefit]
### No Action Needed
[pattern]: already handled by [existing agent/skill]
## Confidence
**Score**: [0.N]
**Gaps**: [e.g., git history too shallow, task files not present, descriptions too generic to compare]
**Refinements**: N passes. [Pass 1: <what improved>. Pass 2: <what improved>.] — omit if 0 passes
rm -f .temp/state/skill-contract.md # clear contract — skill complete (compaction-contract.md §Lifecycle) # timeout: 5000
Mode: Memory Pruning — only when $ARGUMENTS == "prune"
DISTILL_MODES=$(python "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}/bin/resolve_skill_subdir.py" distill modes 2>/dev/null || echo "plugins/cc_foundry/skills/distill/modes") # timeout: 5000
cat "$DISTILL_MODES/prune.md"
Execute the mode loaded above.
Mode: Memory Distillation — only when first token is memory
DISTILL_MODES=$(python "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}/bin/resolve_skill_subdir.py" distill modes 2>/dev/null || echo "plugins/cc_foundry/skills/distill/modes") # timeout: 5000
cat "$DISTILL_MODES/memory.md"
Execute the mode loaded above.
Mode: External Distillation — only when $ARGUMENTS begins with external
DISTILL_MODES=$(python "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}/bin/resolve_skill_subdir.py" distill modes 2>/dev/null || echo "plugins/cc_foundry/skills/distill/modes") # timeout: 5000
cat "$DISTILL_MODES/external.md"
Execute the mode loaded above.
Mode: Executables Extraction — only when $ARGUMENTS begins with executables
DISTILL_MODES=$(python "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}/bin/resolve_skill_subdir.py" distill modes 2>/dev/null || echo "plugins/cc_foundry/skills/distill/modes") # timeout: 5000
cat "$DISTILL_MODES/executables.md"
Execute the mode loaded above.
-
Skill is introspective: looks at tooling itself, not just code
-
Invoke periodically (e.g., monthly) or after burst of correction/feedback; one-time snapshot, not continuous monitor
-
Suggestions are proposals — review before creating new files
-
After creating new agent/skill from suggestion, re-run skill once to confirm gap resolved, then stop
-
memorymode is primary consolidation path — run after any session with significant corrections to prevent lesson drift into MEMORY.md noise -
Agent Teams signal tracking: when reviewing patterns, also look for:
- Skills using
--teamor team-mode heuristics more/less than expected → flag over/under-use relative to decision matrix inCLAUDE.md § Agent Teams - Security findings in reviews for non-auth code → foundry:qa-specialist teammate scope too broad; narrow it
- Model tier mismatches (e.g., heavy analysis assigned to
sonnetteammates) → flag for tier adjustment
- Skills using
-
externalmode calibration: two concrete GT fixture cases defined in calibrate skills mode file — find viafind "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}" -maxdepth 5 -path "*/calibrate/modes/skills.md" 2>/dev/null | head -1with fallback toplugins/cc_foundry/skills/calibrate/modes/skills.md:- caveman plugin — narrow, self-contained communication mode, no local structural overlap → GT: install-as-is recommended, Group A empty or thin
- Karpathy autoresearch — research automation tool, strong overlap with
research:plugin structure → GT: Group A candidates map to research plugin, digest recommended, install-as-is not triggered - Ground truth = static snapshot of each tool's agent/skill/rule files (no live fetch needed); score adoption-table lane assignments against GT outcomes
-
Follow-up chains:
- Suggestion accepted for new agent/skill →
/foundry:manage createto scaffold and register it - Suggestion to enhance existing → edit agent/skill directly, then
/foundry:setup memoryproposals applied →/foundry:setupto propagate;/foundry:audit rulesto verify new rule files structurally soundexecutablesextraction complete →/foundry:setupto propagate bin/ scripts; run/foundry:audit --efficiencyto confirmclusters == 0
- Suggestion accepted for new agent/skill →
Frequently asked questions
What to verify before installation and use
What does the distill source document cover?
One-time snapshot extracting patterns from work history and accumulated lessons, distills into concrete improvements — new agent/skill suggestions, memory pruning, consolidating lessons into rules/agent updates, or performing bin/ extraction from /audit --efficiency candidates. Roster boundary analysis → /foundry:audit agents (Check 34).
How do I install distill?
The source record exposes this install command: npx skills add https://github.com/Borda/AI-Rig --skill "plugins/cc_foundry/skills/distill". Inspect the command and pinned source before running it.
Which permission-related actions were detected?
Static rules flagged exec-script in the source; the page lists the matching lines and excerpts.
Alternatives
Compare before choosing
coreyhaines31/marketingskills
ab-testing
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
coreyhaines31/marketingskills
churn-prevention
When the user wants to reduce churn, build cancellation flows, set up save offers, recover failed payments, or implement retention strategies. Also use when the user mentions 'churn,' 'cancel flow,' 'offboarding,' 'save offer,' 'dunning,' 'failed payment recovery,' 'win-back,' 'retention,' 'exit survey,' 'pause subscription,' 'involuntary churn,' 'people keep canceling,' 'churn rate is too high,' 'how do I keep users,' or 'customers are leaving.' Use this whenever someone is losing subscribers o
alirezarezvani/claude-skills
app-store-optimization
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
wanshuiyin/Auto-claude-code-research-in-sleep
citation-audit
Use it for operations and research tasks; the detail page covers purpose, installation, and practical steps.