Skip to content
agent-add-rule logo

Add Rule — Place Agent Instructions Correctly

agent-add-rule

Add a new rule, convention, or instruction to the project's agent configuration. Analyzes the rule and helps decide placement: root CLAUDE.md (universal rules), docs/agents/ files (topic-specific guidance), or a new skill (complex workflows). Triggers on: '/agent-add-rule', 'add a rule', 'add con...

SKILL.md

Full skill instructions

Add Rule — Place Agent Instructions Correctly

Add a new rule or convention to the right location in the progressive disclosure structure.

Context Spectrum

Static (root CLAUDE.md)      — loaded every conversation. Token cost always paid.
Semi-dynamic (docs/​agents/)  — linked from root. Loaded when Claude follows a link.
Fully dynamic (skills)       — metadata only in context. Body loaded on trigger.

Workflow

Step 1: Ask

Ask the user: "What rule or convention do you want to add?"

Accept free text. If the user already provided it (e.g., /​agent-add-rule always use snake_case for database columns), skip this step.

Step 2: Analyze Current Structure

Read:

  • Root CLAUDE.md
  • List files in docs/​agents/
  • List available skills

Understand what already exists so you don't duplicate or contradict.

Step 3: Classify

Apply this decision tree:

Does the agent consistently get this wrong WITHOUT being told?
├── NO → Challenge: "Does this justify its token cost?"
│        If user still wants it → treat as semi-dynamic
│
├── YES → Does it apply to EVERY task?
│   ├── YES → Root CLAUDE.md (static)
│   │         Examples: package manager, multi-tenancy, project scripts
│   │
│   └── NO → docs/​agents/ file (semi-dynamic)
│             Examples: lint rules, test thresholds, API conventions
│
└── Is it a repeatable workflow or procedural knowledge?
    ├── YES → Skill (fully dynamic)
    │         Examples: deployment process, PR review checklist, migration procedure
    │
    └── NO → Probably not needed. Ask: "Does this justify its token cost?"

Key questions to ask the user:

  1. "Does the agent consistently get this wrong?" — If no, consider skipping
  2. "Does this apply to every task or just some?" — Static vs semi-dynamic
  3. "Is this a rule or a workflow?" — docs/​agents/ vs skill
  4. "Will this change frequently?" — Skills are easier to evolve independently

Step 4: Recommend

Present the recommended placement with reasoning:

Recommendation: Add to docs/​agents/​guardrails.md

Reasoning:
- This is a data handling rule, not a universal workflow rule
- It applies only when working with the database
- guardrails.md already covers data isolation patterns
- Adding to root would cost tokens on every conversation unnecessarily

Step 5: Confirm

Ask the user to confirm or override. If they override, respect their choice but note the trade-off:

  • Moving to root: "This adds ~X lines to every conversation's context"
  • Moving to docs/​agents/: "This won't be visible unless Claude follows the link"
  • Moving to skill: "This will only load when triggered by matching keywords"

Step 6: Write

Based on confirmed placement:

If root CLAUDE.md:

  • Add the rule under the appropriate section (Key Rules, Workflow, etc.)
  • Warn: "This adds to every conversation's token budget"
  • Keep it concise — 1-2 lines max

If existing docs/​agents/ file:

  • Read the target file
  • Add the rule under the appropriate section
  • Keep consistent formatting with existing content

If new docs/​agents/ file:

  • Create the file with a clear heading and the rule
  • Update root CLAUDE.md links section with a new entry including routing signal
  • Example: - [API Conventions](docs/​agents/​api-conventions.md) — REST patterns, error response format, pagination

If skill:

  • Tell the user to run /​agent-skill-creator to scaffold it
  • Provide the rule content as input for the skill body

Examples

Example 1: Universal Rule → Root

User: "Always use pnpm, never npm"

Classification: Agent gets this wrong without being told + applies to every task → Root

Action: Add to Key Rules section in CLAUDE.md

Example 2: Topic-Specific Rule → docs/​agents/

User: "API responses must always include a requestId field"

Classification: Agent might get wrong + only applies to API work → Semi-dynamic

Action: Add to docs/​agents/​guardrails.md or create docs/​agents/​api-conventions.md

Example 3: Complex Workflow → Skill

User: "When deploying, always run migrations first, then build, then deploy to staging, verify, then production"

Classification: Repeatable multi-step procedure → Fully dynamic (skill)

Action: Suggest /​agent-skill-creator to create a deployment skill

Example 4: Unnecessary Rule → Challenge

User: "Always use const instead of let"

Classification: ESLint already enforces this → Not needed

Response: "ESLint already enforces this via the prefer-const rule. Adding it to agent instructions would cost tokens without benefit. Skip?"

Principles

  • Challenge before adding: Every rule costs tokens. Ask "does this justify its token cost?"
  • No duplication: If ESLint, TypeScript, or another tool already enforces it, don't add it
  • Routing signals matter: When adding to docs/​agents/, update the root CLAUDE.md link description so Claude knows when to follow it
  • One level deep: Never cross-reference between docs/​agents/ files. All links go from root

More Productivity & Planning skills

brainstorming logo
Productivity & Planning

brainstorming

Structured design dialogue that validates ideas before implementation begins.

295.4K 385.7K
View
ui-ux-pro-max logo
Productivity & Planning

ui-ux-pro-max

Comprehensive design intelligence for web and mobile UI/UX across 10 technology stacks.

133.1K 383.9K
View
writing-plans logo
Productivity & Planning

writing-plans

Comprehensive implementation plans for multi-step tasks, breaking down specs into bite-sized, testable steps.

295.4K 268K
View
using-superpowers logo
Productivity & Planning

using-superpowers

Introduction to the obra skills system with mandatory skill invocation rules and best practices.

295.4K 259.8K
View
executing-plans logo
Productivity & Planning

executing-plans

Execute a written implementation plan with critical review and task checkpoints.

295.4K 229.1K
View
dispatching-parallel-agents logo
Productivity & Planning

dispatching-parallel-agents

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View
using-git-worktrees logo
Productivity & Planning

using-git-worktrees

Isolated git worktrees with smart directory selection and safety verification.

295.4K 205.2K
View
webapp-testing logo
Productivity & Planning

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

179.7K 170.6K
View
content-strategy logo
Productivity & Planning

content-strategy

Plan searchable and shareable content that drives traffic, builds authority, and generates leads.

53.3K 150.9K
View
repo-intake-and-plan logo
Productivity & Planning

repo-intake-and-plan

README-first repository scanner that extracts commands and classifies reproduction candidates without executing them.

497 139.6K
View
marketing-ideas logo
Productivity & Planning

marketing-ideas

Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.

53.3K 137.2K
View
site-architecture logo
Productivity & Planning

site-architecture

Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.

53.3K 112.8K
View

Productivity AI tools

Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View
SaveDay logo
Productivity

SaveDay

Capture, organize, and utilize your knowledge effortlessly.

Free
View
Any Summary logo
Productivity

Any Summary

Instant Summaries of Audio & Video Interviews with AnySummary

Freemium
View
M
Productivity

Map This

Transform PDFs into engaging mind maps.

Freemium
View
ChatPDF logo
Productivity

ChatPDF

Chat with any PDF instantly

Free
View
I
Productivity

intellisay

Create an optimal daily plan using your voice

Paid
View
A
Productivity

Aurora AI

A productivity platform to centralize organizational knowledge and workflows with contextual AI assistance.

Paid
View
AskYourPDF logo
Productivity

AskYourPDF

AskYourPDF Pricing Plans: Tailored to Your Needs

Free
View