/rules-builder:rules-builderfrom rules-builder
Use when the user wants to create, edit, list, or manage Claude Code rules in .claude/rules/. Provides guided elicitation to configure path-specific rules with proper YAML frontmatter and glob patterns. Can list all available rules from user-level and project directories.
Ships in rules-builder. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Interactive skill for creating and managing Claude Code modular rules using guided elicitation with AskUserQuestion.
.claude/rules/Use AskUserQuestion throughout the workflow to guide the user through all available options. Present relevant choices based on context and let the user shape the rule configuration step by step.
| Scope | Description |
|---|---|
| Global | Applies to all files in the project (no paths frontmatter) |
| Path-specific | Only applies to files matching glob patterns |
| Location | Path | Applies To |
|---|---|---|
| User-level | ~/.claude/rules/ | All your projects (personal preferences) |
| Project root | .claude/rules/ | Current project only |
| Subdirectory | .claude/rules/frontend/ | Current project, organized by domain |
| Subdirectory | .claude/rules/backend/ | Current project, organized by domain |
Priority: User-level rules load first, project rules load after and can override.
| Pattern | Matches |
|---|---|
**/*.ts | All TypeScript files |
**/*.{ts,tsx} | TypeScript and React files |
src/**/* | All files under src/ |
src/api/**/*.ts | API files only |
**/*.{test,spec}.ts | Test files only |
*.config.{js,ts,json} | Config files in root |
{src,lib}/**/*.ts | Multiple directories |
See ${CLAUDE_PLUGIN_ROOT}/skills/rules-builder/references/glob-patterns.md for complete reference.
Common categories to organize rules:
Valid YAML frontmatter fields:
---
paths: "src/**/*.ts" # Glob pattern(s) - string or array
description: "API rules" # Optional description (max 200 chars)
priority: 75 # Optional priority 0-100 (default 50)
enabled: true # Optional enable/disable (default true)
---
Validate against schema: ${CLAUDE_PLUGIN_ROOT}/skills/rules-builder/schemas/rule-frontmatter.schema.json
| Operation | Description |
|---|---|
| Create | New rule file with guided configuration |
| Edit | Modify existing rule (scope, content, frontmatter) |
| Delete | Remove a rule file |
| List | Show all rules in project or user directory |
| Validate | Check frontmatter against schema |
| Move | Change rule location (project ↔ user-level) |
AskUserQuestion to gather:
Personal rules in ~/.claude/rules/ apply to all projects:
~/.claude/rules/
├── preferences.md # Personal coding preferences
├── workflows.md # Preferred workflows
└── shortcuts.md # Personal shortcuts
Use cases:
.claude/rules/
├── frontend/
│ ├── react.md
│ └── styles.md
├── backend/
│ ├── api.md
│ └── database.md
└── general.md
---
paths: src/api/**/*.ts
---
# API Rules
ln -s ~/shared-rules .claude/rules/shared
ln -s ~/company-standards/security.md .claude/rules/security.md
code-style.md not rules1.mdTo show all available rules from both user-level and project directories:
python3 ${CLAUDE_PLUGIN_ROOT}/skills/rules-builder/scripts/list_rules.py [project_path]
Examples:
# List rules for current directory
python3 ${CLAUDE_PLUGIN_ROOT}/skills/rules-builder/scripts/list_rules.py
# List rules for specific project
python3 ${CLAUDE_PLUGIN_ROOT}/skills/rules-builder/scripts/list_rules.py /path/to/project
Output includes:
~/.claude/rules/<project>/.claude/rules/Before saving, validate frontmatter against the JSON schema:
| Field | Type | Constraints |
|---|---|---|
paths | string or string[] | Valid glob pattern(s) |
description | string | Max 200 characters |
priority | integer | 0-100, default 50 |
enabled | boolean | default true |
${CLAUDE_PLUGIN_ROOT}/skills/rules-builder/references/glob-patterns.md${CLAUDE_PLUGIN_ROOT}/skills/rules-builder/schemas/rule-frontmatter.schema.json${CLAUDE_PLUGIN_ROOT}/skills/rules-builder/scripts/list_rules.py${CLAUDE_PLUGIN_ROOT}/skills/rules-builder/scripts/validate_frontmatter.pyCreate API-specific rules
User: "I want rules for my API endpoints"
-> Elicit scope, patterns, location, category
-> Create .claude/rules/api.md with paths: src/api/**/*.ts
Edit existing rule scope
User: "Update testing rules to include integration tests"
-> List rules, elicit selection
-> Show current config, elicit changes
-> Update paths to **/*.{test,spec,integration}.ts
Create personal preferences
User: "Add my coding preferences for all projects"
-> Elicit location (user-level)
-> Create ~/.claude/rules/preferences.md
Organize by domain
User: "Organize my frontend rules"
-> Elicit subdirectory structure
-> Create .claude/rules/frontend/ with react.md, styles.md
List all rules
User: "Show me all my rules"
-> Run list_rules.py script
-> Display user-level and project rules with metadata
-> Offer to edit, delete, or create new rules
references/glob-patterns.md (opens in a new tab)schemas/rule-frontmatter.schema.json (opens in a new tab)scripts/list_rules.py (opens in a new tab)scripts/validate_frontmatter.py (opens in a new tab)tests/fixtures/invalid/invalid-values/description-too-long.md (opens in a new tab)tests/fixtures/invalid/invalid-values/priority-negative.md (opens in a new tab)tests/fixtures/invalid/invalid-values/priority-too-high.md (opens in a new tab)tests/fixtures/invalid/malformed-yaml/bad-indentation.md (opens in a new tab)tests/fixtures/invalid/malformed-yaml/unclosed-quote.md (opens in a new tab)tests/fixtures/invalid/unknown-fields/extra-field.md (opens in a new tab)tests/fixtures/invalid/unknown-fields/multiple-unknown.md (opens in a new tab)tests/fixtures/invalid/wrong-types/description-number.md (opens in a new tab)tests/fixtures/invalid/wrong-types/enabled-string.md (opens in a new tab)tests/fixtures/invalid/wrong-types/paths-number.md (opens in a new tab)tests/fixtures/invalid/wrong-types/paths-object.md (opens in a new tab)tests/fixtures/invalid/wrong-types/priority-string.md (opens in a new tab)tests/fixtures/valid/all-fields/complete.md (opens in a new tab)tests/fixtures/valid/global/empty-frontmatter.md (opens in a new tab)tests/fixtures/valid/global/no-frontmatter.md (opens in a new tab)tests/fixtures/valid/optional-fields/disabled.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Generated from the plugin's indexed repository (rafaelcalleja/claude-market-place) — no native marketplace selected
npx claudepluginhub p/rafaelcalleja-rules-builder-plugins-rules-builder