enforce-rules-format — Claude Code skill: validate rules
Checks whether project rules use the right enforcement class and suggests fixes. It fits projects that manage instructions with Vigiles.
npx skills add zernie/vigiles --skill enforce-rules-format -a claude-codeWhat enforce-rules-format does
The skill identifies the project format from its instruction files. A CLAUDE.md.spec.ts or another *.spec.ts file marks a v2 setup, where rules use enforce(), check(), or guidance(). Without a spec file, it inspects v1 files such as CLAUDE.md, AGENTS.md, and .cursorrules for required annotations.
For v2, it runs npx vigiles compile and npx vigiles discover, checks whether enforcement entries match real linter rules, and flags checks that could move into the linter. For v1, it scans ### headings and reports sections missing an enforcement marker.
The skill asks for approval before editing files. It then suggests either a linter-backed rule or guidance-only treatment, depending on what the project supports. Final validation uses npx vigiles check; v2 projects also run npx vigiles compile.
What it helps with
- audit rule classifications in spec files
- find v1 rules that lack annotations
- match
enforce()calls to linter rules - spot checks that a linter could handle
- validate the result with
npx vigiles check
Example prompts for the agent
- Run the
enforce-rules-formatskill against this project. - Inspect
CLAUDE.md.spec.ts,CLAUDE.md, and.cursorrules, then report classification issues. - Find rules that map to the linter and ask for my approval before editing files.
How to install enforce-rules-format
1Skills CLI (Vercel)
npx skills add zernie/vigiles --skill enforce-rules-format -a claude-code2Manually: put the files in place
~/.claude/skills/enforce-rules-format/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/enforce-rules-format/
1Skills CLI (Vercel)
npx skills add zernie/vigiles --skill enforce-rules-format -a codex2Manually: put the files in place
.agents/skills/enforce-rules-format/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add zernie/vigiles --skill enforce-rules-format -a cursor2Manually: put the files in place
.cursor/skills/enforce-rules-format/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install zernie/vigiles enforce-rules-format2Manually: put the files in place
.github/skills/enforce-rules-format/SKILL.md1Skills CLI (Vercel)
npx skills add zernie/vigiles --skill enforce-rules-format -a gemini-cli2Platform CLI
gemini skills install https://github.com/zernie/vigiles --path .claude/skills/enforce-rules-formatManually: put the files in place
.devin/skills/enforce-rules-format/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add zernie/vigiles --skill enforce-rules-format -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about enforce-rules-format
How do I install enforce-rules-format in Claude Code?
Run npx skills add zernie/vigiles --skill enforce-rules-format -a claude-code, then check ~/.claude/skills/enforce-rules-format/SKILL.md.
What does enforce-rules-format do?
It audits rule classifications in v1 and v2 projects, compares enforcement entries with linter rules, and proposes changes after asking for approval.
How does it distinguish v1 from v2 projects?
A CLAUDE.md.spec.ts or another *.spec.ts file selects the v2 checks for enforce(), check(), and guidance(). Otherwise, the skill reviews v1 annotations such as **Enforced by:**, **Guidance only**, and <!-- vigiles-disable -->.
Source text
SKILL.md · MIT
---
name: enforce-rules-format
description: Validate that all rules have proper enforcement classification (enforce/check/guidance)
disable-model-invocation: true
---
Validate that every rule in the project's instruction files has a proper enforcement classification, and fix any that are missing.
## Instructions
### Step 1: Detect Format
Check which format the project uses:
**v2 (spec-based):** Look for `CLAUDE.md.spec.ts` or any `*.spec.ts` files. If found, this is a v2 project — rules must use `enforce()`, `check()`, or `guidance()`.
**v1 (hand-written):** Look for `CLAUDE.md`, `AGENTS.md`, `.cursorrules`. If found without a spec file, this is a v1 project — rules need `**Enforced by:**` or `**Guidance only**` annotations.
### Step 2: Validate
**For v2 specs:**
The TypeScript type system already prevents unannotated rules — you can't create a rule without calling `enforce()`, `check()`, or `guidance()`. So focus on:
1. Do `enforce()` rules reference real linter rules? Run `npx vigiles compile` to check.
2. Are there guidance rules that COULD be `enforce()`? Check linter configs for matching rules.
3. Are there `check()` assertions that could be delegated to a linter? Suggest `enforce()` instead.
```bash
npx vigiles compile
npx vigiles discover
```
**For v1 hand-written files:**
Scan for `###` headings. Each must have one of:
- `**Enforced by:** \`linter/rule-name\``
- `**Guidance only** — reason`
- `<!-- vigiles-disable -->`
Report missing annotations with a summary table.
### Step 3: Fix Issues
For each issue found:
1. Check the project's linter configuration for matching rules
2. Suggest `enforce("linter/rule")` (v2) or `**Enforced by:** \`linter/rule\`` (v1)
3. If no linter rule exists, suggest `guidance()` (v2) or `**Guidance only**` (v1)
4. **Ask the user** before making changes
### Step 4: Suggest Migration
If the project uses v1 format, suggest migrating to v2 specs for type safety:
> Your rules could benefit from type-safe specs. Run the `adopt-spec` skill to convert your CLAUDE.md to a typed .spec.ts file.
### Step 5: Verify
Run the appropriate command:
```bash
# v2
npx vigiles compile && npx vigiles check
# validate
npx vigiles check
```
Report the validation result.
© zernie · MIT · zernie/vigiles