Skip to content

Writing your own pack

The rule packs are plain markdown, so adding or improving one is easy.

Add a pack

  1. Create rules/<id>.md with a bulleted list of rules. Keep each rule short, concrete and imperative ("Do X", "Never Y").
  2. Register it in src/packs.ts:

export const PACKS = [
  // …existing…
  { id: 'docs', title: 'Documentation', description: 'Keep docs in sync with code.', file: 'docs.md' },
] as const;
3. Add a test expectation if relevant and run npm test.

That's it — composeRules(['docs']) and agent-rules-kit init --packs docs now work.

Writing good rules

  • One idea per bullet. Assistants follow short, unambiguous rules best.
  • Say what to do and what not to do. "Validate input at the boundary" beats "be careful".
  • Avoid project-specifics in shared packs — those belong in your own AGENTS.md additions, not the kit.
  • Explain the why only when it changes behaviour. Keep it tight.

Project-specific additions

Generate the base file, then append your repo's specifics (architecture, commands, conventions) below the generated sections. Re-running init overwrites the file, so keep project-specific notes in a separate file or a clearly marked block you re-add.

Contributing packs back

Good, broadly-applicable rules are welcome upstream — open a PR editing rules/ and src/packs.ts. See CONTRIBUTING.