rule-analyzer
Classifies every rule under docs/instructions/rules as deterministic, heuristic or unverifiable, embeds stable RL-hash markers, spots rules already enforced by existing tools and rule conflicts, and writes a draft rule-script-map.yml through src/rule-scripts/apply.ts. Use when the user asks to analyze rules, after several rule edits, or before generating rule scripts on a fresh project.
- License 许可
- MIT
- 所属仓库
- Eliyce/paqad-ai
- 最近更新
- 2026-11-13
- Stars
- ★ 8
- Forks
- 0
01 前言 Front Matter
- name
- rule-analyzer
- metadata
- { "cacheable": "false", "model_tier": "medium", "paqad-meta": "skill.meta.yaml", "output_format": "markdown" }
- description
- Classifies every rule under docs/instructions/rules as deterministic, heuristic or unverifiable, embeds stable RL-hash markers, spots rules already enforced by existing tools and rule conflicts, and writes a draft rule-script-map.yml through src/rule-scripts/apply.ts. Use when the user asks to analyze rules, after several rule edits, or before generating rule scripts on a fresh project.
02 资源文件 6
- 参考文档agents/openai.yaml327 B
- 参考文档references/classification-guide.md3.6 KB
- 脚本scripts/analyze.mjs479 B
- 脚本scripts/record-conflicts.mjs896 B
- 脚本scripts/write-map.mjs1.4 KB
- 参考文档skill.meta.yaml232 B
03 SKILL.md 正文
What It Does
Turns prose rules into a reviewable contract. For every bullet under docs/instructions/rules/** it:
- Embeds an opaque, stable
<!-- @rule RL-<hash> -->marker (idempotent: reruns cause no churn). - Classifies verifiability:
deterministic: a script can decide pass/fail (e.g. "no debugger statements").heuristic: a script can flag candidates; humans/LLM adjudicate (e.g. "business logic belongs in hooks").unverifiable: with a reason (e.g. "coherence is judgment-dependent").
- Records pre-existing enforcers in
enforced_byso no duplicate script is generated. - Detects contradictory rules and surfaces them via the Decision Pause Contract before any script work.
It writes a draft docs/instructions/rules/rule-script-map.yml. The user reviews this map before generate rule scripts.
Use This When
- A user prompt matches the priority-225 router rule
analyze rules. - After adding or editing several rules and you need to re-classify the rule set.
- Before
generate rule scriptson a fresh project: generation reads this map.
Inputs
- All markdown rule files under
docs/instructions/rules/**(the.ymlregistries are not prose rules and are skipped). - The project's existing enforcers, read to populate
enforced_by:eslint.config.js/.eslintrc.*,tsconfig.jsonstrictness flags, Prettier config, and existing paqad infra (module-health,design-test,pentest). - The prior
rule-script-map.ymlif present (script entries are carried over for unchanged rules).
Procedure
- Embed markers + collect the inventory:
Printsnode scripts/analyze.mjs [project-root]{ inventory, files, rule_files_hash, changed_files }. The script has already written the markers back into the rule files on disk. - Detect existing enforcers per rule. Read
eslint.config.js/.eslintrc.*,tsconfig.json, Prettier config. A rule covered by an existing enforcer getsenforced_by: ["eslint:no-debugger"]and no script, seereferences/classification-guide.md. - Classify each remaining rule
deterministic/heuristic/unverifiable. Usereferences/classification-guide.mdfor the decision rubric.unverifiablerequires areason. - Run the conflict pass. For any pair of contradictory rules (e.g. "always named exports" vs "components use default exports"), record them and surface a Decision Pause packet quoting both rules; await resolution before writing the map. Record conflicts into drift.json so the dashboard + planning gate see them:
wherenode scripts/record-conflicts.mjs <project-root> <conflicts.json>conflicts.jsonis[{ "rule_ids": ["RL-…","RL-…"], "message": "…" }, ...]. This emitsRS-CONFLICTfindings. - Write the draft map through the single writer:
wherenode scripts/write-map.mjs <project-root> <classifications.json>classifications.jsonis[{ "id", "verifiability": { "kind", "reason"? }, "enforced_by": [] }, ...]. - Present the
## Analysis Summaryblock and tell the user to review the map, then typegenerate rule scripts.
Output Contract
- Every rule bullet under
docs/instructions/rules/**carries an<!-- @rule RL-<hash> -->marker. docs/instructions/rules/rule-script-map.ymlwritten viasrc/rule-scripts/apply.tswith every rule classified andenforced_bypopulated.- A
## Analysis Summarymarkdown block: counts per verifiability kind, countenforced_by(no script needed), and any conflicts surfaced. - The exact next prompt for the user:
generate rule scripts.
Escalate / Stop Conditions
- Never write
rule-script-map.ymldirectly: all writes go throughnode scripts/write-map.mjs→src/rule-scripts/apply.ts. - Stop and surface a Decision Pause packet for every rule conflict before writing the map; do not silently pick a winner.
- If
docs/instructions/rules/is absent, stop: there are no rules to analyze. - Classify a rule
unverifiable(with reason) rather than inventing a brittle script for inherently fuzzy rules ("match repo conventions").
Resources
references/classification-guide.md: verifiability rubric + enforced-by detection.runtime/base/skills/rule-analyzer/agents/openai.yaml: agent interface metadata.src/rule-scripts/analyzer.ts: scan + embed + assemble engine.src/rule-scripts/apply.ts: atomic single writer ofrule-script-map.yml.- the Decision Pause Contract (in the framework bootstrap): packet semantics for conflicts.
04 同仓库更多 Skills
sample-skill
Sample bundled skill fixture
processing-invoices
Turns a supplier invoice into one ledger line. Use when a supplier invoice arrives and needs booking.
processing-invoices
Turns a supplier invoice into one ledger line. Use when a supplier invoice arrives and needs booking.
understand-idea
Chat and Claude Code: Step 1 of the discover journey: clarifies the goal, who benefits, success and constraints into the idea block. Use when the journey directs it to step 1, not directly.
size-work
Chat and Claude Code: Suggest a size for a ticket from comparable finished work, as a labelled suggestion the team still owns. Use it when someone asks "how big is this?", "roughly how much work is ABC-12?", or wants a backlog item sized. It finds the team's sizing scale at first use, picks two to five of the closest finished tickets with links, and gives a size or range with the drivers behind it and a confidence of low, medium or high, lowered and explained when the area's documents are template text. Every result is labelled a suggested size, never a date or a commitment. It writes nothing into the size field unless the user says "set it", and it refuses to overwrite an existing size unless the user asks to replace it. Produces the sizing block of the record.
refine-ticket
Chat and Claude Code: Improve one or more existing tracker tickets without losing the author's intent. Use it when someone wants a ticket read, diagnosed and tidied up ("this ticket is vague", "fix up ABC-12", "split this, it's too big"). It reads each ticket in full and snapshots it with its last-updated time, says what is wrong with evidence, and proposes a field-by-field before and after change set limited to summary, description, labels, parent, links and new child tickets on a split. It writes nothing until an explicit "apply it" bound to that exact change set, re-checks the ticket for conflicting edits just before writing, never replaces rich descriptions with plain text, never deletes or closes a ticket, and reads each ticket back after applying. Produces the existing and changes blocks of the record.