بنقرة واحدة
implement-rule
Implement checks, patterns, and fixtures for an existing recommended rule skeleton
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Implement checks, patterns, and fixtures for an existing recommended rule skeleton
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | implement-rule |
| description | Implement checks, patterns, and fixtures for an existing recommended rule skeleton |
Implement checks, OpenGrep patterns, and test fixtures for an existing recommended rule that has a skeleton but empty checks: [].
/implement-rule <coordinate> [--agent <name>] [--dry-run]
<coordinate>: Rule coordinate (e.g., RRAILS:C:0008, RRAILS_CLAUDE:S:0002)--agent <name>: Agent for template var resolution (default: claude)--dry-run: Show what would be generated without writing files/implement-rule RRAILS:C:0001
/implement-rule RRAILS_CLAUDE:S:0001 --agent claude
/implement-rule RRAILS:E:0002 --dry-run
Resolve rule directory from coordinate:
registry/coordinate-map.ymlcore/{category}/{slug}/agents/{agent}/rules/{slug}/Parse rule.md frontmatter and body:
id, type, level, targets, question, criteria, Pass/Fail examples from bodychecks: is already non-empty — rule is already implementedFollow the same pattern design principles as rules/ (core):
| Field | Design role |
|---|---|
title | Names the concern |
question | Defines the evaluation question |
criteria | Lists observable properties of a PASSING file — invert for violations |
| Pass example | Structural pattern that makes it good |
| Fail example | Structural pattern that makes it bad |
Think in terms of violation structure, not fixture discrimination.
args from rule descriptionnegate: true only when no structural signature exists{{instruction_files}} in pathsWrite checks: array in rule.md frontmatter:
{RULE_ID}:check:{SLOT} formatFor deterministic/semantic rules, write OpenGrep rules in rule.yml.
For mechanical-only rules: leave rule.yml as rules: [].
Fixtures simulate REAL instruction files (30-80 lines).
Pass fixture (tests/pass/): Realistic file satisfying the rule.
Fail fixture (tests/fail/): Realistic file with one specific violation.
Remove .gitkeep from directories that now have real fixture content.
Run the test harness from the rules/ runtime:
docker compose -f ../rules/runtime/docker-compose.yml run test --package /recommended --rule <coordinate>
This package depends on rules/ (core) for:
../rules/runtime/ — test runner, checks.py, Docker harness../rules/agents/{agent}/config.yml — template variable resolution../rules/schemas/rule.schema.yml — check field definitions../rules/schemas/rule.schema.yml../rules/docs/opengrep-guide.md../rules/runtime/../rules/agents/{agent}/config.ymlregistry/coordinate-map.yml| rule.md severity | rule.yml severity |
|---|---|
| critical | ERROR |
| high | WARNING |
| medium | WARNING |
| low | WARNING |