reverse-document
它能做什么
这个技能阅读现有的游戏代码或原型,并编写从未写过的设计或技术文档。适合做了功能却没有文档,或接手了没有任何文档的项目的团队。
适用场景
- ✓当某个功能在没有设计文档的情况下已经做好,团队现在需要补上的时候。
- ✓当团队接手了一个没有任何文档的代码库,需要理解它的时候。
- ✓当一个原型机制需要被正式化为书面设计的时候。
技能链接
https://github.com/Donchitos/Claude-Code-Game-Studios/blob/main/.claude/skills/reverse-document/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请根据 src/gameplay/combat 中的战斗代码实际做的事情,为它编写一份设计文档。”
每周 5 个新技能,1 分钟读完。
工作原理
这个技能接收文档类型和代码路径,阅读实现内容,然后编写对应的文档:设计章节、架构决策记录或概念说明。保存前它会要求确认。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Reverse Documentation
This skill analyzes existing implementation (code, prototypes, systems) and generates appropriate design or architecture documentation. Use this when:
- You built a feature without writing a design doc first
- You inherited a codebase without documentation
- You prototyped a mechanic and need to formalize it
- You need to document "why" behind existing code
Workflow
Phase 1: Parse Arguments
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 prototype
Path: Directory or file to analyze, under the code root — src/ Godot,
Assets/ Unity, Source/<Module>/ Unreal (.claude/docs/code-root-resolution.md)
src/gameplay/combat/→ All combat-related code (Godot)Assets/Scripts/Core/EventSystem.cs→ Specific file (Unity)Source/MyGame/Private/AI/→ A module folder (Unreal)prototypes/stealth-mech/→ Prototype directory
!bash "${CLAUDE_SKILL_DIR}/../../hooks/yaml-helper.sh" resolve_config --keys workflow,system_overrides,automation
Automation mode: Resolve modes.automation (project.local.yaml →
project.yaml → default collaborative). Every AskUserQuestion call and
every file write follows .claude/docs/automation-modes.md
(collaborative asks always · guided major-only · autonomous logs and proceeds;
automation_always_ask categories always prompt).
Resolved above — use as-is. No block → defaults in
.claude/docs/config-resolution.md.
Resolve the workflow tier for the target system: map <path> to a system
name, then use the system_overrides row for that system if the block above
lists one, else the project workflow value. It sets how much document is
generated — see Phase 5. Semantics of each tier are in
.claude/docs/workflow-modes.md.
Resolve the tier — do not assume it.
workflow-modes.mddefines what each tier means, but it cannot say what this project is set to; take that from the block above. The consequence is large here — atfullthis skill writes an 8-section GDD and atminimala one-page brief, so a wrong tier produces the wrong artifact entirely.
Examples:
/reverse-document design src/gameplay/magic-system
/reverse-document architecture Source/MyGame/Private/EntityComponent
/reverse-document concept prototypes/vehicle-combat
Phase 2: Analyze Implementation
Read and understand the code/prototype:
For design docs (GDD):
- Identify mechanics, rules, formulas
- Extract gameplay values (damage, cooldowns, ranges)
- Find state machines, ability systems, progression
- Detect edge cases handled in code
- Map dependencies (what systems interact?)
For architecture docs (ADR):
- Identify patterns (ECS, singleton, observer, etc.)
- Understand technical decisions (threading, serialization, etc.)
- Map dependencies and coupling
- Assess performance characteristics
- Find constraints and trade-offs
For concept docs (prototype analysis):
- Identify core mechanic
- Extract emergent gameplay patterns
- Note what worked vs what didn't
- Find technical feasibility insights
- Document player fantasy / feel
Phase 3: Ask Clarifying Questions
DO NOT just describe the code. ASK about intent:
Design questions:
- "I see a [resource] system that depletes during [activity]. Was this for:
- Pacing (prevent spam)?
- Resource management (strategic depth)?
- Or something else?"
- "The [mechanic] seems central. Is this a core pillar, or supporting feature?"
- "[Value] scales exponentially with [factor]. Intentional design, or needs rebalancing?"
Architecture questions:
- "You're using a service locator pattern. Was this chosen for:
- Testability (mock dependencies)?
- Decoupling (reduce hard references)?
- Or inherited from existing code?"
- "I see manual memory management instead of smart pointers. Performance requirement, or legacy?"
Concept questions:
- "The prototype emphasizes stealth over combat. Is that the intended pillar?"
- "Players seem to exploit the grappling hook for speed. Feature or bug?"
Phase 3b: Sufficiency Check — is there enough here to document?
Run this before Phase 4, and stop here if it fails. This skill infers a design from an implementation, so when the implementation is thin there is nothing to infer from — and the template below wi
常见问题
它可以编写哪些类型的文档?
它可以编写设计章节、架构决策记录,或根据原型编写概念文档。
它会记录代码背后的原因吗?
它记录的是代码做了什么,原因是从实现中推断出来的,因此请自行审阅。
它会不经询问就保存文件吗?
不会。写入遵循项目的自动化设置,可能需要你批准。
详情
作者的原始描述
Generate missing design or architecture docs from existing implementation — works backwards from code and prototypes.
热度
- GitHub 星标
- 33k
- 排名
- #8476
- 许可证
- MIT
- 更新时间
- 2026/10/18
评论
- …