/harvest-learnings
You are the orchestrator for a CONSTRUCT skill. You mine a host project for
learnings and emit portable standards — each carrying the thing that makes a
principle usable by an AI reader instead of inert: a specific, attributed
exemplar and a back-link to the incident that forged it, plus a
portability verdict and an ADR-0020 activation tag.
The problem this solves: a portable principle with no exemplar is operationally
inert — "validate input" tells an agent nothing about when it bit. The forge
(a host project's lints, precedents, ADRs, incidents) is where the teeth are.
This skill carries the teeth across, and refuses to emit a principle without
them.
How success is judged
reports/harvest/scan-<TS>/harvest.md + harvest.json exist, and
every emitted standard carries its provenance: an attributed
exemplar plus a durable back-link (rule name / ADR id / precedent
id, never raw file:line).
- Each candidate has a Stage 3 portability verdict (ports /
stays-home / principle-ports-mechanism-stays) and a Stage 4
ADR-0020 activation tag — and the filter visibly bit (zero
stayed-home means re-run Stage 3).
- Ported items carry the N=1
single-constraint-set confidence caveat.
- Proposal only: no code edits, no auto-adoption into the corpus.
Write toward these gates from Stage 0.
Core beliefs
- The exemplar is the teeth. A portable standard with no attributed
exemplar + back-link is shallow by construction — do not emit it. The absence
of an
exemplars: field in the portable corpus today is its shallowness.
- Portability is earned, not assumed. Every candidate faces one question:
strip the framework, the language, the domain — does the rule survive?
Survives → ports. Dies → stays home (still valuable; recorded project-local).
A harvest where nothing stays home means the test never bit — suspect it.
- Two sources, not one. Extractive (forged surfaces) AND generative
(production standards the project skips). Generative alone is a checklist;
extractive alone misses the latent gaps.
- Activation, not just a rule (ADR 0020). Tag each standard
baseline
(always) or a rung with {min_maturity, min_stakes}. An untagged standard
can't be gated — it will nag a prototype or be ignored.
- Proposal only. Emit a report. Adoption into the corpus is a reviewed,
downstream step. Never edits code; never auto-adopts.
Scope
- Input: a host project root (default: current repo).
- Output:
reports/harvest/scan-<TS>/harvest.md (+ harvest.json). Never
edits code; never auto-adopts.
- N=1 honesty: with one forge, "ports" is a hypothesis
(
single-constraint-set), not a proven generalization — it graduates to
validated-across-N only when a second project confirms it (pairs with the
pattern-library qualifier ladder). Mark every ported item's confidence so.
Pipeline
Stage 0 — Setup
TS=$(date +%Y%m%d-%H%M%S)
REPORT_DIR="reports/harvest/scan-${TS}"
mkdir -p "$REPORT_DIR"
Stage 1 — Extractive gather (the forged surfaces)
Enumerate each surface where a learning was forged. Each is a candidate. Prefer
durable handles (rule name, ADR id, precedent id) as back-links over raw
file:line, which rots.
- Lint suite — every project AST/regex lint IS a forged learning. (host-a:
silent-catch, stringly-status, query-mutation, fat-view,
safe-dispatch, site-intelligence-boundary, pies-image-dict,
no-retailer-references.) Find them via the linting docs + lint sources.
precedents.yml — implementation case law (exemplars, guards, exceptions).
- ADRs (
docs/decisions/ or ai-docs/decisions/) — choices that constrain.
- Idea ledger, memories, known-issues — recurring fixes, gotchas.
For each: capture the rule, the originating exemplar (what bit), the back-link.
Stage 2 — Generative enumerate (the skipped standards)
Independently, enumerate production-grade standards the project should uphold
that a "hit-the-goal" pass skips — from latent senior-eng knowledge, not the
project's existing rules: idempotency on retried writes, fail-closed on
irreversible paths, default-closed authz, structured/correlated logging,
resource + cost bounds on unbounded loops, data lifecycle / PII, reversible
migrations, concurrency / races. For each, look in the host project for a
witness (a place it's violated) — that witness becomes the exemplar. No
witness → mark generative-only (lower teeth; flag it).
Stage 3 — Portability translation test
For every candidate (both sources), strip three layers and ask if the rule
survives — see knowledge/output-schema.md for the full test:
- Ports → portable standard (de-stacked statement + original-stack exemplar).
- Stays home → project-local; record it (still valuable), do NOT emit portable.
- Principle-ports-mechanism-stays → port the principle, leave the mechanism.
Self-check (the filter must bite): if zero candidates stayed home, re-examine
Stage 3 — you almost certainly let a stack-specific rule through.
Stage 4 — Activation tag (ADR 0020)
Tag each ported standard baseline: true (maintainability/consistency + cheap
common-sense safety — always on) OR rungs each with {min_maturity, min_stakes}. Note its depth ladder if it has one (cheap rung baseline; heavier
rungs stakes-gated). Schema + worked examples in knowledge/output-schema.md.
Stage 5 — Emit + summarize
Write harvest.md + harvest.json per the schema. Report in ≤12 lines: counts
(ported / stayed-home / generative-only); the highest-value ported standards; the
items that stayed home (proof the filter bit); the N=1 confidence caveat; the
report path. Routing adopted items into the corpus is a follow-up (escalate_to).
Non-goals
- Editing code or adopting standards — proposal only.
- Capturing a project-local idea (→
/track-idea / /extract-existing-ideas).
- Documenting one known pattern (→
/teach-pattern).
- Coverage-checking an existing standard (→
/find-standard-gaps).
- Proving generalization from one project — that is the pattern-library's
validated-across-N job; a single harvest yields hypotheses.
When things go sideways
| Symptom |
Action |
| Nothing stayed home |
The translation test didn't bite — re-run Stage 3; you let stack-specific rules through |
| A "portable" item has no exemplar |
Drop it or find the witness — a bare principle is the shallowness this skill exists to cure |
| Only the generative source produced anything |
No forged surfaces, or Stage 1 was skipped — a harvest with no extraction is a checklist (see max_overhead) |
Back-links are raw file:line |
Re-cite durable handles (lint name, ADR id, precedent id); file:line rots |
Repository layout
.claude/skills/harvest-learnings/
├── SKILL.md # this file — orchestrator (prompt-driven judgment)
└── knowledge/
└── output-schema.md # the per-item output contract + the translation test
1---2name: harvest-learnings3description: Distill a host project's forged learnings (lint suite, precedents, ADRs, idea ledger, known-issues) AND latent production-grade standards the project skips into PORTABLE standards — each carrying an attributed exemplar + durable host back-link, a portability verdict (ports / stays-home via a translation test), and a lifecycle×stakes activation tag (ADR 0020). Recurring; two-source (extractive + generative); proposal-only — never edits code or auto-adopts. Use to mine a project for cross-project standards, refresh the portable corpus, or convert one-off discoveries into reusable guardrails.4---56# /harvest-learnings78You are the orchestrator for a CONSTRUCT skill. You mine a **host project** for9learnings and emit **portable standards** — each carrying the thing that makes a10principle usable by an AI reader instead of inert: a specific, attributed11**exemplar** and a **back-link** to the incident that forged it, plus a12**portability verdict** and an **ADR-0020 activation tag**.1314The problem this solves: a portable principle with no exemplar is operationally15inert — "validate input" tells an agent nothing about *when it bit*. The forge16(a host project's lints, precedents, ADRs, incidents) is where the teeth are.17This skill carries the teeth across, and refuses to emit a principle without18them.1920## How success is judged2122- `reports/harvest/scan-<TS>/harvest.md` + `harvest.json` exist, and23 every emitted standard carries its provenance: an attributed24 exemplar plus a durable back-link (rule name / ADR id / precedent25 id, never raw `file:line`).26- Each candidate has a Stage 3 portability verdict (ports /27 stays-home / principle-ports-mechanism-stays) and a Stage 428 ADR-0020 activation tag — and the filter visibly bit (zero29 stayed-home means re-run Stage 3).30- Ported items carry the N=1 `single-constraint-set` confidence caveat.31- Proposal only: no code edits, no auto-adoption into the corpus.32Write toward these gates from Stage 0.3334## Core beliefs35361. **The exemplar is the teeth.** A portable standard with no attributed37 exemplar + back-link is shallow by construction — do not emit it. The absence38 of an `exemplars:` field in the portable corpus today *is* its shallowness.392. **Portability is earned, not assumed.** Every candidate faces one question:40 *strip the framework, the language, the domain — does the rule survive?*41 Survives → ports. Dies → stays home (still valuable; recorded project-local).42 A harvest where **nothing** stays home means the test never bit — suspect it.433. **Two sources, not one.** Extractive (forged surfaces) AND generative44 (production standards the project skips). Generative alone is a checklist;45 extractive alone misses the latent gaps.464. **Activation, not just a rule (ADR 0020).** Tag each standard `baseline`47 (always) or a rung with `{min_maturity, min_stakes}`. An untagged standard48 can't be gated — it will nag a prototype or be ignored.495. **Proposal only.** Emit a report. Adoption into the corpus is a reviewed,50 downstream step. Never edits code; never auto-adopts.5152## Scope5354- **Input:** a host project root (default: current repo).55- **Output:** `reports/harvest/scan-<TS>/harvest.md` (+ `harvest.json`). Never56 edits code; never auto-adopts.57- **N=1 honesty:** with one forge, "ports" is a *hypothesis*58 (`single-constraint-set`), not a proven generalization — it graduates to59 `validated-across-N` only when a second project confirms it (pairs with the60 pattern-library qualifier ladder). Mark every ported item's confidence so.6162## Pipeline6364### Stage 0 — Setup65```bash66TS=$(date +%Y%m%d-%H%M%S)67REPORT_DIR="reports/harvest/scan-${TS}"68mkdir -p "$REPORT_DIR"69```7071### Stage 1 — Extractive gather (the forged surfaces)72Enumerate each surface where a learning was forged. Each is a candidate. Prefer73**durable handles** (rule name, ADR id, precedent id) as back-links over raw74`file:line`, which rots.75- **Lint suite** — every project AST/regex lint IS a forged learning. (host-a:76 `silent-catch`, `stringly-status`, `query-mutation`, `fat-view`,77 `safe-dispatch`, `site-intelligence-boundary`, `pies-image-dict`,78 `no-retailer-references`.) Find them via the linting docs + lint sources.79- **`precedents.yml`** — implementation case law (exemplars, guards, exceptions).80- **ADRs** (`docs/decisions/` or `ai-docs/decisions/`) — choices that constrain.81- **Idea ledger**, **memories**, **known-issues** — recurring fixes, gotchas.82For each: capture the rule, the originating exemplar (what bit), the back-link.8384### Stage 2 — Generative enumerate (the skipped standards)85Independently, enumerate production-grade standards the project *should* uphold86that a "hit-the-goal" pass skips — from latent senior-eng knowledge, not the87project's existing rules: idempotency on retried writes, fail-closed on88irreversible paths, default-closed authz, structured/correlated logging,89resource + cost bounds on unbounded loops, data lifecycle / PII, reversible90migrations, concurrency / races. For each, look in the host project for a91**witness** (a place it's violated) — that witness becomes the exemplar. No92witness → mark generative-only (lower teeth; flag it).9394### Stage 3 — Portability translation test95For every candidate (both sources), strip three layers and ask if the rule96survives — see `knowledge/output-schema.md` for the full test:97- **Ports** → portable standard (de-stacked statement + original-stack exemplar).98- **Stays home** → project-local; record it (still valuable), do NOT emit portable.99- **Principle-ports-mechanism-stays** → port the principle, leave the mechanism.100101**Self-check (the filter must bite):** if zero candidates stayed home, re-examine102Stage 3 — you almost certainly let a stack-specific rule through.103104### Stage 4 — Activation tag (ADR 0020)105Tag each ported standard `baseline: true` (maintainability/consistency + cheap106common-sense safety — always on) OR `rungs` each with `{min_maturity,107min_stakes}`. Note its depth ladder if it has one (cheap rung baseline; heavier108rungs stakes-gated). Schema + worked examples in `knowledge/output-schema.md`.109110### Stage 5 — Emit + summarize111Write `harvest.md` + `harvest.json` per the schema. Report in ≤12 lines: counts112(ported / stayed-home / generative-only); the highest-value ported standards; the113items that stayed home (proof the filter bit); the N=1 confidence caveat; the114report path. Routing adopted items into the corpus is a follow-up (`escalate_to`).115116## Non-goals117118- Editing code or adopting standards — proposal only.119- Capturing a project-local idea (→ `/track-idea` / `/extract-existing-ideas`).120- Documenting one known pattern (→ `/teach-pattern`).121- Coverage-checking an existing standard (→ `/find-standard-gaps`).122- Proving generalization from one project — that is the pattern-library's123 `validated-across-N` job; a single harvest yields hypotheses.124125## When things go sideways126127| Symptom | Action |128|---|---|129| Nothing stayed home | The translation test didn't bite — re-run Stage 3; you let stack-specific rules through |130| A "portable" item has no exemplar | Drop it or find the witness — a bare principle is the shallowness this skill exists to cure |131| Only the generative source produced anything | No forged surfaces, or Stage 1 was skipped — a harvest with no extraction is a checklist (see `max_overhead`) |132| Back-links are raw `file:line` | Re-cite durable handles (lint name, ADR id, precedent id); `file:line` rots |133134## Repository layout135136```137.claude/skills/harvest-learnings/138├── SKILL.md # this file — orchestrator (prompt-driven judgment)139└── knowledge/140 └── output-schema.md # the per-item output contract + the translation test141```