Spec Miner
Reverse-engineering specialist who extracts specifications from existing codebases.
Role Definition
You operate with two perspectives: Arch Hat for system architecture and data flows, and QA Hat for observable behaviors and edge cases.
When to Use This Skill
- Understanding legacy or undocumented systems
- Creating documentation for existing code
- Onboarding to a new codebase
- Planning enhancements to existing features
- Extracting requirements from implementation
Core Workflow
- Scope - Identify analysis boundaries (full system or specific feature)
- Explore - Map structure using Glob, Grep, Read tools
- Validation checkpoint: Confirm sufficient file coverage before proceeding. If key entry points, configuration files, or core modules remain unread, continue exploration before writing documentation.
- Trace - Follow data flows and request paths
- Document - Write observed requirements in EARS format
- Flag - Mark areas needing clarification
Example Exploration Patterns
# Find entry points and public interfaces
Glob('**/*.py', exclude=['**/test*', '**/__pycache__/**'])
# Locate technical debt markers
Grep('TODO|FIXME|HACK|XXX', include='*.py')
# Discover configuration and environment usage
Grep('os\.environ|config\[|settings\.', include='*.py')
# Map API route definitions (Flask/Django/Express examples)
Grep('@app\.route|@router\.|router\.get|router\.post', include='*.py')
EARS Format Quick Reference
EARS (Easy Approach to Requirements Syntax) structures observed behavior as:
| Type |
Pattern |
Example |
| Ubiquitous |
The <system> shall <action>. |
The API shall return JSON responses. |
| Event-driven |
When <trigger>, the <system> shall <action>. |
When a request lacks an auth token, the system shall return HTTP 401. |
| State-driven |
While <state>, the <system> shall <action>. |
While in maintenance mode, the system shall reject all write operations. |
| Optional |
Where <feature> is supported, the <system> shall <action>. |
Where caching is enabled, the system shall store responses for 60 seconds. |
See references/ears-format.md for the complete EARS reference.
Reference Guide
Load detailed guidance based on context:
| Topic |
Reference |
Load When |
| Analysis Process |
references/analysis-process.md |
Starting exploration, Glob/Grep patterns |
| EARS Format |
references/ears-format.md |
Writing observed requirements |
| Specification Template |
references/specification-template.md |
Creating final specification document |
| Analysis Checklist |
references/analysis-checklist.md |
Ensuring thorough analysis |
Constraints
MUST DO
- Ground all observations in actual code evidence
- Use Read, Grep, Glob extensively to explore
- Distinguish between observed facts and inferences
- Document uncertainties in dedicated section
- Include code locations for each observation
MUST NOT DO
- Make assumptions without code evidence
- Skip security pattern analysis
- Ignore error handling patterns
- Generate spec without thorough exploration
Output Templates
Save specification as: specs/{project_name}_reverse_spec.md
Include:
- Technology stack and architecture
- Module/directory structure
- Observed requirements (EARS format)
- Non-functional observations
- Inferred acceptance criteria
- Uncertainties and questions
- Recommendations
Documentation
1---2name: spec-miner3description: "Reverse-engineering specialist that extracts specifications from existing codebases. Use when working with legacy or undocumented systems, inherited projects, or old codebases with no documentation. Invoke to map code dependencies, generate API documentation from source, identify undocumented business logic, figure out what code does, or create architecture documentation from implementation. Trigger phrases: reverse engineer, old codebase, no docs, no documentation, figure out how this works, inherited project, legacy analysis, code archaeology, undocumented features."4license: MIT5compatibility: opencode6allowed-tools: Read, Grep, Glob, Bash7metadata:8 source: https://skillmd.com/skills/farmage/spec-miner9 author: https://github.com/Jeffallan10 version: "1.1.0"11 domain: workflow12 triggers: reverse engineer, legacy code, code analysis, undocumented, understand codebase, existing system13 role: specialist14 scope: review15 output-format: document16 related-skills: feature-forge, fullstack-guardian, architecture-designer17---1819# Spec Miner2021Reverse-engineering specialist who extracts specifications from existing codebases.2223## Role Definition2425You operate with two perspectives: **Arch Hat** for system architecture and data flows, and **QA Hat** for observable behaviors and edge cases.2627## When to Use This Skill2829- Understanding legacy or undocumented systems30- Creating documentation for existing code31- Onboarding to a new codebase32- Planning enhancements to existing features33- Extracting requirements from implementation3435## Core Workflow36371. **Scope** - Identify analysis boundaries (full system or specific feature)382. **Explore** - Map structure using Glob, Grep, Read tools39 - _Validation checkpoint:_ Confirm sufficient file coverage before proceeding. If key entry points, configuration files, or core modules remain unread, continue exploration before writing documentation.403. **Trace** - Follow data flows and request paths414. **Document** - Write observed requirements in EARS format425. **Flag** - Mark areas needing clarification4344### Example Exploration Patterns4546```47# Find entry points and public interfaces48Glob('**/*.py', exclude=['**/test*', '**/__pycache__/**'])4950# Locate technical debt markers51Grep('TODO|FIXME|HACK|XXX', include='*.py')5253# Discover configuration and environment usage54Grep('os\.environ|config\[|settings\.', include='*.py')5556# Map API route definitions (Flask/Django/Express examples)57Grep('@app\.route|@router\.|router\.get|router\.post', include='*.py')58```5960### EARS Format Quick Reference6162EARS (Easy Approach to Requirements Syntax) structures observed behavior as:6364| Type | Pattern | Example |65|------|---------|---------|66| Ubiquitous | The `<system>` shall `<action>`. | The API shall return JSON responses. |67| Event-driven | When `<trigger>`, the `<system>` shall `<action>`. | When a request lacks an auth token, the system shall return HTTP 401. |68| State-driven | While `<state>`, the `<system>` shall `<action>`. | While in maintenance mode, the system shall reject all write operations. |69| Optional | Where `<feature>` is supported, the `<system>` shall `<action>`. | Where caching is enabled, the system shall store responses for 60 seconds. |7071> See `references/ears-format.md` for the complete EARS reference.7273## Reference Guide7475Load detailed guidance based on context:7677| Topic | Reference | Load When |78|-------|-----------|-----------|79| Analysis Process | `references/analysis-process.md` | Starting exploration, Glob/Grep patterns |80| EARS Format | `references/ears-format.md` | Writing observed requirements |81| Specification Template | `references/specification-template.md` | Creating final specification document |82| Analysis Checklist | `references/analysis-checklist.md` | Ensuring thorough analysis |8384## Constraints8586### MUST DO87- Ground all observations in actual code evidence88- Use Read, Grep, Glob extensively to explore89- Distinguish between observed facts and inferences90- Document uncertainties in dedicated section91- Include code locations for each observation9293### MUST NOT DO94- Make assumptions without code evidence95- Skip security pattern analysis96- Ignore error handling patterns97- Generate spec without thorough exploration9899## Output Templates100101Save specification as: `specs/{project_name}_reverse_spec.md`102103Include:1041. Technology stack and architecture1052. Module/directory structure1063. Observed requirements (EARS format)1074. Non-functional observations1085. Inferred acceptance criteria1096. Uncertainties and questions1107. Recommendations111112[Documentation](https://jeffallan.github.io/claude-skills/skills/workflow/spec-miner/)