Agent skill

Code To Spec

by smallnest in smallnest/goal-workflow

Reverse-engineer a SPEC document from an existing project. An agent skill from smallnest/goal-workflow.

MITAuto-check passed

Install Code To Spec

skills CLI
$ npx skills add smallnest/goal-workflow --skill code-to-spec -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install smallnest/goal-workflow code-to-spec --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/smallnest/goal-workflow.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/code-to-spec .claude/skills/code-to-spec && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
code-to-spec
GitHub stars
289
Token cost
~2.7k tokens
SKILL.md length
878 words
Files
1
Skills in repo
20
Repo updated
First seen
Licence
MIT

At a glance

Reverse-engineer a SPEC document from an existing project. An agent skill from smallnest/goal-workflow.

  • Works in 5 steps: Scope Confirmation → Deep Scan → SPEC Document Structure → …
  • Document this project
  • SKILL.md covers When to Use, The Job, Step 1: Scope Confirmation and Step 2: Deep Scan, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Code To Spec is an agent skill from smallnest/goal-workflow. Reverse-engineer a SPEC document from an existing project. Analyzes code, config, tests, and structure to produce a comprehensive specification. Triggers on: code-to-spec, reverse spec, generate spec, 逆向规格, 生成规格文档, 生成设计文档, 生成设计方案, extract spec, document this project, what does this project do.

Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: AI-driven development workflow with /prd, /goal, /review-it and /ship-it skills. The licence is MIT.

When your agent uses it

  • Document this project
  • What does this project do

Example prompts

  • “/code-to-spec”

Requirements

  • Docker

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Scope Confirmation
  2. Deep Scan
  3. SPEC Document Structure
  4. Review & Iteration
  5. Save

What it can do on your machine

Read from SKILL.md and the folder at commit b06ab3c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Code To Spec loads about 2.7k tokens when it runs. Until then it costs about 77 tokens; SKILL.md has 878 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~77
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from smallnest/goal-workflow at commit b06ab3c, republished under its MIT licence (© smallnest). 878 words, ~2,655 tokens.

