agentleFS
Miyamura80Miyamura80/MCP-Template/.agents/skills/new-agent-rule/SKILL.md

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.

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
  1. Very specific:

    Use globs: (NOT paths: -- it has known silent-failure bugs):

    line 24
  2. Distinctive:

    Check if CLAUDE.md already covers this guidance (if so, migrate it to a rule)

    line 39
  3. Very specific:

    Write .claude/rules/<name>.md with globs: frontmatter

    line 40
  4. Very specific:

    Run make sync-agent-config then make ci

    line 41

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.md describing the area (e.g., api_routes.md, test_conventions.md)
  • Mirror: .agents/rules/<name>.md (symlink, created by make 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

  1. Check if CLAUDE.md already covers this guidance (if so, migrate it to a rule)
  2. Write .claude/rules/<name>.md with globs: frontmatter
  3. Run make sync-agent-config then make 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 of globs: (known silent-failure bugs in Claude)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.