Rules
Compact rules for common engineering decisions, grouped by work area: documentation, Rust APIs, testing, review, source control, and agent workflow.
Rules are compact instructions supported by the guides, principles, patterns, and mechanisms in this repo. Each rule has its own file so it can be reviewed, deepened, linked, and extracted into compressed agent instructions independently.
Using the rules
Tags mark work areas: DOCS for documentation, VCS for jj and source control, RUST for crate shape, and AGENT for coding-agent work.
Rule pages include rationale, limits, mechanisms, and source links. Downstream repositories can copy compact instructions without copying the full explanation.
Rule work areas
Rule file shape
Each rule file should keep these sections:
Metadata: stable ID, portable name, summary, status, domain, tags, and related links.Rule: the direct human-readable instruction.Why: rationale when the rule needs justification or tradeoff framing.Helps: concrete development outcomes the rule improves.Limits: exceptions, costs, or counter-signals.Agent Instruction: compressed wording suitable for agent execution packs.Mechanisms: lints, formatters, CI checks, commands, or workflows that support the rule.References: durable sources that support, adapt, or contrast the rule in a useful way.
Rules can stay compact when the rationale is obvious, but compact should still mean finished. A rule should explain the failure mode, tradeoff, or design pressure well enough that a reviewer does not need the original source material to understand why it exists. Prefer concrete surfaces and examples over abstract categories when the reader would otherwise have to infer applicability.
Agent instructions are not repeated titles. They should encode the trigger, failure mode, or useful constraint that helps an agent apply the rule without blindly doing the literal shortest version of the instruction.
Naming
Use uppercase, dash-separated IDs:
DOCS-TREAT-DOCS-AS-CONTRACTS
RUST-KEEP-PUBLIC-API-SHAPE-INTENTIONAL
VCS-JJ-AS-SOURCE-OF-TRUTH
TEST-OPTIMIZE-FAILURE-OUTPUT
OBSERVABILITY-PRESERVE-OPERATION-CONTEXT-IN-ERRORS
Do not abbreviate broad family names in public rule IDs. Use OBSERVABILITY, not OBS.
Rule IDs are handles, not compressed titles. A good ID is short enough to cite in reviews, preserves the rule's real concept, and keeps connector words when dropping them would change the meaning. Prefer a verb-oriented handle when the rule is an action, and use domain nouns plus a decisive verb and object. Write titles as direct instructions when possible.