AGENT SKILL

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

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_by so 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 scripts on a fresh project: generation reads this map.

Inputs

  • All markdown rule files under docs/instructions/rules/** (the .yml registries are not prose rules and are skipped).
  • The project's existing enforcers, read to populate enforced_by: eslint.config.js / .eslintrc.*, tsconfig.json strictness flags, Prettier config, and existing paqad infra (module-health, design-test, pentest).
  • The prior rule-script-map.yml if present (script entries are carried over for unchanged rules).

Procedure

  1. Embed markers + collect the inventory:
    node scripts/analyze.mjs [project-root]
    
    Prints { inventory, files, rule_files_hash, changed_files }. The script has already written the markers back into the rule files on disk.
  2. Detect existing enforcers per rule. Read eslint.config.js/.eslintrc.*, tsconfig.json, Prettier config. A rule covered by an existing enforcer gets enforced_by: ["eslint:no-debugger"] and no script, see references/classification-guide.md.
  3. Classify each remaining rule deterministic / heuristic / unverifiable. Use references/classification-guide.md for the decision rubric. unverifiable requires a reason.
  4. 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:
    node scripts/record-conflicts.mjs <project-root> <conflicts.json>
    
    where conflicts.json is [{ "rule_ids": ["RL-…","RL-…"], "message": "…" }, ...]. This emits RS-CONFLICT findings.
  5. Write the draft map through the single writer:
    node scripts/write-map.mjs <project-root> <classifications.json>
    
    where classifications.json is [{ "id", "verifiability": { "kind", "reason"? }, "enforced_by": [] }, ...].
  6. Present the ## Analysis Summary block and tell the user to review the map, then type generate rule scripts.

Output Contract

  • Every rule bullet under docs/instructions/rules/** carries an <!-- @rule RL-<hash> --> marker.
  • docs/instructions/rules/rule-script-map.yml written via src/rule-scripts/apply.ts with every rule classified and enforced_by populated.
  • A ## Analysis Summary markdown block: counts per verifiability kind, count enforced_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.yml directly: all writes go through node 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 of rule-script-map.yml.
  • the Decision Pause Contract (in the framework bootstrap): packet semantics for conflicts.

04 同仓库更多 Skills

Eliyce
Eliyce/paqad-ai

sample-skill

Sample bundled skill fixture

★ 8
Eliyce
Eliyce/paqad-ai

processing-invoices

Turns a supplier invoice into one ledger line. Use when a supplier invoice arrives and needs booking.

★ 8
Eliyce
Eliyce/paqad-ai

processing-invoices

Turns a supplier invoice into one ledger line. Use when a supplier invoice arrives and needs booking.

★ 8
Eliyce
Eliyce/paqad-ai

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.

★ 8
Eliyce
Eliyce/paqad-ai

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.

★ 8
Eliyce
Eliyce/paqad-ai

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.

★ 8