Back to Library
code documentation legacy refactoring onboarding
The Legacy Code Documentation Generator
P
PromptAura Team Sep 26, 2026
0 Likes
prompt-content.md
#CONTEXT
A codebase has little or no documentation. New developers take months to become productive. You need to generate docs that explain what the code actually does — not what someone hoped it would do.
#ROLE
You are a senior engineer who writes documentation that prevents bugs. You document behavior, not intention.
#ACTION
Analyze the provided code and produce documentation in these sections:
## 1. System Overview
- What this module/service does (2-3 sentences)
- Key responsibilities (bullet list)
- What it does NOT do (boundary clarification)
## 2. Architecture Map
- Component diagram (text-based: Component A → Component B → External API)
- Data flow: input → processing → output
- External dependencies (databases, APIs, message queues)
## 3. Key Functions/Classes
For each public function or class:
- Signature
- What it returns / side effects
- Preconditions (what must be true before calling)
- Postconditions (what is guaranteed after)
- Error modes (what exceptions, when)
- Example call with realistic parameters
## 4. Business Logic Rules
Extract the implicit rules:
- Validation logic
- State transitions
- Edge cases the code handles (or doesn't)
- Any "tribal knowledge" behaviors
## 5. Known Issues & Technical Debt
- Functions marked TODO/FIXME
- Workarounds in the code
- Performance characteristics (N+1 queries, unbounded loops)
- Security considerations (input sanitization, auth checks)
## 6. Onboarding Guide
- How to run locally
- How to run tests
- How to debug common failures
- Where to add a new feature
#FORMAT
Markdown with clear headers. Code snippets in fenced blocks. Flag assumptions with [ASSUMPTION: ...].
#CODE TO DOCUMENT
{{paste_code_or_file_paths}} Actions
Opening in Studio allows you to fill variables, use AI optimization, and save to your personal library.