new-agent-rule
Skill1 starsChanged 5 months agoMITView on GitHub
Guide for creating a new path-scoped .claude/rules/ file with proper globs frontmatter and structure.
In this repository28 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .cursor/rules/agent.mdcCursor rule
- .cursor/rules/coding_style.mdcCursor rule
- .cursor/rules/commit_msg.mdcCursor rule
- .cursor/rules/common.mdcCursor rule
- .cursor/rules/deprecated.mdcCursor rule
- .cursor/rules/github_actions.mdcCursor rule
- .cursor/rules/langfuse.mdcCursor rule
- .cursor/rules/llm.mdcCursor rule
- .cursor/rules/long_run_code.mdcCursor rule
- .cursor/rules/makefile-commands.mdCursor rule
- .cursor/rules/package-management.mdCursor rule
- .cursor/rules/tests.mdcCursor rule
- .cursor/rules/typing.mdcCursor rule
- .cursor/rules/uv.mdcCursor rule
- frontend-design-principlesSkill
- goose-gui-e2eSkill
- local-sandboxSkill
- manage-agent-configSkill
- onboardingSkill
- push-releaseSkill
- cleanupSkill
- code-qualitySkill
- prek-precommit-hookSkill
- thermo-nuclear-code-quality-reviewSkill
- usageSkill
- waitSkill
- gmail-mcpSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Use globs: (NOT paths: -- it has known silent-failure bugs):
- Distinctive: line 39
Check if CLAUDE.md already covers this guidance (if so, migrate it to a rule)
- Very specific: line 40
Write .claude/rules/<name>.md with globs: frontmatter
- Very specific: line 41
Run make sync-agent-config then make ci
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Creating a new path-scoped rule
Rules keep CLAUDE.md lean by scoping guidance to specific file paths. A rule applies when the agent touches files matching its globs: pattern.
When to create a rule
- Guidance applies to a specific directory or file pattern, not the whole repo
- The guidance is long enough that embedding it in CLAUDE.md would bloat the file
- Multiple agents (or future tools) should pick up the same guidance automatically
Naming and location
- Source of truth:
.claude/rules/<name>.md - Name:
snake_case.mddescribing the area (e.g.,api_routes.md,test_conventions.md) - Mirror:
.agents/rules/<name>.md(symlink, created bymake sync-agent-config)
Frontmatter format
Use globs: (NOT paths: -- it has known silent-failure bugs):
---
description: One-line summary of what this rule covers
globs:
- "src/api/**"
- "tests/api/**"
---Pick the narrowest set of globs that covers the area. Overly broad globs waste context on unrelated tasks.
Workflow
- Check if CLAUDE.md already covers this guidance (if so, migrate it to a rule)
- Write
.claude/rules/<name>.mdwithglobs:frontmatter - Run
make sync-agent-configthenmake ci
Anti-patterns
- Forgetting
globs:frontmatter (rule loads on every task, defeating the purpose) - Restating what CLAUDE.md already says (keep rules additive, not duplicative)
- Using
paths:instead ofglobs:(known silent-failure bugs in Claude)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

