/guardrails:rules [optional focus area, e.g. 'frontend' or 'backend']from guardrails
Generate path-scoped .claude/rules/*.md for the current project by scanning its codebase — evidence-based, minimal, nothing installed without justification. Use when the user asks to "generate rules", "set up coding rules", "run guardrails rules", "/guardrails:rules", or wants project conventions (testing, error handling, database, frontend, security) distilled into rules Claude loads automatically when editing matching files. Best run on a live/mature project where conventions have settled. Re-runs do a gap analysis, never clobber.
Ships in guardrails. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generate path-scoped rules for this project: .claude/rules/*.md files whose frontmatter paths: globs make Claude load each rule only when editing matching files. One governing principle, inherited from dotclaude: write nothing without evidence. Every rule file must be justified by something actually found in the codebase. When in doubt, leave it out.
Scope boundaries (hard): this skill writes ONLY .claude/rules/*.md. It never touches CLAUDE.md, ARCHITECTURE.md, .claude/settings.json, .planning/, docs/features/, hooks, agents, or skills. The safety hooks ship with the guardrails plugin itself and are already active — do not install per-project copies.
Build a small evidence table. Read real code, not just manifests:
package.json, pyproject.toml, go.mod, Cargo.toml, …) and CI workflows. Record the actual test/lint/build commands.paths: globs — record actual paths, never assume src/.prisma/, supabase/migrations/, alembic/, …)..claude/rules/, CLAUDE.md, .cursorrules — content to respect and cross-reference, never to duplicate or clobber.If $ARGUMENTS names a focus area, weight the scan toward it. If the project has no source code yet, say so and stop — rules distilled from nothing are noise.
Present a compact findings summary (stack, test runner, layout, conventions observed, which rule files the evidence justifies). Then ask:
Justification mapping (no exceptions without user override):
| Rule file | Write only if |
|---|---|
code-quality.md | Always justified (universal) |
testing.md | A test suite actually exists |
error-handling.md | Backend/API surfaces exist |
security.md | Backend/API surfaces or auth code exist |
database.md | Migrations or ORM detected |
frontend.md | Frontend component files exist |
For each selected rule file, start from the matching template in references/ and customize it to the evidence — replace generic advice with this project's actual conventions, commands, and directory names. Delete template lines that don't apply. Add project-specific lines the scan surfaced (e.g. "all Supabase access goes through lib/db/, never raw clients in routes").
Prepend frontmatter with real path globs from Phase 1 (omit paths: only for code-quality.md, which applies everywhere):
---
paths:
- "app/**/*.ts"
- "lib/**/*.ts"
---
Keep each file under ~30 lines. Rules are context loaded on every matching edit — every line costs tokens forever. A rule that restates what any senior engineer does by default is noise; keep only what is specific to this project or repeatedly violated by default behavior.
If .claude/rules/ already has files: diff reality against them. Propose additions for new evidence, flag rules whose paths: no longer match anything (stale), and show every change before applying. Never rewrite a user-customized rule without showing the diff first.
List the files written with their paths: scope, one line each. Remind: rules load automatically when Claude edits matching files — no further wiring needed.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub andrydeen/deen-system --plugin guardrails