skills/canon/skills/write-principle/SKILL.md
Principle, convention, and agent-rule authoring. Covers creation, editing, and applying accepted learner proposals. Handles interview, examples, conflict detection, format validation, and save. Loaded by the writer agent.
npx skillsauth add micherra/canon write-principleInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill defines the full procedural contract for creating, editing, and applying Canon principles, conventions, and agent-rules. You are the Canon Writer operating under this skill's guidance.
Core requirements:
${CLAUDE_PLUGIN_ROOT}/references/principle-format.md as the single source of truth for file structure during both creation and editing.From the prompt you receive, determine the mode:
.canon/principles/ for project-local customizationRead the principle format specification:
${CLAUDE_PLUGIN_ROOT}/references/principle-format.md
This specification is authoritative for required sections and ordering.
Read 2-3 existing entries as examples:
${CLAUDE_PLUGIN_ROOT}/principles/ — pick entries from different severity subdirectories (rules/, strong-opinions/, conventions/)${CLAUDE_PLUGIN_ROOT}/rules/ — pick 2-3 examplesAsk only questions the user hasn't already answered. If the prompt includes the constraint, failure mode, and scope, skip to Step 3. Otherwise, ask up to 3 targeted questions to fill gaps from:
The constraint — What must be true?
The failure mode — What goes wrong when this is violated?
The scope — Where does this apply?
**/api/**)"architect, planner, engineer, tester, security, reviewer, scribe, shipper, learner, writer, or all.canon/plans/**)"scope.layers to [] (agent-rules don't target architectural layers)The severity — How strictly should this be enforced?
rule: Hard constraint — blocks commits (principles) or must always be followed (agent-rules)strong-opinion: Default path — warn but don't blockconvention: Stylistic preference — noted but not enforcedTags — Freeform classification
agent-behavior plus the target agent name(s)Create at least one bad and one good example:
Present to the user for validation:
Produce the complete file with:
## Rationale section## Examples section (good and bad)## Exceptions section (when deviation is acceptable)## Anti-Rationalization section (table: excuse, why it's wrong, correct action)## Verification section (checklist with concrete compliance checks)Generate a kebab-case id from the title. For agent-rules, prefix with agent-.
Ensure the final structure matches the format spec exactly.
Read the complete worked example at ${CLAUDE_PLUGIN_ROOT}/references/writer-worked-example.md to see a fully assembled principle file.
Use the list_principles MCP tool to load the index of all existing entries (metadata only — id, title, severity, tags, scope). This avoids loading full bodies into context.
For agent-rules, also glob .canon/rules/*.md and ${CLAUDE_PLUGIN_ROOT}/rules/*.md and read only their frontmatter.
Check for:
ID collision: Another entry already uses this id? Warn that saving will override it.
Scope overlap with contradictory advice: Find entries with overlapping scope.layers or scope.file_patterns. If any give contradictory guidance, flag them:
"This may conflict with {other-id} ({other-title}) — both apply to {overlapping scope}. Review them together."
Duplicate coverage: Same tags AND very similar scope? Flag as potential duplicate:
"This looks similar to {other-id} ({other-title}). Consider extending that entry instead."
Severity inconsistency: A convention-severity entry overlapping with a rule-severity entry on the same topic? Flag the gap.
Present findings and ask whether to proceed, adjust, or cancel.
.canon/principles/{severity-subdir}/{id}.md where severity-subdir is rules/, strong-opinions/, or conventions/. Create directory if needed.${CLAUDE_PLUGIN_ROOT}/rules/{id}.md) or project-local (.canon/rules/{id}.md)?Re-read the saved file and verify:
rule, strong-opinion, convention## Rationale, ## Examples, ## Anti-Rationalization, ## Verification)id starts with agent-, tags include agent-behaviorAfter saving, suggest: "Run /canon:test-principle {id} to verify this principle works correctly in reviews."
Read the format spec:
${CLAUDE_PLUGIN_ROOT}/references/principle-format.md
This specification remains the source of truth during edits. If the existing file shape differs, migrate it to the spec-compliant structure while preserving intent.
Search for the entry by ID in:
.canon/principles/**/*.md (project-local principles)${CLAUDE_PLUGIN_ROOT}/principles/**/*.md (built-in principles).canon/rules/*.md (project-local agent-rules)${CLAUDE_PLUGIN_ROOT}/rules/*.md (built-in agent-rules)Present its current state:
If built-in (lives in plugin directory, not .canon/), warn:
"This is a built-in entry. Edits will be saved as a project-local override which takes precedence over the built-in version."
If specific flags were passed (e.g. --severity strong-opinion, --add-tag testing, --archive, --unarchive), apply directly. Otherwise ask what to modify:
{severity}"{layers}"{file_patterns}"{tags}"{title}"{archived}"--archive: Set archived: true in frontmatter. The principle stays on disk but is skipped by the matcher — it won't appear in reviews, get_principles, or review_code results. Confirm: "Archived {id} — it will no longer be loaded during reviews. Use --unarchive to re-enable."
--unarchive: Remove or set archived: false in frontmatter. Confirm: "Unarchived {id} — it will be active in reviews again."
Multiple changes are fine in one session.
If severity is changing, the file moves to the correct subdirectory:
rule → rules/strong-opinion → strong-opinions/convention → conventions/Warn about enforcement implications:
rule: "This will block commits that violate this."rule: "This will no longer block commits."Same conflict checks as the create flow (see Step 5 in Mode: new-principle/new-agent-rule above). Present findings and confirm before saving.
Re-read and verify the file. Tell the user:
The lead will provide the path to the learner proposal file (typically .canon/proposed-learnings/{id}.md). Read it in full. The proposal contains:
Determine whether the proposal describes:
The proposal already contains the constraint, failure mode, and scope. Do not ask the standard interview questions. Instead, verify the proposal has sufficient information to proceed:
If any critical gap exists, note it and ask one targeted question only.
Run the same quality checks as other modes (see Quality Checks section below). Generate or complete any missing sections using the proposal's rationale as source material.
Follow the save and validate steps from the appropriate mode (new-principle, new-agent-rule, or edit). After saving, confirm to the lead:
Read the format spec:
${CLAUDE_PLUGIN_ROOT}/references/principle-format.md
The user will name a principle to fork (by ID or partial title). Search for it in the built-in principles:
${CLAUDE_PLUGIN_ROOT}/principles/**/*.mdIf the principle is not found in the built-in directory, report: "No built-in principle found matching '{query}'. Fork mode is for copying built-in principles to project-local. Use new-principle mode to create a new principle."
If the principle is found, read it in full and present its current state:
Check if a project-local version already exists:
.canon/principles/{severity-subdir}/{id}.mdIf it exists, warn: "A project-local version of {id} already exists at .canon/principles/{severity-subdir}/{id}.md. Editing the existing copy instead of creating a duplicate."
Then switch to Mode: edit with the project-local file as the target.
Copy the built-in principle file to .canon/principles/{severity-subdir}/{id}.md, preserving the severity subdirectory structure.
Confirm: "Forked {id} to .canon/principles/{severity-subdir}/{id}.md. This project-local copy now takes precedence over the built-in version."
Ask: "Would you like to edit the forked principle now?"
If yes, switch to Mode: edit with the newly copied file as the target. If no, confirm the fork is complete and suggest editing later.
Re-read the saved file and verify:
Before saving, verify:
id is unique (or user confirmed override)id starts with agent-, tags include agent-behaviorprinciple-format.mddevelopment
Requirements sharpening for build requests. Classifies request fuzziness into tiers (trivial, clear, fuzzy) and applies proportionate PM effort -- from pass-through to full creative divergence. Produces a sharpened-request artifact for architect hand-off. Used by the PM orchestrator.
data-ai
Procedural how-to for inter-wave handoff coordination: analyze execution reports, push back on weak verdicts, draft next-wave prompts.
testing
Mechanical runbook synthesis from canonical step vocabulary. Composes a step-by-step runbook from the design using only canonical step IDs. Validates step composition, enforces mandatory tail, and emits per-signal confidence. Used by the architect agent.
development
Strategic analysis and planning brief production. Evaluates build requests, challenges assumptions, considers alternatives. Used by the architect agent as a requirements interview fallback when PM conversation left gaps.