guardrail-harvest
Convert a flagged defect's class into a durable guardrail — a precise automated gate or a documented rule + checklist line — in the same change. Use whenever the user, a review, or a failing gate flags a defect.
- License 许可
- MPL-2.0
- 最近更新
- 2026-11-01
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- guardrail-harvest
- description
- Convert a flagged defect's class into a durable guardrail — a precise automated gate or a documented rule + checklist line — in the same change. Use whenever the user, a review, or a failing gate flags a defect.
03 SKILL.md 正文
Guardrail Harvest
Use this workflow whenever a defect is flagged — by the user, by a code review, by a failing gate, or by noticing your own mistake — and at the close of every slice/epic. Its job is to convert the class of defect into a durable rule or automated check so the next agent (any agent) cannot repeat it. Policy: ADR 0045, extending ADR 0038.
This is not optional polish. A flagged defect is not "done" when the instance is fixed — it is done when the class is closed.
Steps
-
Name the class, not the instance. Write one sentence: "Agents tend to <do X> when they should <do Y>." Generalize past the specific file. (Example: "Agents render a qualified ticker as plain text instead of using
TickerLabel.") -
Find the root cause — why was nothing stopping it? Usually one of: an undocumented convention, a component/rule that lives somewhere the self-check doesn't point at, or a missing gate. Fix that blind spot, not just the symptom.
-
Choose the enforcement (gate vs doc) deliberately. Per ADR 0045 Decision 2:
- Automated gate (lint rule, guard/contract test, type, layout-contract test) — only if the violation is precisely detectable, i.e. you can write a predicate that fires on the wrong thing and is clean across the entire existing codebase. Run it repo-wide before committing to it.
- If a gate would produce false positives, do NOT add it. A noisy gate gets disabled and erodes the whole posture. Encode the lesson as a documented rule in the canonical doc for the area, plus a self-check / review-checklist item.
- When unsure, prototype the gate, run it across
src/**, and look at every hit. If legitimate code is flagged, fall back to a doc rule.
-
Implement the guardrail in the same change as the fix. Land the instance fix and its class guardrail together.
-
Put it where every agent reads it. Durable rules go in
CLAUDE.md, the relevant canonical doc (docs/ui-authoring.md,docs/contracts.md,docs/data-model.md, …), an ADR, or an automated check — never only in agent-private memory (ADR 0045 Decision 4). Link the new rule/gate from the canonical doc so it is discoverable. If the lesson is a "remember to check X" rather than a code rule, add it as a line to the Definition of Done checklist — that checklist is the living home for harvested verification steps. -
State the harvest in your handoff. Note what class was closed and how (gate or doc), so the user can see the loop ran.
Anti-patterns
- Fixing only the instance the user pointed at and moving on.
- Adding a broad lint/test gate that flags legitimate code "to be safe" — this is the failure this loop exists to prevent.
- Writing the lesson into private memory instead of the repo.
- Deferring the guardrail to "later" — later never comes; the next agent repeats the mistake first.
04 同仓库更多 Skills
ship-pr
Use when a change is implemented and needs to land as a PR — branching, evidence, commits, PR creation, CI watching, or when CI jobs fail and you must decide rerun-vs-fix. Also use when a "green" claim is about to be made.
repoctx
Use repoctx for fast, indexed code navigation in this repo. Beats grep/find/cat on structural questions about symbols, definitions, the call graph (who-calls / callees / callgraph), and surrounding source.
packaging
Build and smoke-test Brawler release artifacts — portable Windows .exe from Linux/WSL via cargo-xwin, Linux .deb/.rpm/AppImage, native Windows fallback. Use for packaging, cross-build verification, or Windows hands-on testing paths.
investing-domain
Domain lens for designing/building Brawler — how an equity investor actually reads companies (fundamental analysis, quality assessment, GPW specifics). Load when designing UI hierarchies, panels, journeys, or analytics for company data.
brawler-mcp
Use when you (an AI agent) are connected to Brawler over its MCP server and need to read the user's investment research or write back into it — including acquiring KPIs from an issuer report ("process all pending KPI ingests", staging observations, resuming a pending run, a lease that expired, a validation that failed). Covers tool discovery, the read/act tiers, mandatory-source (provenance) rules, the KPI-ingest run workflow, internal-id conventions, the permanent denylist, and safe read→analyze→write sequences. Load it before your first tools/call against Brawler.
brawler-design
Use before ANY Brawler UI work — writing/changing JSX, drawing a mockup, styleguide or visual-language work, choosing colors/typography/labels, designing a panel or empty state. Binds the generic design skills to Brawler's normative design language (ADR 0104) and authoring contract.