speckit-opsmill-extract
Skill548 starsChanged 10 days agoApache-2.0View on GitHub
Extract knowledge, guidelines, and ADRs from one or more completed spec
In this repository54 other files it gives its agents.
- AGENTS.mdAGENTS.md
- backend/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- backend/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- analyzing-ci-flakinessSkill
- audit-docsSkill
- commitSkill
- creating-changelog-entriesSkill
- creating-issuesSkill
- creating-prdSkill
- grilling-ideasSkill
- harvesting-reviewSkill
- migrate-feature-pageSkill
- monitoring-pull-requestsSkill
- neo4j-cypher-guideSkill
- opsmill-dev-analyzing-bugsSkill
- opsmill-dev-fixing-bugsSkill
- opsmill-dev-test-driving-bugsSkill
- pre-ciSkill
- prSkill
- rebaseSkill
- reviewing-pull-requestsSkill
- speckit-agent-context-updateSkill
- speckit-analyzeSkill
- speckit-checklistSkill
- speckit-clarifySkill
- speckit-constitutionSkill
- speckit-convergeSkill
- speckit-critique-runSkill
- speckit-git-commitSkill
- speckit-git-featureSkill
- speckit-git-initializeSkill
- speckit-git-remoteSkill
- speckit-git-validateSkill
- speckit-implementSkill
- speckit-opsmill-autoSkill
- speckit-opsmill-implementSkill
- speckit-opsmill-prepSkill
- speckit-opsmill-retrospectSkill
- speckit-opsmill-summarySkill
- speckit-planSkill
- speckit-review-codeSkill
- speckit-review-commentsSkill
- speckit-review-errorsSkill
- speckit-review-runSkill
- speckit-review-simplifySkill
- speckit-review-testsSkill
- speckit-review-typesSkill
- speckit-specifySkill
- speckit-tasksSkill
- speckit-taskstoissuesSkill
- upgrading-infrastructure-dependenciesSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
31 rules. About 0 are common, 17 are distinctive, and 14 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈17
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
If it matches specs/NNN-* or NNN-*, resolve to REPO_ROOT/specs/NNN-*
- Very specific: line 36
If it is a bare name like graphql-name-lookup, search specs/ for a matching directory
- Distinctive: line 37
If no match found for an identifier, report it and continue resolving the rest
- Distinctive: line 38
If no identifiers could be resolved, list available spec directories and ask the user to pick
- Very specific: line 45
If EXTRACTED.md exists in the spec directory, warn the user that this spec was previously extracted
- Distinctive: line 47
Ask for confirmation before re-extracting — default is abort
- Distinctive: line 62
Read the first 20 lines of each knowledge and guidelines file to build a topic index (title + overview section)
- Very specific: line 68
All files in contracts/ (API changes — if exists)
- Distinctive: line 115
Only extract patterns that are prescriptive (should be followed in future code).
- Very specific: line 173
When processing a single spec, omit the per-spec grouping headers and use the simpler flat format (same as the multi-spec table structure …
- Distinctive: line 175
After presenting, tell the user:
- Distinctive: line 185
Wait for user response before proceeding.
- Very specific: line 193
Create new files in dev/adr/ using this format:
- Very specific: line 219
Numbering: Read existing files in dev/adr/ to find the highest existing ADR number.
- Distinctive: line 226
Read the full target file
- Distinctive: line 228
Add or update content within that section
- Distinctive: line 229
If the section does not exist, create it in a logical position
- Very specific: line 230
Add a source marker: <!-- Extracted from specs/<spec-name> on YYYY-MM-DD -->
- Distinctive: line 235
Read the full target file (or create a new one if needed)
- Distinctive: line 237
Add the prescriptive pattern with code examples where relevant
- Distinctive: line 240
If creating a new guidelines file, follow the standard structure:
- Very specific: line 257
Write EXTRACTED.md in each spec directory:
- Very specific: line 298
After all specs have been processed, update dev/README.md once with all new files:
- Very specific: line 299
If any new files were created in dev/knowledge/, dev/guidelines/, or dev/adr/:
- Distinctive: line 301
Add new entries to the appropriate section (Current Guidelines, Current Knowledge, or a new Current ADRs section)
- Very specific: line 302
Follow the existing link format: - filename.md - Brief description
- Very specific: line 303
If dev/adr/ now has content and there is no "Current ADRs" section in the README, create one following the pattern of the existing sections.
- Distinctive: line 343
If analysis finds nothing to extract (empty across all categories), report cleanly: "No extractable content found in this spec." and skip …
- Distinctive: line 344
If a knowledge file section already contains similar content, flag it for user review rather than duplicating
- Distinctive: line 345
Do not reformat or restructure existing content in knowledge/guidelines files beyond the specific additions
- Very specific: line 346
Always create specs/archive/ before moving if it does not exist
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
User Input
$ARGUMENTSYou MUST consider the user input before proceeding (if not empty).
Outline
Goal: Analyze one or more completed spec directories and extract durable knowledge into the project's documentation system (dev/knowledge/, dev/guidelines/, dev/adr/), then mark each spec as extracted.
This command accepts multiple specs as input (space-separated) and processes them sequentially. It operationalizes the documentation lifecycle: specs/ → knowledge/ or guidelines/ (see dev/guidelines/markdown.md).
Phase 0: Setup & Validation
<thinking>
First, resolve all spec directories from the user's arguments and validate each one contains the expected artifacts.
</thinking>- Parse arguments — split
$ARGUMENTSinto individual spec identifiers (space-separated). If$ARGUMENTSis empty, list available spec directories and ask the user to pick one or more. - Resolve each spec directory:
- For each identifier in the arguments:
- If it matches
specs/NNN-*orNNN-*, resolve toREPO_ROOT/specs/NNN-* - If it is a bare name like
graphql-name-lookup, searchspecs/for a matching directory - If no match found for an identifier, report it and continue resolving the rest
- If it matches
- If no identifiers could be resolved, list available spec directories and ask the user to pick
- For each identifier in the arguments:
- Validate each resolved spec:
spec.mdMUST exist — skip that spec with an error if missingresearch.mdSHOULD exist — warn if missing ("No ADRs can be extracted without research.md") but continue
- Check extraction status for each spec:
- If
EXTRACTED.mdexists in the spec directory, warn the user that this spec was previously extracted - Also check if the spec already lives under
specs/archive/— if so, it was previously extracted and archived - Ask for confirmation before re-extracting — default is abort
- The user can choose to skip individual specs from the batch
- If
- Summarize resolved specs — before proceeding, print the list of specs that will be processed:
Processing N spec(s): 1. specs/<spec-name-1> 2. specs/<spec-name-2> ... - Load existing documentation index (once, shared across all specs):
- List all files in
dev/knowledge/(recursively) - List all files in
dev/guidelines/(recursively) - List all files in
dev/adr/to determine the next ADR number - Read the first 20 lines of each knowledge and guidelines file to build a topic index (title + overview section)
- List all files in
- Load spec artifacts — for each spec, read all available files from its directory:
research.md(primary source for ADRs)spec.md(context, scope decisions)data-model.md(schema changes, new methods — if exists)- All files in
contracts/(API changes — if exists) plan.md(architectural context — if exists)
Phase 1: Analysis & Classification
<thinking>
For each spec, I need to parse each source and classify content into three buckets: ADR, Knowledge, Guideline. I should also identify content to skip with a clear reason. I'll process specs sequentially and tag each finding with its source spec.
</thinking>Repeat the following steps for each resolved spec directory. Tag every finding with the source spec name so the extraction plan in Phase 2 groups items by spec.
Step 1: Extract ADR candidates from research.md
Parse each ## R# section in research.md. For each entry:
- Extract: Decision, Rationale, Alternatives considered, Implementation pattern
- Determine if it is ADR-worthy using this heuristic:
- ADR-worthy: Affects system structure, API contracts, data models, error handling strategy, or establishes a pattern used across multiple components
- Not ADR-worthy: One-off implementation detail with no broader implications (e.g., a local variable naming choice, a single method signature)
- Draft an ADR title (concise, decision-focused — e.g., "Dual identifier resolution via service-layer helpers")
Also scan spec.md for scope decisions or trade-offs in the Clarifications or Assumptions sections that represent architectural choices worth recording.
Step 2: Extract knowledge candidates
Scan for content that describes how the system works after the feature:
| Source | What to look for | Target file |
data-model.md | New entities, fields, relationships, constraints | dev/knowledge/backend/data-models.md |
contracts/ | New or changed GraphQL queries, mutations, types | dev/knowledge/backend/api.md |
research.md | New service patterns, architectural patterns | dev/knowledge/backend/services.md or relevant file |
spec.md | New concepts or domain terminology | dev/knowledge/backend/overview.md or relevant file |
For each finding, map it to a specific existing knowledge file and section. If no existing file fits, propose a new file with a name following kebab-case.md convention.
Step 3: Extract guideline candidates
Scan research.md for implementation patterns that establish repeatable, prescriptive conventions for future code:
- New parameter patterns →
dev/guidelines/backend/python.mdordev/guidelines/cyclopts.md - New error handling conventions →
dev/guidelines/backend/exceptions.md - New API design conventions →
dev/guidelines/backend/graphql.md(create if needed) - New testing patterns → relevant guidelines file
These targets are routing examples, not a fixed map — content moves as files split, so confirm the section still lives in the named file before writing to it.
Only extract patterns that are prescriptive (should be followed in future code). Do NOT extract patterns that are merely descriptive of how this specific feature works — those belong in knowledge.
Step 4: Identify skipped content
For each piece of spec content not classified above, note it with a reason:
- Execution artifacts (
plan.md,quickstart.md) — no durable knowledge - Implementation details already captured in code — no need to duplicate
- One-off decisions with no broader applicability
Phase 2: Interactive Review
Present findings in a structured extraction plan. When processing multiple specs, group the plan by spec. Use a global numbering scheme across all specs so that item numbers are unique (e.g., spec 1 items are 1–4, spec 2 items are 5–8).
Use this format:
## Extraction Plan
### specs/<spec-name-1>
#### ADRs to Create (<count>)
| # | Source | Title | Target File |
|---|--------|-------|-------------|
| 1 | R1 | <title> | dev/adr/nnnn-<slug>.md |
| 2 | R2 | <title> | dev/adr/nnnn-<slug>.md |
#### Knowledge Updates (<count>)
| # | Target File | Section | Change | Summary |
|---|-------------|---------|--------|---------|
| 3 | dev/knowledge/backend/api.md | Queries | UPDATE | <what changes> |
#### Guidelines Updates (<count>)
| # | Target File | Section | Change | Summary |
|---|-------------|---------|--------|---------|
| 4 | dev/guidelines/backend/exceptions.md | Error Handling | UPDATE | <what changes> |
#### Skipped (with reasons)
| Source | Reason |
|--------|--------|
| plan.md | Execution artifact — no durable knowledge |
---
### specs/<spec-name-2>
#### ADRs to Create (<count>)
| # | Source | Title | Target File |
|---|--------|-------|-------------|
| 5 | R1 | <title> | dev/adr/nnnn-<slug>.md |
...When processing a single spec, omit the per-spec grouping headers and use the simpler flat format (same as the multi-spec table structure but without the ### specs/<name> wrapper).
After presenting, tell the user:
Actions:
approve all— proceed with all extractions across all specsapprove spec <name>— approve all items for a specific specapprove adrs/approve knowledge/approve guidelines— approve by category (across all specs)skip N— skip a specific numbered itemedit N— modify a specific item before writinggroup N,M— merge multiple ADR items into a single ADR
Wait for user response before proceeding. Do NOT write any files until the user approves.
Phase 3: Write Extractions
For each approved item across all specs, write the content. ADR numbering is sequential across all specs (i.e., if spec 1 creates 0005 and 0006, spec 2 starts at 0007).
ADRs
Create new files in dev/adr/ using this format:
# N. <Title>
**Status**: Accepted
**Date**: <today's date YYYY-MM-DD>
**Source**: specs/archive/<spec-name>/research.md (R#)
## Context
<What is the issue that motivates this decision? Derive from the feature context in spec.md and the specific problem the R# entry addresses.>
## Decision
<What was decided. Taken from the Decision field of the R# entry.>
## Consequences
<What becomes easier or harder as a result. Synthesize from the Rationale and any implementation notes.>
## Alternatives Considered
<What other options were evaluated and why they were rejected. Taken from the Alternatives considered field.>Numbering: Read existing files in dev/adr/ to find the highest existing ADR number. Start new ADRs at the next sequential number. Zero-pad the filename sequence to 4 digits (e.g., 0001, 0012); the H1 heading uses the un-padded number (e.g., # 1., # 12.).
File naming: canonical MADR nnnn-kebab-case-short-title.md — 4-digit zero-padded sequence, lowercase kebab title, no adr-/ADR- prefix (e.g., 0001-schema-changes-without-migrations.md).
Knowledge updates
For each knowledge update:
- Read the full target file
- Find the appropriate section (match by heading)
- Add or update content within that section
- If the section does not exist, create it in a logical position
- Add a source marker:
<!-- Extracted from specs/<spec-name> on YYYY-MM-DD -->
Guidelines updates
Same approach as knowledge updates:
- Read the full target file (or create a new one if needed)
- Find the appropriate section
- Add the prescriptive pattern with code examples where relevant
- Add a source marker:
<!-- Extracted from specs/<spec-name> on YYYY-MM-DD -->
If creating a new guidelines file, follow the standard structure:
# <Topic> Guidelines
## Overview
<Brief description of what this document covers.>
## <Sections...>Phase 4: Cleanup & Report
Perform the following steps for each spec that had approved extractions.
1. Create extraction record
Write EXTRACTED.md in each spec directory:
# Extraction Record
**Extracted on**: <YYYY-MM-DD>
**Extracted by**: speckit.opsmill.extract
## ADRs Created
- <path to ADR file> (from R#)
- ...
## Knowledge Updated
- <path to knowledge file> (<section name>)
- ...
## Guidelines Updated
- <path to guidelines file> (<section name>)
- ...
## Archive
Spec directory moved to `specs/archive/<spec-name>/` as a historical record.2. Update spec status and archive
For each spec:
- In
spec.md, update or add the status field to:**Status**: Extracted - Move the entire spec directory into
specs/archive/:
This makes it immediately clear which specs have been processed and which are still active.mkdir -p specs/archive mv specs/<spec-name> specs/archive/<spec-name>
3. Update dev/README.md
After all specs have been processed, update dev/README.md once with all new files:
- If any new files were created in
dev/knowledge/,dev/guidelines/, ordev/adr/:- Read
dev/README.md - Add new entries to the appropriate section (Current Guidelines, Current Knowledge, or a new Current ADRs section)
- Follow the existing link format:
- [filename.md](path/to/filename.md) - Brief description
- Read
- If
dev/adr/now has content and there is no "Current ADRs" section in the README, create one following the pattern of the existing sections.
4. Report
Print a combined summary covering all processed specs:
## Extraction Complete
**Date**: YYYY-MM-DD
**Specs processed**: N
### Per-Spec Summary
| Spec | ADRs | Knowledge | Guidelines | Status |
|------|------|-----------|------------|--------|
| specs/<spec-name-1> | N | N | N | archived |
| specs/<spec-name-2> | N | N | N | archived |
### Totals
- N ADR(s) created in dev/adr/
- N knowledge file(s) updated
- N guideline file(s) updated
### Archived
- specs/<spec-name-1> → specs/archive/<spec-name-1>
- specs/<spec-name-2> → specs/archive/<spec-name-2>
### Files Created/Modified
- <list each file path>
### Next Steps
- Review the created ADRs for accuracy
- Verify knowledge and guideline updates read well in contextBehavior Rules
- Never write files without user approval in Phase 2
- If analysis finds nothing to extract (empty across all categories), report cleanly: "No extractable content found in this spec." and skip the review phase
- If a knowledge file section already contains similar content, flag it for user review rather than duplicating
- Do not reformat or restructure existing content in knowledge/guidelines files beyond the specific additions
- Always create
specs/archive/before moving if it does not exist - ADR
Sourcepaths must reference the archive location (specs/archive/<spec-name>/) since the spec will be moved there - For single quotes in bash args, use escape syntax: e.g.
'I'\''m Groot'(or double-quote if possible:"I'm Groot")
Does 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.