Download SKILL.mdSave it as .claude/skills/code-to-spec/SKILL.md (or your agent's skills folder).
name
code-to-spec
description
Reverse-engineer a SPEC document from an existing project. Analyzes code, config, tests, and structure to produce a comprehensive specification. Triggers on: code-to-spec, reverse spec, generate spec, 逆向规格, 生成规格文档, 生成设计文档, 生成设计方案, extract spec, document this project, what does this project do.
user-invocable
true

to-spec — Reverse-Engineer Project Specification

Analyze an existing codebase and produce a structured SPEC document that captures what the project does, how it's built, and what contracts it exposes. The output is a living specification that could be used to rebuild the project from scratch or onboard new contributors.


When to Use

  • You want a comprehensive understanding of an existing project
  • Onboarding new team members who need a high-level overview
  • Documenting a project that was built without a spec
  • Comparing actual implementation against intended design
  • Preparing for a rewrite or major refactor
  • Auditing what a project actually does vs. what people think it does

The Job

  1. Scope confirmation — ask user what to analyze (entire repo, specific directory, or specific aspect)
  2. Deep scan — systematically read project structure, entry points, config, tests, and core logic
  3. Synthesize — produce a structured SPEC document
  4. Review — present to user for feedback and iteration
  5. Save — write final SPEC to agreed location

Step 1: Scope Confirmation

Before scanning, ask the user:

What should I analyze?

A. Entire repository (recommended for small-medium projects)
B. Specific directory or module: [path]
C. Specific aspect only (e.g., API surface, data model, auth flow)

Depth level:
1. Overview — high-level architecture + tech stack + key features (fast, ~5 min)
2. Standard — includes API contracts, data models, config, dependencies (default)
3. Deep — adds internal module interactions, error handling patterns, test coverage analysis

If the project is large (>500 files), recommend starting with Overview or a specific module.


Step 2: Deep Scan

Systematically analyze the following (adapt to what exists):

2.1 Project Identity
  • package.json, go.mod, Cargo.toml, pyproject.toml, pom.xml, etc.
  • README, LICENSE
  • Git history (first commit date, recent activity, contributor count)
2.2 Architecture
  • Directory structure and organization pattern (monorepo, layered, hexagonal, etc.)
  • Entry points (main files, CLI commands, server bootstrap)
  • Module boundaries and dependency graph (internal)
2.3 Tech Stack
  • Language(s) and version constraints
  • Frameworks and major libraries
  • Build tools and bundlers
  • Runtime requirements (Node version, Docker, etc.)
2.4 Features & Behavior
  • Route definitions / CLI commands / exported functions
  • Business logic modules and their responsibilities
  • Background jobs, cron tasks, event handlers
2.5 Data Model
  • Database schemas, migrations, ORMs
  • Key data structures and their relationships
  • State management approach
2.6 API Surface
  • HTTP endpoints (method, path, request/response shapes)
  • GraphQL schema / gRPC protos / WebSocket events
  • CLI interface (commands, flags, arguments)
  • Exported library API (public functions, classes, types)
2.7 Configuration & Environment
  • Environment variables and their purpose
  • Config files and their schema
  • Feature flags, toggles
2.8 External Dependencies
  • Third-party services (databases, queues, APIs)
  • Infrastructure requirements (cloud services, storage)
  • Authentication/authorization providers
2.9 Testing & Quality
  • Test framework and approach (unit, integration, e2e)
  • Coverage patterns (what's tested, what's not)
  • Linting, formatting, type checking setup
2.10 Deployment & Operations
  • CI/CD configuration
  • Deployment targets and strategies
  • Monitoring, logging, health checks

Step 3: SPEC Document Structure

Generate the SPEC with these sections. Omit sections that don't apply.

markdown
# SPEC: [Project Name]

> Reverse-engineered specification — generated [date] from commit [short-hash]

## 1. Overview

### 1.1 Purpose
[One paragraph: what problem this project solves and for whom]

### 1.2 Key Capabilities
- [Bullet list of what the system can do, from a user's perspective]

### 1.3 Architecture Style
[e.g., "Monolithic Express.js API with React SPA frontend", "CLI tool with plugin system", "Microservices communicating over gRPC"]

---

## 2. Tech Stack

| Layer | Technology | Version |
|-------|-----------|---------|
| Language | ... | ... |
| Framework | ... | ... |
| Database | ... | ... |
| Build | ... | ... |
| Test | ... | ... |
| Deploy | ... | ... |

---

## 3. Project Structure

[Directory tree with annotations explaining each top-level directory's purpose]

---

## 4. Data Model

### 4.1 Core Entities
[For each entity: name, fields, relationships, constraints]

### 4.2 State Transitions
[If applicable: lifecycle states and valid transitions]

---

## 5. API Surface

### 5.1 [Interface Type: REST / CLI / Library / etc.]

[For each endpoint/command/function:]
| Method | Path/Command | Description | Auth |
|--------|-------------|-------------|------|
| ... | ... | ... | ... |

### 5.2 Request/Response Schemas
[Key request/response shapes with field types]

---

## 6. Configuration

| Variable / Key | Required | Default | Description |
|---------------|----------|---------|-------------|
| ... | ... | ... | ... |

---

## 7. External Dependencies

| Service | Purpose | Failure Impact |
|---------|---------|----------------|
| ... | ... | ... |

---

## 8. Business Rules & Constraints

- [Numbered list of invariants, validation rules, and business logic constraints discovered in the code]

---

## 9. Non-Functional Characteristics

### 9.1 Performance
[Observed patterns: caching, pagination, batch processing, etc.]

### 9.2 Security
[Auth mechanism, input validation patterns, secrets management]

### 9.3 Error Handling
[Error strategy: custom error types, error codes, retry policies]

---

## 10. Testing Strategy

| Type | Framework | Coverage Pattern |
|------|-----------|-----------------|
| Unit | ... | ... |
| Integration | ... | ... |
| E2E | ... | ... |

---

## 11. Known Gaps & Assumptions

- [Things that are unclear from the code alone]
- [Assumptions made during analysis]
- [Areas with no tests or documentation]

---

## 12. Appendix

### A. Dependency Graph
[Key module dependencies, import relationships]

### B. Environment Setup
[Steps to run the project locally, derived from config and scripts]

Step 4: Review & Iteration

After generating the SPEC, present it and ask:

SPEC generated. Please review:

- Are there sections that need more detail?
- Are there inaccuracies I should correct?
- Should I add/remove any sections?
- Is the depth level appropriate?

Reply OK to save, or provide feedback for iteration.

Apply feedback and re-present until user confirms.


Step 5: Save

Ask user for save location:

Where should I save the SPEC?

A. docs/SPEC.md (recommended)
B. SPEC.md (project root)
C. Custom path: [specify]

Analysis Heuristics

Identifying Purpose
  • Look at README first line, package description field, CLI help text
  • Check the main entry point — what does it bootstrap?
  • Look at test descriptions — they often describe expected behavior in plain language
Discovering Architecture
  • Map import/require statements to build dependency graph
  • Identify layers by directory naming: controllers, services, models, routes, handlers, domain, infra
  • Check for dependency injection patterns, middleware chains, plugin registrations
Extracting Business Rules
  • Look for validation functions, guard clauses, assertion statements
  • Check error messages — they often describe what went wrong in business terms
  • Examine test assertions — they encode expected behavior
Show full SKILL.md (350 more words)Show less
Finding API Contracts
  • Route registrations (Express: app.get(), FastAPI: @app.get(), Go: mux.HandleFunc())
  • OpenAPI/Swagger files if present
  • Request validation schemas (Joi, Zod, Pydantic, struct tags)
  • CLI flag/argument definitions (cobra, argparse, yargs)
Detecting Data Models
  • ORM model definitions (Prisma, SQLAlchemy, GORM, TypeORM)
  • Migration files (in chronological order)
  • Type/interface definitions for core domain objects
  • Database seed files

Edge Cases

ScenarioHandling
Project has no README or documentationNote this in "Known Gaps"; infer purpose from code
Monorepo with multiple servicesAsk user which service(s) to analyze; produce one SPEC per service or a unified SPEC with clear boundaries
Project uses code generationDocument the generated code's purpose but focus on the source of truth (schemas, proto files, templates)
Legacy project with mixed patternsDocument all observed patterns, note inconsistencies in "Known Gaps"
Project is a library (no runtime)Focus on exported API surface, type contracts, and usage patterns from tests
Incomplete or broken codeDocument what exists, mark broken/incomplete areas explicitly
Project >1000 filesStart with entry points and trace key flows; don't exhaustively read every file
Multiple languages in one repoDocument each language's role and how they interact

Quality Criteria

A good reverse-engineered SPEC should pass these checks:

  • A developer unfamiliar with the project could understand its purpose in 60 seconds
  • The tech stack section is complete enough to set up a dev environment
  • API contracts are specific enough to write a client against
  • Data models are complete enough to recreate the schema
  • Business rules are explicit (not buried in "see code")
  • Known gaps are honestly listed (don't invent what you can't determine)
  • The SPEC matches the actual code (not aspirational documentation)

Anti-Patterns to Avoid

  • Don't invent intent. If you can't determine WHY something exists, say so. Don't fabricate rationale.
  • Don't copy code into the SPEC. Describe behavior and contracts, don't paste implementations.
  • Don't include transient state. The SPEC describes the system's design, not its current runtime state.
  • Don't over-specify internals. Focus on boundaries, contracts, and behavior. Internal implementation details belong in code comments, not specs.
  • Don't assume the README is accurate. READMEs often lag behind code. Verify claims against actual implementation.

© smallnest, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/code-to-spec of smallnest/goal-workflow.

Open the folder on GitHubat commit b06ab3c

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders. This page covers the copy in smallnest/goal-workflow, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Code To Spec next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Code To Spec compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Code To Spec this skillsmallnest/goal-workflow289—~2.7kAutomated safety check: PassMIT
Protocol Reverse Engineeringwshobson/agents40k8 repos~3.2kAutomated safety check: PassMIT
Reverse Engineering Malware With Ghidramukul975/Anthropic-Cybersecurity-Skills34k—~3kAutomated safety check: PassApache-2.0
JS Reversesickn33/agentic-awesome-skills47k1 repos~1.8kAutomated safety check: PassMIT
Rust Reverse Engineeringhashgraph-online/awesome-codex-plugins1.2k—~3.7kAutomated safety check: PassApache-2.0
Protocol Reversezhaoxuya520/reverse-skill40k2 repos~620Automated safety check: WarnMIT

Similar skills

  • Master network protocol reverse engineering including packet analysis, protocol dissection, and custom protocol documentation.

    40k GitHub starsUsed in 8 repos~3.2k tokens
    SecurityAuto-check passed
  • Reverse Engineering Malware With Ghidra

    mukul975/Anthropic-Cybersecurity-Skills

    Reverse engineers malware binaries using NSA's Ghidra disassembler and decompiler to study internal logic, cryptographic routines, C2 protocols, and evasion techniques at the assembly and pseudo-C…

    34k GitHub stars~3k tokensUpdated 1 mo ago
    SecurityAuto-check passed
  • JS Reverse

    sickn33/agentic-awesome-skills

    Front-end JavaScript reverse engineering: locate signature chains, analyze encrypted request parameters, sample runtime behavior, and reproduce logic locally in Node for evidence-based output.

    47k GitHub starsUsed in 1 repo~1.8k tokens
    SecurityAuto-check passed
  • Rust Reverse Engineering

    hashgraph-online/awesome-codex-plugins

    A skill your agent uses when analyzing a Rust binary without source code, reverse engineering Rust executables or libraries, demangling Rust symbols, recovering likely crate namespaces, tracing…

    1.2k GitHub stars~3.7k tokensUpdated today
    SecurityAuto-check passed
  • Protocol Reverse

    zhaoxuya520/reverse-skill

    A skill your agent uses for authorized reverse engineering of custom binary protocols, Protobuf/gRPC, WebSocket frames, and PCAP-driven protocol recovery.

    40k GitHub starsUsed in 2 repos~620 tokens
    Backend & APIsAuto-check: warnings
  • macOS Reverse

    zhaoxuya520/reverse-skill

    A skill your agent uses for authorized macOS and Mach-O reverse engineering including codesign, Objective-C/Swift recovery, endpoint security surfaces, and Apple platform malware analysis.

    40k GitHub starsUsed in 2 repos~366 tokens
    SecurityAuto-check passed

More from smallnest/goal-workflow

All 20 skills in this repo
  • Article Icons

    smallnest/goal-workflow

    Illustrate an article (Markdown, HTML, etc.) with animated-style icons from itshover.com/icons.

    289 GitHub stars~1.6k tokensUpdated 25 days ago
    Auto-check passed
  • Graph

    smallnest/goal-workflow

    Graph engineering for parallel task execution: convert a task, PRD, SPEC, or issue set into a dependency graph (DAG), layer it into supersteps, then implement each independent node concurrently with…

    289 GitHub stars~3.9k tokensUpdated 25 days ago
    Auto-check passed
  • Walkthrough

    smallnest/goal-workflow

    Generate a Phase-2 Walkthrough artifact (walkthrough.md) once implementation and verification are complete.

    289 GitHub stars~4.7k tokensUpdated 25 days ago
    Auto-check: notes
  • Insight Diagram

    smallnest/goal-workflow

    为任意项目生成 UML 图、架构图和流程图。分析代码库后让用户选择要生成的图表类型,使用 architecture-diagram skill 渲染为 HTML+SVG,保存到 docs/ 目录。适用于任何软件项目的文档可视化。

    289 GitHub stars~1.6k tokensUpdated 25 days ago
    Auto-check passed
  • Design It

    smallnest/goal-workflow

    A skill your agent uses when turning a requirement, spec, or feature brief into a single self-contained HTML design document in a fixed house style — one styled HTML page with a table-of-contents…

    289 GitHub stars~1.1k tokensUpdated 25 days ago
    Auto-check passed
  • Humanize It

    smallnest/goal-workflow

    对指定文档进行去 AI 味的改写。自动选择最合适的人性化策略(humanizer-zh / humanize-chinese / technical-writing), 迭代改写直到效果达标或迭代 42 次为止。适用于中文文本的去 AI 化处理,包括通用文章、技术文档、学术论文等。

    289 GitHub stars~957 tokensUpdated 25 days ago
    Auto-check passed

Questions about Code To Spec

What does Code To Spec do?

Reverse-engineer a SPEC document from an existing project. An agent skill from smallnest/goal-workflow. Code To Spec is an agent skill from smallnest/goal-workflow. Reverse-engineer a SPEC document from an existing project.

When should I use Code To Spec?

Code To Spec fits situations like: document this project; what does this project do.

How do I install Code To Spec in Claude Code?

Run `npx skills add smallnest/goal-workflow --skill code-to-spec -a claude-code`. Or copy the skill folder (skills/code-to-spec in smallnest/goal-workflow) into .claude/skills/code-to-spec in your project. Claude Code loads it when a task matches its description.

How do I install Code To Spec in Codex?

Run `npx skills add smallnest/goal-workflow --skill code-to-spec -a codex`. Or copy the skill folder (skills/code-to-spec in smallnest/goal-workflow) into .agents/skills/code-to-spec in your project. Codex loads it when a task matches its description.

Can I use Code To Spec in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add smallnest/goal-workflow --skill code-to-spec -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/code-to-spec, .gemini/skills/code-to-spec, .github/skills/code-to-spec and .opencode/skills/code-to-spec in your project.

What does Code To Spec need to run?

SKILL.md names no scripts, command-line tools or credentials: Code To Spec is instructions for the agent only. Our summary lists: Docker.

Does Code To Spec access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Code To Spec safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Code To Spec use?

Code To Spec is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Code To Spec use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Code To Spec?

Skills that share tags, products or a category with Code To Spec: Protocol Reverse Engineering (wshobson/agents, 40k stars), Reverse Engineering Malware With Ghidra (mukul975/Anthropic-Cybersecurity-Skills, 34k stars), JS Reverse (sickn33/agentic-awesome-skills, 47k stars) and Rust Reverse Engineering (hashgraph-online/awesome-codex-plugins, 1.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Code To Spec?

smallnest (a GitHub user) maintains it in smallnest/goal-workflow, which has 289 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on September 13, 2026.

Source: smallnest/goal-workflow on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.