| name | generate-spec |
| description | Generates app_spec.txt specification files from codebases. Use when you need to create specification documents, analyze code structure, document project architecture, or generate comprehensive project overviews in XML format. |
| allowed-tools | Read, Glob, Grep, Bash(find:*), Bash(tree:*), Bash(wc:*), Bash(git log*), Write |
Generate App Specification
Create comprehensive app specification files that document codebase structure, architecture, features, and implementation details in a standardized XML format.
When to Use
- Documenting an existing project
- Creating specs for handoff or onboarding
- Generating architecture documentation
- Analyzing unfamiliar codebases
Output Format
Generate XML following this structure (standard depth by default):
<project_specification>
<project_name>Name</project_name>
<overview>2-3 sentence description</overview>
<technology_stack>
<runtime>...</runtime>
<language>...</language>
<framework>...</framework>
<key_dependencies>...</key_dependencies>
</technology_stack>
<core_features>
<feature>
<name>...</name>
<description>...</description>
<location>...</location>
</feature>
</core_features>
<file_structure>
<directory name="...">
<key_files>...</key_files>
</directory>
</file_structure>
<configuration>...</configuration>
<running_the_project>...</running_the_project>
</project_specification>
Exploration Strategy
Step 1: Discover Project Type
Check for manifest files to identify the project:
| File | Project Type |
|---|---|
package.json |
Node.js / JavaScript / TypeScript |
Cargo.toml |
Rust |
go.mod |
Go |
pyproject.toml / requirements.txt |
Python |
pom.xml / build.gradle |
Java |
Gemfile |
Ruby |
composer.json |
PHP |
Read the manifest to identify:
- Project name and description
- Dependencies and dev dependencies
- Scripts/commands available
- Entry points
Step 2: Map Structure
- Use
treeorfindto get directory layout (exclude node_modules, .git, etc.) - Identify key directories:
src/,lib/,app/- source codetest/,tests/,__tests__/- testsconfig/,.config/- configurationpublic/,static/,assets/- static filesdocs/- documentation
- Count files by type to understand composition
Step 3: Analyze Architecture
Find and read entry points:
main.ts,index.ts,app.ts(TypeScript)main.js,index.js,app.js(JavaScript)main.py,app.py,__main__.py(Python)main.go,cmd/*/main.go(Go)src/main.rs,src/lib.rs(Rust)
Trace imports to understand module structure
Look for:
- Route definitions (API endpoints)
- Database models/schemas
- Configuration patterns
- Authentication/authorization
- Middleware
Step 4: Extract Features
- Read
README.mdfor stated features and usage - Analyze route handlers for actual features
- Check for integrations (OAuth, external APIs, etc.)
- Document UI components if frontend exists
- Note CLI commands if applicable
Step 5: Generate Spec
- Create
app_spec.txtin project root - Use XML format from TEMPLATES.md
- Include all discovered information
- Add file paths for key components
- Document how to run the project
Quality Guidelines
- Be specific: Include actual file paths, not generic descriptions
- Be accurate: Only document what exists, never invent features
- Be complete: Cover all major components and entry points
- Be concise: Standard depth covers essentials without exhaustive detail
- Be actionable: Include commands to install, build, run, and test
Depth Levels
When user requests different depths:
- Quick: project_name, overview, technology_stack (basics only), core_features (names only)
- Standard (default): All sections with moderate detail
- Comprehensive: Add database_schema, api_endpoints_summary, ui_layout, implementation_steps, success_criteria
See Also
- TEMPLATES.md - XML templates by project type and depth
- EXAMPLES.md - Complete example specifications