Generate design or architecture documents from existing implementation. Works backwards from code/prototypes to create missing planning docs.
This skill analyzes existing implementation (code, prototypes, systems) and generates appropriate design or architecture documentation. Use this when:
Format: /reverse-document <type> <path>
Type options:
design → Generate a game design document (GDD section)architecture → Generate an Architecture Decision Record (ADR)concept → Generate a concept document from prototypePath: Directory or file to analyze
src/gameplay/combat/src/core/event-system.cpp → Specific fileprototypes/stealth-mech/ → Prototype directoryExamples:
/reverse-document design src/gameplay/magic-system
/reverse-document architecture src/core/entity-component
/reverse-document concept prototypes/vehicle-combat
Read and understand the code/prototype:
For design docs (GDD):
For architecture docs (ADR):
For concept docs (prototype analysis):
DO NOT just describe the code. ASK about intent:
Design questions:
Architecture questions:
Concept questions:
Before drafting, show what you discovered:
I've analyzed [path]/. Here's what I found:
MECHANICS IMPLEMENTED:
- [mechanic-a] with [property] (e.g. timing windows, cooldowns)
- [mechanic-b] (e.g. interaction between two states)
- [resource] system (depletes on [action], regens on [condition])
- [state] system (builds up, triggers [effect])
FORMULAS DISCOVERED:
- [Output] = [formula using discovered variables]
- [Secondary output] = [formula]
UNCLEAR INTENT AREAS:
1. [Resource] system — pacing or resource management?
2. [Mechanic] — core pillar or supporting feature?
3. [Value] scaling — intentional design or needs tuning?
Before I draft the design doc, could you clarify these points?
Wait for user to clarify intent before drafting.
Based on type, use appropriate template:
| Type | Template | Output Path |
|---|---|---|
design | templates/design-doc-from-implementation.md | design/gdd/[system-name].md |
architecture | templates/architecture-doc-from-code.md | docs/architecture/[decision-name].md |
concept | templates/concept-doc-from-prototype.md | prototypes/[name]/CONCEPT.md or design/concepts/[name].md |
Draft structure:
Collaborative protocol:
I've drafted the [system-name] design doc based on your code and clarifications.
[Show key sections: Overview, Mechanics, Formulas, Design Intent]
ADDITIONS I MADE:
- Documented [mechanic] as "[intent]" per your clarification
- Added edge cases not in code (e.g., what if [resource] hits 0 mid-[action]?)
- Flagged balance concern: [scaling type] scaling at [boundary condition]
SECTIONS MARKED AS INCOMPLETE:
- "[System] interaction with [other-system]" (not fully implemented yet)
- "[Variant or feature]" (only [subset] implemented so far)
May I write this to design/gdd/[system-name].md?
Wait for approval. User may request changes before writing.
When approved, write the file with special markers:
---