Pattern Extract
Skill name: pattern-extract
Extract structured pattern-review rule proposals from instruction prose. Use to bootstrap or refresh .pattern-review/proposals.yaml from AGENTS.md, CLAUDE.md, .cursor/rules, or similar repo/client guidance without changing active rules.
Use this to convert human-readable instruction prose into candidate pattern-review rules. This command is batch-oriented and non-interactive.
Workflow:
- Identify applicable instruction files by walking from the target repo or changed files upward:
AGENTS.md,CLAUDE.md,.cursor/rules, and similar local guidance. - Fail if no applicable
.pattern-reviewdirectory is found after the normal scope walk. Tell the caller to run/pattern-init <intended-scope>. - Display the
.pattern-reviewdirectory that will receive proposals before writing anything. - Extract only review-critical patterns: conventions that should be checked before human review, especially repeated failure classes or high-risk local rules.
- Write candidates to the nearest appropriate
.pattern-review/proposals.yaml. Do not modifyrules.yaml. - Prefer proposal objects with:
type: new_ruleortype: modify_ruleid,title,description,rationalescopetriggerwith modepath,diff,agentic, oralwaysseverityreviewwith modeagentic,manual,mechanical, orchecklistevidenceandprovenanceexamplesandexceptionswhen available- Use structured source locations in evidence and provenance:
evidence.instructionFilesshould contain objects withpathrelative to the.pattern-reviewscope root and, when known,line, such as{ path: "AGENTS.md", line: 12 }.- Include
sourceTextfor literal source evidence when practical. Do not summarize or ellipsize source text by default. Use deterministic boundaries: a full bullet line, full paragraph, or directly relevant fenced block. If a section is too large to include fully, storelineplussourceBoundary: sectionand explain that the section continues rather than truncating silently. provenance.targetshould be an object withpathfor concrete repo or folder targets, usually{ path: "." }for the initialized scope.- Avoid machine-specific absolute paths unless the source is outside any portable checkout context.
- Do not put Markdown links in YAML. Reports and chat can render clickable links from
pathandline. - Preserve example usefulness:
- When examples are available or can be reasonably derived from the source guidance, write complete, concrete good and bad examples.
- Do not truncate, ellipsize, or reduce examples to fragments. A useful example should be a complete sentence or compact mini-scenario that shows the rule being satisfied or violated.
- Prefer source-grounded examples over generic placeholders. If the source does not support a concrete example, omit
examplesrather than inventing vague filler. - Keep active rules clean. Promotion to
rules.yamlhappens only throughpattern-promote. - If a candidate resembles an existing active, proposed, deferred, or rejected rule, update or reference that lifecycle item instead of blindly adding a duplicate.
- Normalize lifecycle YAML after writing:
python3 /Users/trent.brown/agentic-development-workflow/scripts/pattern_tool.py normalize-buckets <pattern-dir>. - Parse the normalized
proposals.yamlbefore reporting success. Treat parse failures as command failures.