| name | meta-rules |
| description | Agent and skill writing rules for Claude Code plugins. Enforces anti-bloat constraints, token limits, and quality standards for all auto-generated improvements. |
| user-invocable | false |
Meta-Rules — Plugin Component Quality Gates
Rules that govern how agents, skills, and workflows should be written.
All auto-generated improvements MUST pass these rules before application.
Token Limits
These limits apply to auto-generated improvements (output of improvement-generator and auto-optimizer). They constrain individual components, not the main orchestrating SKILL.md which serves as a command router.
| Component | Max Tokens | Measurement | Scope |
|---|
| Agent description (.md) | 1000 | chars/4 | Per agent file |
| Knowledge skill (SKILL.md) | 500 | chars/4 | Per knowledge skill (meta-rules, analysis-patterns, cost-tracking) |
| Main skill (SKILL.md) | No hard limit | — | Orchestrating skill — uses lazy-load via resources/ |
| Single example | 200 | chars/4 | Per example block |
| Hook script | 100 lines | line count | Per standalone script |
Writing Rules
Agents
- ALWAYS use imperative voice in instructions ("Analyze the traces" not "You should analyze the traces")
- ALWAYS specify input and output formats explicitly
- NEVER exceed 1000 tokens in the agent description
- ALWAYS include model assignment (haiku/sonnet/opus) with justification
- Include 1-2 examples maximum — more examples waste context
- NEVER use vague instructions ("do your best", "try to", "if possible")
- ALWAYS specify exit conditions — when is the agent done?
Skills
- ALWAYS keep SKILL.md under 500 tokens — use resources/ for details
- ALWAYS use the 2-layer structure: SKILL.md (core) + resources/ (on-demand)
- NEVER load all resources at once — lazy-load per phase/command
- ALWAYS declare allowed-tools explicitly — minimal permissions
- ALWAYS include trigger conditions in the description
Hooks
- ALWAYS complete within 50ms — hooks block execution
- ALWAYS use
|| true fallback — hook failures must not break workflow
- NEVER read large files in hooks — use append-only writes
- ALWAYS use
set -euo pipefail in scripts
- NEVER install external dependencies — bash + jq only
Workflows
- ALWAYS define phase transitions with explicit entry/exit conditions
- NEVER allow unbounded loops — always set max_iterations
- ALWAYS provide rollback mechanisms for destructive operations
- NEVER modify files without the user's explicit request
Anti-Bloat Rules
Prevent infinite growth of auto-generated content:
- Rule addition: When adding a new rule, check if an existing rule covers the same case → merge instead of add
- Example cap: Maximum 2 examples per section. If adding a third, remove the least useful existing one
- Description growth: If a component grows beyond its token limit after improvement, the improvement MUST be rewritten to fit within the limit
- Periodic review: Every 10 improvement cycles, run a deduplication pass on all agent/skill content
- Justification required: Every rule must have a "why" — rules without justification are candidates for removal
Validation Procedure
When checking a component against meta-rules:
1. Measure token count (chars / 4)
2. Check against component-type limit
3. Verify required sections exist (input, output, model assignment for agents)
4. Check for prohibited patterns (vague instructions, missing exit conditions)
5. Return: { passed: bool, violations: string[], token_count: number }