by aws-samples
A workflow that uses an AI coding agent (Claude Code or Kiro) to turn existing source code into AI-friendly specifications. Every statement cites its evidence (path:line) and is checked by a separate verifier agent. Use the specs to reimagine the app through spec-driven development, or to maintain the current system.
Available after the catalog security scan passes.
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM lists this project for discovery and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
# Add to your Claude Code skills
git clone https://github.com/aws-samples/sample-reverse-spec-flowGuides for using ai agents skills like sample-reverse-spec-flow.
See how sample-reverse-spec-flow compares with popular alternatives.
A workflow that turns existing source code into "AI-friendly specifications" for AI agents to use
Version: 2.2.1 / License: MIT-0
日本語版: README_ja.md
The documents under
docs/and the rules the AI agent follows are currently written in Japanese.
reverse-spec-flow creates specifications for AI agents to read and use from the source code of an application that has no specifications, has outdated ones, or has become a black box. The output is Markdown that lets an agent look up only the parts it needs, through IDs and indexes. Typical uses of the generated specifications:
It is intended for developers and architects who want to use AI agents to reimagine or maintain existing systems. People can read the specifications too, but the main readers are AI agents. The specifications are also written by AI agents. For that reason, reverse-spec-flow puts the highest priority on guaranteeing the following two things by mechanism, not by the agent's self-report.
path:line).UNKNOWN.For both, whether the work is complete is decided not by the agent saying "done," but by whether the gate script gates.sh
returns a pass (exit 0).
REQ-F-01).
Specifications refer to each other by ID, and the workflow also builds an index from ID to file and a reverse index from source file to specification,
so an AI agent can look up only what it needs without reading everything.
The rules that an AI agent using the specifications must follow (specs/AGENTS.md) are included.gates.sh detects changes to it. Specifications are written to a separate git repository. Analyze a git clone or a copy of the source.Below, products such as Claude Code and Kiro are called AI tools, and the AI that works inside them is called an AI agent.
No database or dedicated platform is needed.
# 1. Clone next to the folder you want to analyze (for example legacy-order-system/)
cd /path/to/workspace # legacy-order-system/ is in here
git clone https://github.com/aws-samples/sample-reverse-spec-flow.git
# 2. Create the repository for the specifications
# init.sh <target> <name (letters, digits, . _ -)> [purpose (asked interactively if omitted)]
./sample-reverse-spec-flow/init.sh ./legacy-order-system order-system rebuild
# If there is a Playbook (a set of counting rules; see "Playbooks" below) for the target technology, you can specify it (optional; it works without one)
./sample-reverse-spec-flow/init.sh ./legacy-order-system order-system rebuild --playbook java-jaxrs-jpa
This creates legacy-order-system-spec/ (the repository for the specifications) next to the target.
Do all further work in a new session opened on legacy-order-system-spec/.
Do not start the analysis in the sample-reverse-spec-flow/ session where you ran init.sh.
If you use Kiro IDE, read legacy-order-system-spec/HOST-SETUP.md before opening the repository in Kiro IDE.
3. Open legacy-order-system-spec/ in your AI tool and give an instruction such as:
Read spec-extraction/AGENTS.md.
The source to analyze is in /path/to/workspace/legacy-order-system/ (read-only; do not modify it).
Fill in the <PLACEHOLDER> values in spec-extraction/AGENTS.md, then start from Phase 0.
The same instruction is also shown at the end of the init.sh output.
Main init.sh options:
| Argument | Meaning |
|---|---|
purpose (3rd argument, optional) |
What the specifications are for. maintenance (maintaining and evolving the current system) / evaluation (assessing and estimating a reimagine effort) / rebuild (deep enough for an AI agent to implement the reimagined application). It changes what is produced and how strict the checks are. If omitted, you choose interactively (default rebuild) |
--playbook <name> |
Optional. Counting rules for the target technology (see "Playbooks" below). Can be given more than once |
--host <name> |
The AI tool to use (claude-code (default) / kiro-ide / kiro-cli) |
--list-playbooks / --list-hosts |
List the available Playbooks / AI tools |
Phase 0 Ingestion Pin the commit of the target and decide the scope
Phase 1 Code graph List the modules, entry points, external connections and how they connect (the coverage denominator)
Phase 2 Analysis Analyze from each viewpoint (architecture, requirements, API, data, behavior, non-functional), with evidence
Phase 3 Specification Write specifications that AI agents can look up, structured after ISO/IEC/IEEE 29148 (the international standard for requirements specifications)
Phase 4 Audit Check coverage, citations and the separation of fact from guesswork, independently of the authoring
At the boundaries between phases, the AI agent asks a person to confirm (for example, the scope or how to count). What is checked, and when the AI agent stops to ask a person, is described in docs/how-it-works.md (Japanese).
legacy-order-system-spec/ ← independent git repository created by init.sh
├── AGENTS.md ← entry point
├── specs/ ← output (specifications handed to AI agents)
│ ├── AGENTS.md ← rules for the agent that uses the specifications
│ ├── overview.md ← overview of the whole system
│ ├── source-index.md ← reverse index from source to specifications (used for impact analysis)
│ ├── modules/ api/ data/ behavior/
│ └── rebuild/ ← technology-independent specifications for reimagining (when purpose is rebuild / evaluation)
└── spec-extraction/ ← working records (procedures, intermediate artifacts, check results)
├── AGENTS.md ← rules for the agent that writes the specifications
└── 03-audit/gates.sh ← gate script that decides completion
The rules the AI agent follows are split into an entry point and two sets of rules.
| Location | Role |
|---|---|
AGENTS.md (root) |
Entry point. Points to one of the two below depending on the task |
specs/AGENTS.md |
Rules for the side that uses the specifications (the agent that reimagines the application or investigates it) |
spec-extraction/AGENTS.md |
Rules for the side that writes the specifications |
Which files an AI tool loads automatically differs by tool and version. So the workflow does not depend on automatic loading: the agent reads the rules it needs, starting from the entry point.
When you hand the specifications to an AI agent, give it specs/ as is and have it read specs/AGENTS.md first.
If you also give it the source code under analysis, the ag
sample-reverse-spec-flow is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by aws-samples. A workflow that uses an AI coding agent (Claude Code or Kiro) to turn existing source code into AI-friendly specifications. Every statement cites its evidence (path:line) and is checked by a separate verifier agent. Use the specs to reimagine the app through spec-driven development, or to maintain the current system. It has 65 GitHub stars.
sample-reverse-spec-flow's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/aws-samples/sample-reverse-spec-flow" and add it to your Claude Code skills directory (see the Installation section above).
sample-reverse-spec-flow is primarily written in Shell. It is open-source under aws-samples on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh sample-reverse-spec-flow against similar tools.
No comments yet. Be the first to share your thoughts!