new-rule
Skill2 starsChanged 8 months agoApache-2.0View on GitHub
Scaffold a new VGuard rule with source file, test, and preset registration. Use when the user says "create a rule", "add a new rule", "scaffold rule", or wants to implement a new guardrail check.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- SonarSource/sonar-javatheir own version, first seen Oct 17, 2026
- SonarSource/SonarJStheir own version, first seen Oct 8, 2026
- jajupmochi/agent-harnesstheir own version, first seen Jul 10, 2026
- TheLatentSpaceLab/Qubitotheir own version, first seen Apr 1, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- SonarSource/SonarJS★ 1.3ksame name
- SonarSource/sonar-java★ 1.2ksame name
- jajupmochi/agent-harness★ 1same name
- TheLatentSpaceLab/Qubito★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- new-adapterSkill
- new-presetSkill
- releaseSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 4 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Ask the user for these if not provided:
- Very specific: line 33
Use the template at .claude/skills/new-rule/templates/rule.ts.
- Very specific: line 36
Use editCheck: true if the rule applies to Write events (auto-generates Edit variant)
- Very specific: line 37
Follow fail-open: wrap in try/catch, return { status: 'pass' } on error
- Very specific: line 49
Use the template at .claude/skills/new-rule/templates/rule.test.ts.
- Distinctive: line 50
Test for the pass case (rule allows valid input)
- Distinctive: line 51
Test for the block/warn case (rule catches violations)
- Distinctive: line 52
Test for edge cases (empty input, missing fields)
- Very specific: line 53
Test that internal errors return { status: 'pass' } (fail-open)
- Very specific: line 57
If the rule is relevant to a specific preset (e.g., a Next.js-specific rule), add it to the preset's rules object in …
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create New VGuard Rule: $ARGUMENTS
Generate a complete VGuard rule following project conventions.
What This Skill Creates
- Rule file at
src/rules/<category>/<rule-name>.ts - Test file at
tests/rules/<category>/<rule-name>.test.ts - Registration in
src/rules/<category>/index.ts - Preset entry (optional) in relevant preset files
Required Information
Ask the user for these if not provided:
- Category:
security,quality, orworkflow - Rule name: kebab-case identifier (e.g.,
no-hardcoded-urls) - Description: What this rule prevents and why
- Severity:
block(prevents operation),warn(allows but warns),info(informational) - Events:
PreToolUse,PostToolUse,Stop, or a combination - Tools: Which tools to match (e.g.,
Edit,Write,Bash,Read) - File patterns (optional): Globs to match (e.g.,
*.ts,*.sql)
Implementation Steps
1. Create Rule File
Use the template at .claude/skills/new-rule/templates/rule.ts. Key requirements:
- Export a
Ruleobject satisfying the interface insrc/types.ts - The
check()function receivesHookContextand returnsRuleResult - Use
editCheck: trueif the rule applies to Write events (auto-generates Edit variant) - Follow fail-open: wrap in try/catch, return
{ status: 'pass' }on error
2. Register the Rule
In src/rules/<category>/index.ts, add:
import { <ruleName> } from './<rule-name>.js';
registerRules([<ruleName>]);3. Create Test File
Use the template at .claude/skills/new-rule/templates/rule.test.ts. Must include:
- Test for the pass case (rule allows valid input)
- Test for the block/warn case (rule catches violations)
- Test for edge cases (empty input, missing fields)
- Test that internal errors return
{ status: 'pass' }(fail-open)
4. Add to Presets (Optional)
If the rule is relevant to a specific preset (e.g., a Next.js-specific rule), add it to the preset's rules object in src/presets/<preset>.ts.
5. Verify
npm run type-check
npm test -- --reporter verbose tests/rules/<category>/<rule-name>.test.ts
npm testDoes 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.

