
Spec Miner
- 3k installs
- 10.8k repo stars
- Updated May 20, 2026
- jeffallan/claude-skills
spec-miner is an agent skill that reverse-engineers legacy or undocumented codebases into EARS-format specifications using Glob, Grep, and Read exploration with Arch Hat and QA Hat perspectives.
About
spec-miner is a repository analysis skill that walks a structured checklist across eight codebase areas—entry points, routes, models, auth, validation, error handling, external calls, and config—using concrete glob and grep patterns like `**/main.{ts,js,py}`, `**/routes/**/*`, and `**/auth/**/*`. Developers invoke spec-miner when joining a legacy service or auditing an unknown monorepo before refactoring or shipping features. The skill turns raw file trees into an actionable spec map that highlights controllers, DTOs, JWT guards, and test locations. spec-miner reduces blind edits by surfacing architecture boundaries first, so subsequent feature work targets the right modules.
- 10-area analysis checklist with glob/grep patterns (entry points, routes, models, auth, validation, errors, external cal
- Four analysis phases: structure discovery, API surface, data layer, and business logic
- Phase-gated checklists for stack ID, directory map, endpoints, migrations, and state transitions
- Test files treated as behavioral documentation via **/*.spec.ts and **/*.test.ts patterns
- Traces integrations via fetch(, axios., queues (@Cron, Bull), and ConfigService/.env patterns
Spec Miner by the numbers
- 2,999 all-time installs (skills.sh)
- +92 installs in the week ending Jul 28, 2026 (Skillselion tracking)
- Ranked #57 of 1,382 Code Review & Quality skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Jul 28, 2026 (Skillselion catalog sync)
What spec-miner says it does
Ground all observations in actual code evidence
npx skills add https://github.com/jeffallan/claude-skills --skill spec-minerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 3k |
|---|---|
| repo stars | ★ 10.8k |
| Security audit | 3 / 3 scanners passed |
| Last updated | May 20, 2026 |
| Repository | jeffallan/claude-skills ↗ |
How do you map routes, models, auth, and business logic in an unfamiliar or undocumented codebase before changing it?
Turn an unfamiliar repo into a structured spec map—entry points, routes, models, auth, and tests—before you change or ship anything.
Who is it for?
Developers onboarding to inherited projects, auditing legacy services, or extracting requirements from implementation before refactors.
Skip if: Skip for greenfield feature design from scratch, pure code generation without exploration, or repos with complete up-to-date docs already.
When should I use this skill?
User asks to reverse engineer, understand legacy code, map an undocumented system, or create architecture documentation from source.
What you get
A reverse spec saved as specs/{project_name}_reverse_spec.md with stack, structure, EARS requirements, uncertainties, and code-location evidence.
- specs/{project_name}_reverse_spec.md
By the numbers
- Five-step core workflow: scope, explore, trace, document in EARS format, flag clarifications
- Four reference guides for analysis process, EARS format, specification template, and checklist
Files
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:
| 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: 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
Analysis Checklist
Comprehensive Checklist
| Area | What to Find | Glob/Grep Patterns |
|---|---|---|
| Entry points | main.ts, app.ts, index.ts | **/main.{ts,js,py} |
| Routes | Controllers, route files | **/routes/**/*, @Controller |
| Models | Entities, schemas | **/models/**/*, @Entity |
| Auth | Guards, middleware, JWT | **/auth/**/*, passport |
| Validation | DTOs, validators, pipes | **/dto/**/*, @IsString |
| Error handling | Exception filters, try/catch | ExceptionFilter, catch |
| External calls | HTTP clients, SDK usage | fetch(, axios. |
| Config | Env files, config modules | **/.env*, ConfigService |
| Tests | Test files reveal behaviors | **/*.spec.ts, **/*.test.ts |
| Background jobs | Queues, cron, workers | @Cron, Bull, Queue |
Analysis Phases
Phase 1: Structure Discovery
- [ ] Identify technology stack
- [ ] Map directory structure
- [ ] Find entry points
- [ ] List all modules/packages
Phase 2: API Surface
- [ ] Document all endpoints
- [ ] Note HTTP methods and paths
- [ ] Identify request/response formats
- [ ] Find authentication requirements
Phase 3: Data Layer
- [ ] Map all data models
- [ ] Document relationships
- [ ] Find migrations
- [ ] Note validation rules
Phase 4: Business Logic
- [ ] Trace main flows
- [ ] Identify business rules
- [ ] Document state transitions
- [ ] Find external integrations
Phase 5: Security
- [ ] Check authentication method
- [ ] Review authorization patterns
- [ ] Find input validation
- [ ] Note security configurations
Phase 6: Quality & Testing
- [ ] Review existing tests
- [ ] Note test coverage
- [ ] Document error handling
- [ ] Find logging patterns
Verification Questions
Before finalizing specification:
- [ ] All endpoints documented?
- [ ] All models mapped?
- [ ] Authentication flow clear?
- [ ] Error responses documented?
- [ ] External dependencies listed?
- [ ] Uncertainties flagged?
Analysis Process
Step 1: Project Structure
# Find entry points
Glob: **/main.{ts,js,py,go}
Glob: **/app.{ts,js,py}
Glob: **/index.{ts,js}
# Find routes/controllers
Glob: **/routes/**/*.{ts,js}
Glob: **/controllers/**/*.{ts,js}
Grep: @Controller|@Get|@Post|router\.|app\.getStep 2: Data Models
# Database schemas
Glob: **/models/**/*.{ts,js,py}
Glob: **/schema*.{ts,js,py,sql}
Glob: **/migrations/**/*
Grep: @Entity|class.*Model|schema\s*=Step 3: Business Logic
# Services and logic
Glob: **/services/**/*.{ts,js}
Grep: async.*function|export.*classStep 4: Authentication & Security
# Auth patterns
Glob: **/auth/**/*
Glob: **/guards/**/*
Grep: @Guard|middleware|passport|jwtStep 5: External Integrations
# External calls
Grep: fetch\(|axios\.|HttpService|request\(
Glob: **/integrations/**/*
Glob: **/clients/**/*Step 6: Configuration
# Config files
Glob: **/*.config.{ts,js}
Glob: **/.env*
Glob: **/config/**/*Quick Reference
| Pattern | Purpose |
|---|---|
**/main.{ts,js,py} | Entry points |
**/routes/**/* | API routes |
**/models/**/* | Data models |
| `@Controller\ | @Get` |
| `router.\ | app.get` |
EARS Format
EARS Syntax
Easy Approach to Requirements Syntax for clear, unambiguous requirements.
Basic Patterns
Ubiquitous (Always)
The system shall [action].Event-Driven
When [trigger], the system shall [action].State-Driven
While [state], the system shall [action].Conditional
While [state], when [trigger], the system shall [action].Optional
Where [feature enabled], the system shall [action].Example Observations
Authentication
OBS-AUTH-001: Login Flow
While credentials are valid, when POST /auth/login is called,
the system shall return JWT access token (15m) and refresh token (7d).OBS-AUTH-002: Token Refresh
While refresh token is valid, when POST /auth/refresh is called,
the system shall issue new access token.OBS-AUTH-003: Invalid Token
When expired or invalid token is provided,
the system shall return 401 Unauthorized.User Management
OBS-USER-001: User Creation
While email is unique, when POST /users is called with valid data,
the system shall create user with bcrypt-hashed password (rounds=12).OBS-USER-002: Email Validation
When email format is invalid,
the system shall return 400 with error message "Invalid email format".Input Validation
OBS-INPUT-001: Required Fields
When required fields are missing,
the system shall return 400 with field-specific error messages.Quick Reference
| Type | Pattern | Example Trigger |
|---|---|---|
| Ubiquitous | shall [action] | Always true |
| Event | When [X], shall | On button click |
| State | While [X], shall | While logged in |
| Conditional | While [X], when [Y], shall | While admin, when delete |
| Optional | Where [X], shall | If feature enabled |
Specification Template
Full Template
# Reverse-Engineered Specification: [System/Feature Name]
## Overview
[High-level description based on analysis]
## Architecture Summary
### Technology Stack
- **Language**: TypeScript 5.x
- **Framework**: NestJS 10.x
- **Database**: PostgreSQL 15
- **ORM**: Prisma 5.x
### Module Structuresrc/ ├── auth/ # Authentication (JWT, guards) ├── users/ # User CRUD operations ├── orders/ # Order processing └── common/ # Shared utilities
### Data FlowRequest → Guard → Controller → Service → Repository → Database ↓ External APIs
## Observed Functional Requirements
### [Module Name]
**OBS-XXX-001**: [Feature Name]
[EARS format requirement]
**OBS-XXX-002**: [Feature Name]
[EARS format requirement]
## Observed Non-Functional Requirements
### Security
- JWT tokens signed with RS256
- Passwords hashed with bcrypt (12 rounds)
- Rate limiting: 100 req/min per IP
### Performance
- Database connection pool: 10 connections
- Response timeout: 30 seconds
- Pagination: default 20, max 100
### Error Handling
| Code | Condition | Response |
|------|-----------|----------|
| 400 | Validation failure | `{ error: string, details: object }` |
| 401 | Invalid/missing token | `{ error: "Unauthorized" }` |
| 404 | Resource not found | `{ error: "Not found" }` |
| 500 | Unhandled error | `{ error: "Internal server error" }` |
## Inferred Acceptance Criteria
### AC-001: [Feature]
Given [precondition]
When [action]
Then [expected result]
## Uncertainties and Questions
- [ ] What triggers order status transitions?
- [ ] Is soft delete implemented for users?
- [ ] What external APIs are called?
- [ ] Are there background jobs?
## Recommendations
1. Add OpenAPI documentation to controllers
2. Missing input validation on PATCH endpoints
3. Consider adding request tracingOutput Location
Save specification as: specs/{project_name}_reverse_spec.md
Required Sections
| Section | Purpose |
|---|---|
| Overview | High-level summary |
| Architecture | Tech stack, structure, data flow |
| Functional Requirements | EARS format observations |
| Non-Functional | Security, performance, errors |
| Acceptance Criteria | Given/When/Then format |
| Uncertainties | Questions for clarification |
| Recommendations | Improvements identified |
Related skills
How it compares
Choose spec-miner over generic code-explainer prompts when you need a repeatable checklist with glob/grep patterns across routes, models, and auth.
FAQ
What does spec-miner produce?
A structured reverse specification with technology stack, module map, EARS observed requirements, non-functional notes, uncertainties, and recommendations.
When should I use spec-miner?
When joining a legacy codebase, planning enhancements to existing features, or extracting requirements from implementation with no documentation.
What tools does spec-miner require?
Read, Grep, and Glob for exploration, with validation checkpoints before documenting and EARS-format observed requirements grounded in code evidence.
Is Spec Miner safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.