From ai_dev
Manages repo-root guardrail documents (CHARTER.md, ARCHITECTURE.md, TESTING.md, SECURITY.md) for AI agents, defining authority hierarchy and consulting rules. Use to bootstrap, draft, or understand guardrail docs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ai_dev:guardrailThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
<guardrail_skill>
<guardrail_skill>
The guardrail skill is the hub and source of truth of the `guardrail_*` family: it defines what guardrail documents are, which ones can exist, how they rank, what shape they share, and how other skills consume them. A guardrail document is a standing, human-owned markdown file at the project root that carries one domain of durable project truth an AI agent must respect or consult while working. Guardrail docs exist because unattended agents drift: a task to do X quietly becomes Y, and Y becomes Z, with no human in the loop. The guardrail layer is the human's standing voice at the moment of work — direction the agent reads and respects in every session, long after the conversation that set the direction is gone. Humans set direction through these docs; agents execute within the boundaries the docs declare and surface every conflict they meet. A guardrail bounds work; it never freezes it: the project adapts, grows, and is deliberately steered within its declared boundaries, and the docs themselves evolve with the project through their human-owned change path.The system is universal. It serves a single software system, a knowledge or content repository, a meta-repository whose product is components or documents, and a mixed multi-project layout alike, in any language and any stack. This skill carries only the general knowledge — the what and the how that hold everywhere; every actual guardrail doc is tailored to its repository, and a doc type that fits one repo nature can be a bad fit for another.
<when_to_activate> Activate this skill when the user:
CHARTER.md, ARCHITECTURE.md, TESTING.md, or SECURITY.md — or a guardrail layer as a whole.CLAUDE.md / AGENTS.md / GEMINI.md and equivalents).Route to guardrail_audit when the user wants the repo's existing guardrail docs audited for contradictions and doc-vs-code divergence. Route to the task family for backlog work; the task skills consume guardrail docs but are not the place that defines them.
</when_to_activate>
<doc_set>
Four core guardrail types are recognized. Each has a bundled reference (sibling of this SKILL.md) carrying its general template, its universally valid rules, and its tailoring guidance — read the reference before explaining, suggesting, drafting, or assessing a doc of that type:
CHARTER.md — the falsifiable project-identity contract: core purpose, DOES / DOES NOT domain boundaries, key invariants, intentional constraints. The one doc that stops work rather than informing it. Reference: references/charter.md.ARCHITECTURE.md — the descriptive account of how the project is structured and where its structure is deliberately headed: goals, stack, components and their responsibilities, load-bearing design decisions, declared direction. Reference: references/architecture.md.TESTING.md — the project's verification methodology: what counts as tested, the discipline verification follows, and how the suite runs. Reference: references/testing.md.SECURITY.md — the security constraints that must hold: secrets, trust boundaries, data handling, dependencies, attack surface. Reference: references/security.md.The set is open on two sides. Sideways, a repository may carry further domain guardrails as peers — FEATURES.md as a behaviour ledger is an established example — following the same format contract and consumption convention. Below, the harness rule files (CLAUDE.md / AGENTS.md / GEMINI.md and equivalents) are the project's standing-instruction baseline: the harness loads them automatically, they are owned by the harness convention rather than created through this family, and they enter the guardrail system only through the hierarchy, where they rank at the bottom.
</doc_set>
CHARTER.md. The falsifiable boundary every other doc and every piece of work stays inside. A conflict between the charter and anything softer resolves in the charter's favor and is reported for human review; a softer doc never overrides the charter and never supplies the authority for work the charter would not bless.ARCHITECTURE.md, TESTING.md, SECURITY.md, and peers such as FEATURES.md: design-and-verification statements about the project.Orthogonal to authority runs the enforcement spectrum — how strongly each doc guards:
guardrail/charter-*), so an agent can never rewrite the contract to license its own drift.TESTING.md and SECURITY.md: consulted whenever work enters their domain; a divergence between the work and the doc is a finding the agent surfaces before claiming done — reported for the user to weigh, never silently passed — while the doc itself never halts the run.ARCHITECTURE.md and FEATURES.md: they inform work and are refreshed as the project evolves; their guard value is truthfulness, because a description that no longer matches the project — or presents intention as fact — misleads every future agent.The hierarchy names the default authority direction; a human makes the actual call. Only the charter's hard fence stops work on its own — every other conflict is surfaced with the authoritative doc named and the resolution left to the user.
<format_contract> Every guardrail doc, of every type, honours the same format contract:
UPPERCASE.md, one domain per doc. Project-wide standing material lives at the repository root as an UPPERCASE.md file; work-system material (for example the task backlog) lives in its own tree. The filename is the interface — consumers discover a doc by its presence, so no registry, index, or manifest is needed.The touchpoint rule: a workflow consults the doc whose domain its work enters, at the moment it enters it. Work about to write project content validates against CHARTER.md and stops on a violation. Work that writes or audits tests reads TESTING.md first. Work that touches a surface SECURITY.md names checks the change against the constraints that must hold. Work that needs design context reads ARCHITECTURE.md; work that ships behaviour refreshes the descriptive docs it invalidated. The task-management family is the established consuming instance: task creation reads FEATURES.md and ARCHITECTURE.md for prior art, the readiness gate and every autonomous writer validate against CHARTER.md, implementation and audit read TESTING.md, and close-out refreshes ARCHITECTURE.md when finished work extended the design.
Three guard behaviours hold at every touchpoint:
<hierarchy>); the human reconciles. Divergence can be deliberate — the human steering the repo toward where a doc points — so the agent presents both reconcile directions rather than assuming either side is wrong.CHARTER.md, switch to a guardrail/charter-* branch: where the protect hook is deployed the edit is blocked anywhere else, and where it is not, the branch still preserves the human-review path the charter contract expects.[UNDERSPECIFIED] and ask one focused round of questions per doc rather than guessing. A doc is useful and consistent before it is complete.[UNDERSPECIFIED] marker, and every surfaced divergence. The user reviews and commits; consumers pick the doc up by presence, so no wiring or registration step exists.
<output_contract>
A suggest run reports: the repo nature read in <orient>, the inventory of existing docs, each suggested doc with its grounding evidence and what it would capture, each type left out with the reason, and a closing question asking which the user wants — with no file created. A create run reports each drafted doc with its open markers and surfaced divergences, and leaves review and commit to the user. An explain run answers in compact prose and names the reference it drew from.
</output_contract>
guardrail — the hub: explain, assess, suggest, and draft on request (this skill)guardrail_audit — read-only audit of a repo's existing guardrail docs: doc-vs-doc contradictions, doc-vs-code divergence, and grounded missing-doc proposals, ranked by the hierarchyThese ship together; a sibling may be absent if a deployment excluded it. The family is a sibling of the task family, not a member: task skills consume guardrail docs through <consumption>, while defining and maintaining the docs belongs here.
</guardrail_skill>
npx claudepluginhub theafh/ai-modules --plugin ai_devWrites project guardrails defining cross-module constraints, update triggers, and workflow hooks. Use for project starts, architecture/platform changes, incidents, repeated review issues.
Authors enforceable project constitutions for greenfield projects with testable principles, enforcement mechanisms, rationale, and amendment processes.
Set up or update an agent-first engineering harness for any repository, including knowledge maps, architecture boundaries, enforcement rules, and quality scoring.