New to Claude Skills? Learn how to install them →

jeffallan on GitHub

Spec Miner

Free

Extract specifications from legacy codebases efficiently.

Get this skill

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 source

1. Install with the skills CLI

npx skills add jeffallan/claude-skills/spec-miner --agent claude-code

2. 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 jeffallan

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

  1. Scope - Identify analysis boundaries (full system or specific feature)
  2. 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.
  3. Trace - Follow data flows and request paths
  4. Document - Write observed requirements in EARS format
  5. 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:

TypePatternExample
UbiquitousThe <system> shall <action>.The API shall return JSON responses.
Event-drivenWhen <trigger>, the <system> shall <action>.When a request lacks an auth token, the system shall return HTTP 401.
State-drivenWhile <state>, the <system> shall <action>.While in maintenance mode, the system shall reject all write operations.
OptionalWhere <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:

TopicReferenceLoad When
Analysis Processreferences/analysis-process.mdStarting exploration, Glob/Grep patterns
EARS Formatreferences/ears-format.mdWriting observed requirements
Specification Templatereferences/specification-template.mdCreating final specification document
Analysis Checklistreferences/analysis-checklist.mdEnsuring 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:

  1. Technology stack and architecture
  2. Module/directory structure
  3. Observed requirements (EARS format)
  4. Non-functional observations
  5. Inferred acceptance criteria
  6. Uncertainties and questions
  7. Recommendations

Documentation

Frequently asked questions about Spec Miner

Similar skills