Rule
A rule package provides guidelines, constraints, or best practices that shape how an AI coding assistant behaves in a project. Use this type when your package defines coding standards, review criteria, or project conventions rather than a specific action.
Manifest
Section titled “Manifest”A rule package sets "type": "rule" in apkg.json. It uses only the base manifest fields — there are no rule-specific fields.
{ "name": "@acme/security-rules", "version": "0.5.0", "type": "rule", "description": "Security-focused rules for code review", "license": "MIT"}Tool setup
Section titled “Tool setup”Automatic tool setup does not currently run for rule packages in Claude Code. Other tools like Cursor and Windsurf support auto-setup for rules. See Rules — Tool Integration for per-tool behavior, including alwaysApply and glob scoping support.
Example
Section titled “Example”Create a rule package:
mkdir my-rules && cd my-rulesapkg init# Choose type: ruleAdd a rule definition:
---name: security-standardsdescription: Enforce security best practicesalwaysApply: true---
When writing or reviewing code in this project, always:
- Never hardcode secrets, API keys, or credentials- Validate and sanitize all user input- Use parameterized queries for database access- Apply the principle of least privilege for file and network access- Flag any use of eval() or dynamic code executionPublish it:
apkg publish