Reverse-engineer a legacy codebase into ATDD-ready, traceable specifications
69
86%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
This step runs immediately after the user picks doc_level (Minimal / Standard / Detailed) and before activating the Code Analyst. It decides and persists how generated specs are organized inside <output_folder>/.
Read .doc-this/config.toml, section [specs]. Also read .doc-this/config.user.toml if present and merge key by key (user file takes precedence per key).
After merge, the section is decided when granularity is one of: module, use-case, endpoint, hybrid, feature, custom.
granularity empty): present the menu.If granularity is empty in config.toml AND config.user.toml has a [specs] section with non-empty fields, warn before showing the menu:
"I see
.doc-this/config.tomlhas no specs-organization decision yet, but.doc-this/config.user.tomlhas an override in[specs]. The override will stay active after your choice and may overwrite fields you decide now.Current override in
config.user.toml: [list keys and values]Proceed with the menu anyway? (y/N)"
Wait for an explicit yes. Empty or no aborts without persisting.
Read .doc-this/context/surface.json → organization_suggestion. Use granularity to pre-mark the suggested option and rationale to display the reason.
If surface.json has no organization_suggestion (Scout failed or didn't run), show the menu without a default and ask the user to pick manually.
Format (use chat_language from state.json — example below in English):
How do you want specs organized for this project?
Scout's suggestion: [translated granularity]
Reason: [organization_suggestion.rationale]
[1] [marker] By code module
[2] [marker] By use case
[3] [marker] By endpoint / contract
[4] [marker] Hybrid (modules at root, use cases nested)
[5] [marker] By features (Scout lists discovered features)
[6] [marker] Custom
Choose (Enter accepts the suggested):Where [marker] is * on the pre-marked option and a space on the others. Add (suggested) next to the pre-marked one.
Mapping the 6 options to granularity:
| Option | granularity |
|---|---|
| 1 | module |
| 2 | use-case |
| 3 | endpoint |
| 4 | hybrid |
| 5 | feature |
| 6 | custom |
If the user picks 6, prompt:
"What are the first-level folder names? Comma-separated or one per line (minimum 1)."
Sanitize each name (drop characters forbidden by the OS filesystem, drop empty names). If the list ends up empty, repeat. Names go into custom_folders.
Before persisting, check if <output_folder>/ already has subfolders that look like a different granularity than the chosen one (e.g., chose endpoint but disk looks module-shaped).
If there is a conflict, warn:
"I see specs already exist with the [old] structure in
<output_folder>/. You chose [new] now, which differs.I'll create the new structure side-by-side; existing specs are preserved.
Confirm? (y/N)"
Wait for an explicit yes. No aborts without persisting.
The detection is heuristic and best-effort. When it can't decide cleanly, do not show the warning (avoid false positives).
Update .doc-this/config.toml, section [specs], with:
[specs]
layout = "feature-folder"
granularity = "<chosen>"
custom_folders = [<list>] # only when granularity = "custom", else []
scout_suggestion = "<organization_suggestion.granularity from surface.json>"
decided_at = "<ISO 8601 UTC timestamp, e.g. 2026-05-04T14:32:00Z>"Rules:
config.toml.tmp in the same directory, then atomic rename to config.toml. A failure during write must not corrupt the existing file.scout_suggestion is immutable: if [specs] already existed with empty granularity and a populated scout_suggestion, preserve it. On first run, copy organization_suggestion.granularity from surface.json.[project], [user], [output], [agents], [engines], [analysis], etc..doc-this/config.user.toml. That file belongs to the user.After successful persistence, run references/step-04-database-context.md to gather database ownership and schema versioning, then proceed to the Code Analyst.
There is no CLI flag to reconfigure. The user re-presents the menu by manually removing the [specs] section from config.toml (or emptying granularity). On the next run, this step detects "not decided" and runs again.
Folder names follow doc_language from state.json. Don't ask language here. In an English install, folders are in English; in Português, in Portuguese.
[specs] from config.toml, merge with config.user.tomlconfig.user.toml overrides exist but config.toml is empty, show the override warningorganization_suggestion from surface.jsoncustom_foldersconfig.tomlscout_suggestion on partial re-runs.tessl-plugin
hooks
skills
doc-this
references
scripts
doc-this-architect
references
doc-this-code-analyst
references
doc-this-data-master
doc-this-design-system
doc-this-detective
references
doc-this-help
doc-this-promote
doc-this-reviewer
doc-this-scout
doc-this-tracer
doc-this-viewer
doc-this-visor
doc-this-writer