
Spec Miner
FreeExtract specifications from legacy codebases efficiently.
Free · Opens the source repo
What Spec Miner does
Spec Miner is a reverse-engineering tool designed to help developers and teams understand and document existing codebases, particularly those that are legacy or lack proper documentation. It operates by analyzing the code structure, mapping dependencies, and generating API documentation directly from the source code. This skill is particularly useful in scenarios where projects have been inherited or when working with older systems that have not been maintained properly. By using Spec Miner, you can gain insights into undocumented business logic and the overall architecture of the system, which is crucial for planning enhancements or onboarding new team members.
The core workflow of Spec Miner involves a systematic approach to exploring the codebase. It begins with scoping the analysis to determine whether to focus on the entire system or specific features. The exploration phase employs tools like Glob and Grep to map the code structure and identify key entry points, configuration files, and core modules. This thorough exploration ensures that all relevant aspects of the code are covered before moving on to documenting the findings. The documentation process utilizes the EARS format, allowing users to structure observed behaviors clearly and concisely.
In addition to documenting requirements, Spec Miner emphasizes the importance of grounding observations in actual code evidence. This means that all claims made in the documentation are backed by specific references to the code, avoiding assumptions and ensuring accuracy. The skill also includes a reference guide with detailed instructions for various analysis processes, making it easy for users to follow best practices during their exploration.
Overall, Spec Miner is an essential tool for developers dealing with legacy systems or undocumented projects. It streamlines the process of understanding complex codebases, making it easier to extract valuable insights and create comprehensive documentation that can guide future development efforts.
When to use it
Use this skill when you need to analyze old or inherited code without existing documentation, especially for onboarding or feature planning.
When not to use it
This skill may not be suitable for new codebases that are well-documented or when working with systems that are already thoroughly understood.
What you can build with it
Onboarding to a New Codebase
When joining a team, use Spec Miner to quickly understand the structure and functionality of an existing codebase.
Creating Documentation for Legacy Systems
Utilize Spec Miner to extract and document specifications from an undocumented legacy system, ensuring clarity for future developers.
Planning Enhancements to Existing Features
Before making changes to a legacy system, use Spec Miner to analyze current implementations and document requirements.
How to install Spec Miner
View source1. Install with the skills CLI
npx skills add jeffallan/claude-skills/spec-miner --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by jeffallanSpec 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.mdfor 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
Frequently asked questions about Spec Miner
Similar skills
Markdown to HTML Conversion
Efficiently convert Markdown documents to HTML.
Code Tour
Create structured walkthroughs for codebases.
Acquire Codebase Knowledge
Streamline onboarding with comprehensive codebase documentation.
Documentation & Modernization
Streamline codebase documentation and modernization planning.
Azure Resource Visualizer
Generate architecture diagrams for Azure resources.
CLAUDE.md Improver
Optimize your CLAUDE.md files for better project context.
