Artifact Types โ When to Use Which
This document is the single source of truth for deciding what shape a piece of platform content should take. Before authoring a new artifact under .claude/ or policies/ โ or before consolidating or splitting an existing one โ walk the decision tree below.
The platform has six artifact types. Choosing the right one keeps the system predictable: humans can reason about what loads when, the Policy Engine can route triggers correctly, and Claude can locate the right surface to act on without searching the whole tree.
The six artifact typesโ
| Artifact | Lives at | Activation | One-line essence |
|---|---|---|---|
| Rule | CLAUDE.md, agent bodies, policies/*.yaml | Always loaded; no trigger | An invariant โ "every time you touch X, Y must hold" |
| Hook | .claude/hooks/*.sh | Event-driven (pre-commit, PreToolUse, SessionStart, โฆ) | Enforcement at the exact moment of an action |
| Policy | policies/*.yaml | Policy Engine at step 4 of /continue | A trigger declaration that loads agents |
| Agent | .claude/agents/<name>.md | Policy Engine via required_agents, or @agent-name | An expert persona with its own context window and tool allowlist |
| Skill | .claude/skills/<name>/SKILL.md | /name, or progressive load from inside an agent | A multi-step procedure with bundled scripts and references |
| Command | .claude/commands/<name>.md | User types /name | A thin prompt template โ an invocation handle |
For the broader system, see ai-engineering-strategy.md ยง12โยง13, policy-engine.md, and autonomy-model.md.
Documentation artifacts (Product / R&D handoff)โ
Distinct from the six platform artifacts above, BeWith uses a small set of documentation artifacts that capture the lifecycle of a feature from product intent to shipped code. Each has a clear owner and lives at a specific path.
| Artifact | Owner | When written | Lives at | Template |
|---|---|---|---|---|
| Proposal | Anyone | Early, side-project sized idea | docs/proposals/proposal-YYYY-MM-DD-<slug>.md | proposal |
| PRD | Product | After idea is committed to | docs/prds/<slug>-<cu-id>.md | prd |
| Design Doc | R&D | After PRD reaches ready-for-rd | docs/designs/<slug>-<cu-id>.md | design-doc |
| RFC | Whoever drives | Multi-team / week-plus / contract-changing change | docs/rfcs/rfc-<slug>.md | rfc |
| ADR | R&D | After a technical decision is made | docs/adrs/adr-NNN-<slug>.md | adr |
| Decision Log | Anyone | After a product/business decision is made | docs/decisions/<slug>.md | decision |
| Runbook | Operations / R&D | Repeatable human procedure | docs/runbooks/<name>.md | runbook |
The PRD โ Design Doc pair is the spine of feature delivery. A PRD without a Design Doc is product-only ideation; a Design Doc without a PRD is R&D guessing what to build. The pipeline that ties them is documented in Product โ R&D Handoff.
Boundary rule (between PRD and Design Doc):
- The PRD captures WHAT and WHY โ problem, requirements, UI references to the design-system catalog, analytics events to fire, API-accessible capabilities (as business statements).
- The Design Doc captures HOW โ endpoint shapes, schemas, architecture, task breakdown. It is R&D's translation, never authored by Product.
If you find product writing endpoint paths or engineering writing user stories, the boundary is being violated. Move the content to the right document.
Frontmatter conventionsโ
Every artifact under .claude/ and policies/ carries YAML frontmatter declaring its identity and discovery metadata. Two fields are universal; one is context-specific.
name, description, tags (universal)โ
nameโ kebab-case identifier, must match the filename / directory.descriptionโ one-line summary used by/help-meand the capability index.tagsโ array of keywords used to group artifacts indocs/capabilities.md.
audience (REQUIRED on agents, skills, commands, and policies โ see ยง"Audience" below)โ
audience: dev | product | both โ declares which user role the artifact serves. The capability-awareness hook and /help-me filter offers by intersection with the current user's role (set via /role).
audience: devโ surfaced only when user's role isdev(the default for everyone). Examples:code-reviewer,process-guardian,/breakdown.audience: productโ surfaced only when user's role isproduct. Examples:prd-writer(when Phase 2 of the ABC-TOM merge lands),gatekeeper, intake skill.audience: bothโ surfaced regardless of role. Examples:/help-me,/new-artifact,/propose,/roleitself.
Rules and hooks do not carry audience โ rules are always-on invariants, and hooks fire on events rather than appearing in discovery surfaces.
If an artifact is missing the audience field, the capability-awareness hook treats it as both during the transition window and surfaces a one-line warning the first time it appears in a session. New artifacts must declare audience explicitly โ the unset default exists only for legacy content not yet swept.
See docs/proposals/proposal-2026-05-31-user-role-and-audience-filtering for the design.
Decision treeโ
Walk these questions top-down. The first "yes" picks the shape.
-
Must this apply every time, with no trigger needed? โ Rule. Place it in
CLAUDE.mdfor platform-wide invariants, in an agent body for domain-narrow ones, or inpolicies/*.yamlif it is a structured trigger. -
Must this block or enforce at the exact moment of an action? (before a commit, before a tool runs, on session start) โ Hook in
.claude/hooks/. Hooks typically pair with a rule โ the rule states the invariant, the hook enforces it. -
Does this declare which agents to load when certain conditions are met? โ Policy in
policies/. Policies haverequired_agents; the Policy Engine evaluates them at step 4 of/continueand aggregates the agent set. -
Is this a multi-step procedure you would re-run the same way, with optional scripts or data bundled alongside? โ Skill in
.claude/skills/<name>/. Lightweight; invocable by an agent, by a user, or by a command. Progressive loading: metadata first, thenSKILL.md, then bundled resources. -
Does this require sustained expert judgment, a protected context window, and a restricted tool allowlist? โ Agent in
.claude/agents/<name>.md. The heaviest artifact โ use sparingly. Reserve for domains where the AI must hold deep specialised context. -
Is this a user-typed entry point that needs
$ARGUMENTSand a stable, discoverable name? โ Command in.claude/commands/<name>.md. Almost always a thin wrapper around a skill or an agent invocation.
If a candidate fits two shapes, prefer the lighter one. Ordered from light to heavy:
rule < command < skill < agent < hook < policy
(Hook is heavier than agent in the sense that it executes outside the AI's context and cannot be debated; policy is heaviest because it pulls full agents into context when it fires.)
Consolidation is the defaultโ
Splitting an agent or a skill requires a concrete reason that one of the layers is needed only sometimes โ different cadence, different risk profile, different access pattern. The default is consolidation.
Examples of correct consolidation:
- The design system โ one
design-systemagent owning tokens, component library, Storybook conventions. Not three separateux-designer+component-library+storybookagents. - Database work โ one
databaseagent owning schema design, indexing, document size, migrations, rollback, query patterns. Not separatedatabase-designanddatabase-migrationsagents. - Decision recording โ the
decision-recordskill (/decision) plus a rule carried byarchitectandproduct-manager. One skill routes both homes (ADR for technical, decision log for product/business) โ not a dedicateddecision-recorderagent, because the judgment about whether a decision is escalation-worthy belongs to the caller.
Before proposing a split, state explicitly: "X is needed only when Y, and Y is rare enough that loading the full bundle would be waste." If that sentence does not write itself cleanly, do not split.
Non-duplication principleโ
Every fact lives in exactly one place. Other artifacts link to it. Duplication creates drift; references stay correct.
Legal reference directionsโ
command โ skill (commands invoke procedures)
command โ agent (via @agent) (commands invoke experts)
agent โ skill (agents call procedures progressively)
agent โ policy (an agent may read its own triggering policy)
policy โ agent (required_agents)(policy declares which agents it loads)
skill โ scripts/refs (own dir) (a skill bundles its own assets)
hook โ script (own .sh) (hook implementation lives next to declaration)
Illegal patternsโ
- Cycles of any length:
A โ B โ A,A โ B โ C โ A. If an agent calls a skill, that skill must not call the agent back. - Lateral duplication: two agents (or two skills) carrying the same conceptual content. One must own; the other links.
- Upward references: a skill referencing a specific calling agent by name. Skills must be agent-agnostic so multiple agents can reuse them.
- CLAUDE.md leakage: a rule appearing both in
CLAUDE.mdand in an agent body.CLAUDE.mdis the project-wide ceiling; agents narrow it but never restate it.
Detecting driftโ
During PR review on changes that touch .claude/ or policies/:
- Build the reference graph from frontmatter and
[[wiki-links]]; fail on cycles. (Validator scriptscripts/checks/artifact-graph.mjsis TODO; until it lands, the review is manual.) - Search the platform for any phrase longer than ~15 words appearing in two places โ that is a duplication candidate.
- Search for an agent's name (kebab-case) inside any skill โ that is an upward reference and must be removed.
Worked examplesโ
Each example below shows how the heuristic resolves a real platform question. These are reference cases โ use them as templates for similar decisions.
Accessibility (WCAG AA, RTL, keyboard, screen readers)โ
- Procedure (run axe, check contrast ratios, validate focus order, test keyboard nav) โ skill
a11y-review. - Invariant ("no UI ships without an a11y pass") โ rule in
frontend-developer.mdanddesign-system.md. Optionally a policy withrequired_skills: [a11y-review]on PRs touching UI paths. - A dedicated agent is not warranted: BeWith UIs are largely internal-facing; the judgment surface is narrow enough to live as rules + a skill.
Storybookโ
- Invariant ("every component needs a story") โ rule in
design-system.md. - Procedure ("how to write a good story โ argTypes, controls, Chromatic, i18n in stories") โ skill bundled with the design system, or referenced by
design-systemagent. - Not an agent: surface is mechanical, no judgment.
Decision recording (ADR / decision log)โ
- The act of capturing a discussion that reached decisions (route to the right home, fill the template, update the index, then hand action items to
/breakdown) โ skilldecision-record, invoked by/decision. One skill covers both homes โdocs/adrs/for technical/architectural decisions,docs/decisions/for product/business/process โ because the procedure is identical and only the destination template differs (consolidation, not a split). - The invariant ("any cross-domain or hard-to-reverse decision must open a GitHub issue, hold discussion, and produce a record") โ rule carried by
product-managerandarchitect. - Not a dedicated
decision-recorderagent: judgment about whether a decision is escalation-worthy belongs to the caller; mechanical creation is a skill. - The decision record is an intake artifact above tasks โ its action items feed
/breakdown. It is distinct from a design doc, which sits below a task (per task, after research). Seeplanning-docs.md.
Contracts (FE โ BE schemas)โ
- Cross-repo schema layer (Zod, OpenAPI, RPC schemas โ exact shape depends on the audit of BeWith repos) โ agent
contracts-schemaowning versioning and breaking-change discipline. The judgment surface is rich enough to justify an agent. - The rule "any schema change touching public surfaces must update version + downstream consumers" lives in the agent body and is triggered by
policies/api-contract-change.yaml. - A skill
/contracts-bump(TBD) can mechanise the version bump and the consumer-notification step.
Cross-review by another modelโ
Tempting candidate for a /cross-review skill. Correct framing under autonomy-first: cross-review is a step that should happen automatically inside /adr and design-an-interface, not a user-triggered skill. Manual triggers for recurring quality steps are smells.
Authoring invariants โ beyond the type choiceโ
Any new artifact that mutates git state (a skill that opens a PR, a script that pushes a branch) must additionally satisfy the rules in session-safety.md: operate in an isolated git worktree, pre-flight refuse on branch collisions, never touch the developer's main checkout. The artifact-type choice picks the shape; session safety picks the execution model. Both must be settled before the artifact lands.
Cross-referencesโ
- ai-engineering-strategy.md ยง12 โ agent system overview
- ai-engineering-strategy.md ยง13 โ skills and commands
- policy-engine.md โ how policies trigger agents
- autonomy-model.md โ the autonomy hierarchy that determines whether an artifact runs without approval
- deterministic-ai.md โ the 8 principles; non-duplication and references serve the single-source-of-truth principle
- session-safety.md โ write-side worktree pattern and read-side memory freshness; mandatory for any artifact that mutates state
docs/templates/agent-template.mdโ canonical agent shapedocs/methodology/authoring-agents.mdโ the live roster