Loading...
Loading...
Project documentation structure creation assistant. Acting as a senior product manager, it gains in-depth understanding of project requirements through multiple rounds of conversations, analyzes rationality and provides best practice suggestions, and finally generates a complete technical documentation system.
npx skill4agent add zhucl1006/ailesuperpowers aile-docs-initProject Initialization: project-docs-init (create documentation)
↓
Requirement Analysis: aile-requirement-analysis (structured requirement analysis + update documentation)
↓
Plan Formulation: aile-writing-plans (design + plan)
↓
Execution & Development: aile-executing-plans or aile-subagent-dev (execute according to plan + manual checkpoint)
↓
Delivery & Summary: aile-delivery-report (organize delivery materials + link back to Story)Phase 0: Mode Detection → Select process based on detection result
├─ Mode A (Create from requirements) → Phase 1A → Phase 2A → Phase 3A → Phase 4A → Phase 4 → Phase 5
└─ Mode B (Supplement from code) → Phase 1B → Phase 2B → Phase 3B → Phase 4 → Phase 5# Check for source code directories
ls -la src/ 2>/dev/null || ls -la app/ 2>/dev/null || ls -la lib/ 2>/dev/null
# Check for package.json or other project configuration files
ls -la package.json setup.py requirements.txt pom.xml 2>/dev/null
# Check git commit history
git log --oneline -10 2>/dev/nullif the project has code implementation (src/ or app/ directory exists with substantive code):
→ Mode B: Supplement documentation from existing code
else if user explicitly states "generate from code" or "supplement documentation":
→ Mode B: Supplement documentation from existing code
else:
→ Mode A: Create documentation from requirementsI have detected:
[Detection result description]
Recommended mode:
- Mode A: Create documentation from requirements (suitable for new projects)
- Mode B: Supplement documentation from existing code (suitable for projects with existing code)
Which mode would you like to use?Project Basic Information:
- Project Name: ?
- Project Type: Web Application/Mobile Application/Desktop Application/API Service/Other?
- Target Users: Who will use this product?
- Core Value: What problems does it solve?
- Expected Scale: User volume, data volume?
Business Background:
- Why is this project being developed?
- Are there any existing systems that need to be replaced?
- What are the key business scenarios?
- What are the success criteria?
Technical Constraints:
- Team Tech Stack: Frontend/Backend/Database?
- Technical Debt: Are there any mandatory technologies to use?
- Infrastructure: Cloud Service/Private Deployment?
- Compliance Requirements: Security/Privacy/Audit?For each module, understand:
1. Module name and responsibilities
2. Core function list
3. Dependencies with other modules
4. Priority (Mandatory for MVP / Subsequent iteration)
5. Estimated technical complexityFrontend:
- Framework: React/Vue/Angular/Other?
- State Management: Redux/MobX/Zustand/Other?
- UI Library: Ant Design/Material-UI/Self-developed?
- Build Tool: Vite/Webpack/Other?
Backend:
- Language: Node.js/Python/Java/Go/Other?
- Framework: Express/NestJS/Django/Spring/Other?
- API Style: REST/GraphQL/gRPC?
- Authentication Scheme: JWT/Session/OAuth?
Data Layer:
- Database: PostgreSQL/MySQL/MongoDB/Other?
- ORM: Prisma/TypeORM/SQLAlchemy/Other?
- Cache: Redis/Memcached?
- Message Queue: RabbitMQ/Kafka/Bull?
Infrastructure:
- Deployment: Docker/Kubernetes/Serverless?
- CI/CD: GitHub Actions/GitLab CI/Jenkins?
- Monitoring: Sentry/DataDog/Prometheus?✓ Advantage Identification:
- Which designs are reasonable?
- Is the tech stack selection suitable for the team?
- Is the function division clear?
⚠ Risk Identification:
- Technical risk: Using immature technology?
- Architecture risk: Excessively high module coupling?
- Business risk: Unclear requirements?
- Resource risk: Is the development cycle reasonable?
💡 Improvement Suggestions:
- Propose solutions for each risk
- Provide optimization suggestions based on best practices
- Explain the reasons and trade-offs of the suggestions1. Discuss the identified risks one by one
2. Ask for the user's opinions on the suggestions
3. Adjust the plan according to user feedback
4. In-depth discussion on controversial points
5. Enter the next stage after reaching consensusSystem Architecture:
- Overall architecture diagram (client/server/data layer/third-party services)
- Data flow
- Key technical components
- Deployment architecture
Module Architecture:
- Module division and responsibilities
- Interface definition between modules
- Dependency relationships
- Extension point design
Data Architecture:
- Core entities and relationships
- Data flow path
- Storage solution selection
- Data security and backupFor each key technical point:
1. Problem description
2. Optional solutions (2-3)
3. Solution comparison (performance/complexity/cost)
4. Recommended solution and reasons
5. Implementation stepsPhase 1 - MVP (Mandatory Functions):
- Core function module list
- Technical infrastructure construction
- Expected output
Phase 2 - Function Improvement:
- Supplementary function modules
- Performance optimization
- Expected output
Phase 3 - Optimization Iteration:
- User experience optimization
- Monitoring and operation and maintenance
- Expected output1. Show the architecture design
2. Explain the reasons for design decisions
3. Discuss points of concern to the user
4. Adjust the design plan
5. Final confirmationProject Overview:
✓ Project objectives and core values
✓ Target users and usage scenarios
✓ Core function modules
Technical Solution:
✓ Tech stack selection
✓ Architecture design
✓ Key technical decisions
Development Plan:
✓ Module division
✓ Development phases
✓ Priority sorting- Are there any special business rules?
- Are there any specific performance requirements?
- Are there any security and compliance requirements?
- Are there any third-party integration requirements?
- Are there any special development constraints?I will generate the following documentation for you:
1. docs/README.md
- Documentation index and navigation
- Project overview
- Documentation usage guide
2. docs/specs/PRD.md
- Product requirement document
- Function description
- User stories
- Acceptance criteria
3. docs/specs/SAD.md
- Software architecture design document
- System architecture
- Technology selection
- Module design
- Database design
4. docs/guides/AI-DEVELOPMENT-GUIDE.md
- AI development guide
- TDD process
- Code specifications
- Development conventions
5. docs/modules/*.md
- Detailed documentation for each module
- Interface definition
- Implementation description
Confirm to start generating documentation?Task: Analyze project code structure
- Identify main directories and file organization
- Find entry files and core modules
- Understand the overall structure of the projectFrontend Tech Stack:
- Framework: Identify from package.json or code imports
- State Management: Look for Redux/MobX/Zustand etc.
- UI Library: Identify component libraries
- Build Tool: Check configuration files
Backend Tech Stack:
- Language and Framework: Identify from file extensions and imports
- API Style: Analyze routes and controllers
- Authentication Scheme: Look for authentication middleware
- Database: Identify from configuration and ORM
Infrastructure:
- Containerization: Look for Dockerfile
- CI/CD: Look for .github/workflows etc.
- Configuration Management: Environment variables and configuration filesAnalyze using Explore agent:
1. What are the main functional modules?
2. What are the dependency relationships between modules?
3. What are the responsibilities of each module?
4. Is there a clear layered architecture?Analysis Focus:
1. Core business processes (such as user registration, order processing, etc.)
2. Data models and entity relationships
3. Key algorithms and business rules
4. Third-party service integration
5. Permission and security mechanismsArchitecture Analysis:
- Overall architecture: MVC/MVVM/Microservice/Monolithic?
- Frontend architecture: Componentization/modularization degree
- Backend architecture: Layered/Domain-driven/Event-driven?
- Data flow: Unidirectional/bidirectional data flow
- State management: Centralized/decentralizedEvaluation Dimensions:
✓ Advantages:
- Is the code organization clear?
- Is there test coverage?
- Does it follow best practices?
- How is the maintainability?
⚠ Issues:
- Technical debt (outdated dependencies, bad patterns)
- Missing functions (error handling, logs, etc.)
- Performance bottlenecks
- Security risksI have completed the code repository analysis, here are the findings:
Project Overview:
- Project Type: [Web Application/API Service/...]
- Tech Stack: [Frontend framework + Backend framework + Database]
- Code Scale: [Number of files/ lines of code]
Module Structure:
- Core Modules: [List main modules]
- Architecture Pattern: [MVC/Layered Architecture/...]
- Module Relationship: [Brief description]
Technical Assessment:
✓ Advantages: [List advantages]
⚠ Issues: [List areas for improvement]
Suggested documentation to supplement:
- [ ] PRD (Product Requirement Document)
- [ ] SAD (Architecture Design Document)
- [ ] Development Guide
- [ ] Module Documentation
- [ ] API Documentation
- [ ] Database Design Document
Confirm the above analysis? Are there any additions or corrections needed?# Check documentation directory structure
find docs/ -type f -name "*.md" 2>/dev/null
# Check README and other documentation
ls -la README.md CONTRIBUTING.md CHANGELOG.md 2>/dev/nullCore Documentation Check:
PRD (Product Requirement Document):
- Status: [Missing/Incomplete/Outdated/Complete]
- Issues: [List specific issues]
SAD (Architecture Design Document):
- Status: [Missing/Incomplete/Outdated/Complete]
- Issues: [List specific issues]
Development Guide:
- Status: [Missing/Incomplete/Outdated/Complete]
- Issues: [List specific issues]
Module Documentation:
- Status: [Missing/Incomplete/Outdated/Complete]
- Coverage: [X% of modules have documentation]
API Documentation:
- Status: [Missing/Incomplete/Outdated/Complete]
- Coverage: [X% of interfaces have documentation]
Database Documentation:
- Status: [Missing/Incomplete/Outdated/Complete]
- Issues: [List specific issues]Consistency Check:
1. Architecture description vs actual code structure
- Does the architecture diagram in the documentation match the code?
- Does the module division match?
2. API documentation vs actual interfaces
- Are all interfaces in the documentation implemented?
- Are there any undocumented interfaces?
- Are parameters and return values consistent?
3. Data model vs database schema
- Are entity relationships consistent?
- Do field definitions match?
4. Function description vs code implementation
- Are all functions in the documentation implemented?
- Are there any undocumented functions?Documentation Gap List:
Required Documentation (Missing or severely incomplete):
- [ ] PRD: [Specific missing content]
- [ ] SAD: [Specific missing content]
- [ ] Development Guide: [Specific missing content]
- [ ] Module Documentation: [Which modules are missing]
Important Documentation (Recommended to supplement):
- [ ] API Documentation: [Specific missing content]
- [ ] Database Design: [Specific missing content]
- [ ] Deployment Documentation: [Specific missing content]
Optional Documentation (Can be supplemented later):
- [ ] Test Documentation
- [ ] Performance Optimization Guide
- [ ] Troubleshooting GuideSupplement Strategy:
Priority P0 (Immediate supplement):
1. [Document Name]: [Reason for supplement]
2. [Document Name]: [Reason for supplement]
Priority P1 (Important but not urgent):
1. [Document Name]: [Reason for supplement]
2. [Document Name]: [Reason for supplement]
Priority P2 (Can be supplemented later):
1. [Document Name]: [Reason for supplement]
Supplement Method:
- Create from scratch: [List documents that need to be created from scratch]
- Update and improve: [List documents that need to be updated]
- Supplement details: [List documents that need details added]Based on code analysis and documentation check, I suggest:
Required documentation to supplement:
- [List P0 documents]
Recommended documentation to supplement:
- [List P1 documents]
What would you like me to do?
1. Supplement all required documentation (recommended)
2. Only supplement specific documentation (please specify)
3. Supplement all documentation (including optional)
4. Custom scopeProject Analysis Summary:
Code Repository Status:
✓ Tech Stack: [Frontend + Backend + Database]
✓ Architecture Pattern: [MVC/Layered/Microservice/...]
✓ Core Modules: [List main modules]
✓ Code Quality: [Overall assessment]
Existing Documentation Status:
- PRD: [Missing/Incomplete/Outdated]
- SAD: [Missing/Incomplete/Outdated]
- Development Guide: [Missing/Incomplete/Outdated]
- Module Documentation: [Coverage X%]
- API Documentation: [Coverage X%]
Suggested documentation to supplement:
P0: [Required document list]
P1: [Important document list]
P2: [Optional document list]I will supplement the following documentation for you, please confirm:
Required Documentation (Highly recommended):
- [ ] PRD (Product Requirement Document)
Generate product requirements reversely based on code functions
- [ ] SAD (Architecture Design Document)
Record current architecture design and technical decisions
- [ ] AI-DEVELOPMENT-GUIDE (Development Guide)
Generate development guide based on existing code specifications
Module Documentation:
- [ ] Generate documentation for [X] core modules
- [ ] Include interface definition and implementation description
API Documentation:
- [ ] Generate API documentation based on code
- [ ] Include parameters and return values for all interfaces
Database Documentation:
- [ ] Generate schema documentation based on data model
- [ ] Include entity relationship diagram
Which documentation would you like to generate?
1. All required documentation (recommended)
2. Required documentation + module documentation
3. All documentation
4. Custom selectionDocumentation Detail Level:
Option 1 - Standard Version (Recommended):
- Contains core information and key decisions
- Suitable for most projects
- Fast generation speed
Option 2 - Detailed Version:
- Contains detailed implementation instructions
- Contains code examples
- Suitable for complex projects or team collaboration
Option 3 - Simplified Version:
- Only contains the most core information
- Suitable for small projects or rapid iteration
Which detail level of documentation would you like to generate?I can understand the technical implementation from the code, but the following information needs your supplement:
Business Background:
- What is the business objective of the project?
- Who are the target users?
- What is the core value proposition?
- Why was the current technical solution selected?
Product Planning:
- What stage is it currently in (MVP/Growth/Maturity)?
- What are the future functional plans?
- Are there any known technical debts that need to be recorded?
This information will help me generate more accurate PRD and SAD documentation.Confirmation Information:
Documentation to be generated:
✓ docs/README.md - Documentation index
✓ docs/specs/PRD.md - Product requirements (based on code functions)
✓ docs/specs/SAD.md - Architecture design (based on code architecture)
✓ docs/guides/AI-DEVELOPMENT-GUIDE.md - Development guide
✓ docs/modules/*.md - [X] module documentation
✓ docs/api/api-spec.md - API documentation
✓ docs/database/SCHEMA.md - Database design
Documentation generation method:
- Based on code analysis results
- Combined with the business background you provided
- Consistent with code implementation
Confirm to start generating documentation?mkdir -p docs/plans
mkdir -p docs/specs
mkdir -p docs/guides
mkdir -p docs/modules
mkdir -p docs/database
mkdir -p docs/api./docs-templates/README-template.md./docs-templates/PRD-template.mdFunction: User Authentication
Status: ✓ Implemented
Implementation location: src/auth/
Description: JWT-based authentication mechanism (derived from code analysis)./docs-templates/SAD-template.md./docs-templates/AI-DEVELOPMENT-GUIDE-template.mddocs/modules/{module-name}.md
- Module overview (design description)
- Scope of responsibilities
- Interface definition
- Dependency relationships
- Implementation points
- Testing requirementsdocs/modules/{module-name}.md
- Module overview (analyzed from code)
- Scope of responsibilities (analyzed from code responsibilities)
- Interface definition (analyzed from code exports)
- Dependency relationships (analyzed from imports)
- Implementation description (key logic description)
- Existing tests (analyzed from test code)
- Improvement suggestions (if any)docs/database/SCHEMA.md (placeholder)
- Data model design
- Entity relationship diagram
- Table structure definition
- Index design
docs/database/MIGRATIONS.md (placeholder)
- Database migration recordsdocs/database/SCHEMA.md (generated from code)
- Data model (extracted from ORM models)
- Entity relationship (analyzed from model relationships)
- Table structure (extracted from schema files or migration files)
- Index design (extracted from code or database configuration)
- Database configuration (extracted from configuration files)
docs/database/MIGRATIONS.md
- Migration history (from migration file list)
- Important change recordsdocs/api/api-spec.md (placeholder)
- API design principles
- Interface specifications
- Authentication and authorization
- Error handlingdocs/api/api-spec.md (generated from code)
- API overview
- Authentication method (analyzed from authentication middleware)
- Interface list (extracted from route files)
- Endpoint path
- HTTP method
- Request parameters (analyzed from controller code)
- Response format (analyzed from code)
- Error codes (extracted from error handling code)
- General error handling
- API version management (if any)google-drivedocs-templates/google-drive-sync-integration.mdgoogle-drive02-功能規格/[Project Name]/specs|modules|guides|database|api公用云端硬碟/NewAile文件/02-功能規格/[Project Name]公用云端硬碟/AiPool文件/02-功能規格/[Project Name][Project Name]docs/**/*.mddocs/plans/**docs/specs/**/*.md.../[Project Name]/specsdocs/modules/**/*.md.../[Project Name]/modulesdocs/guides/**/*.md.../[Project Name]/guidesdocs/database/**/*.md.../[Project Name]/databasedocs/api/**/*.md.../[Project Name]/apidocs/.../[Project Name]/{relative-dir}google-driveThe following documentation has been generated:
✓ docs/README.md # Documentation index
✓ docs/specs/PRD.md # Product requirement document
✓ docs/specs/SAD.md # Architecture design document
✓ docs/guides/AI-DEVELOPMENT-GUIDE.md # AI development guide
✓ docs/modules/{module-1}.md # Module 1 documentation
✓ docs/modules/{module-2}.md # Module 2 documentation
✓ docs/modules/{module-3}.md # Module 3 documentation
○ docs/database/SCHEMA.md # Database design (placeholder)
○ docs/database/MIGRATIONS.md # Migration records (placeholder)
○ docs/api/api-spec.md # API documentation (placeholder)
✓ docs/plans/ # Plan directory (empty)
Google Drive sync result:
- specs: Synced / Pending manual supplementary upload
- modules: Synced / Pending manual supplementary uploadThe following documentation has been generated:
✓ docs/README.md # Documentation index
✓ docs/specs/PRD.md # Product requirements (based on code functions)
✓ docs/specs/SAD.md # Architecture design (based on code architecture)
✓ docs/guides/AI-DEVELOPMENT-GUIDE.md # Development guide (based on code specifications)
✓ docs/modules/{module-1}.md # Module 1 documentation (generated from code)
✓ docs/modules/{module-2}.md # Module 2 documentation (generated from code)
✓ docs/modules/{module-3}.md # Module 3 documentation (generated from code)
✓ docs/database/SCHEMA.md # Database design (extracted from ORM)
✓ docs/database/MIGRATIONS.md # Migration records (from migration files)
✓ docs/api/api-spec.md # API documentation (extracted from routes)
✓ docs/plans/ # Plan directory (empty)
Note: All documentation is generated based on code analysis, and information sources have been marked.
Google Drive sync result:
- specs: Synced / Pending manual supplementary upload
- modules: Synced / Pending manual supplementary uploadFor each documentation:
1. Show the documentation structure
2. Explain the key content
3. Ask if adjustments are needed
4. Modify according to feedbackDocumentation Maintenance Suggestions:
1. Update documentation regularly to keep it synchronized with code
2. Update SAD.md after each architecture change
3. Update PRD.md when adding new functions
4. Record major decisions in execution records
Follow-up Steps:
1. Review and improve the generated documentation
2. Supplement detailed database and API design
3. Use /project-workflow to start executing the development plan
Documentation location: {Project root directory}/docs/Documentation Maintenance Suggestions:
1. Regularly check the consistency between documentation and code
2. Update SAD.md in time after code refactoring
3. Update PRD.md and module documentation after adding new functions
4. Record important technical decisions and changes
Documentation Improvement Suggestions:
1. Supplement business background and product planning (PRD.md)
2. Improve the explanation of architecture decision reasons (SAD.md)
3. Supplement code examples and best practices (development guide)
4. Add troubleshooting and operation and maintenance documentation
Follow-up Steps:
1. Review the generated documentation and supplement missing information
2. Identify technical debt based on the documentation
3. Use /project-workflow to execute the improvement plan
4. Establish a documentation update mechanism
Documentation location: {Project root directory}/docs/✅ Project documentation system is completed!
[Display corresponding follow-up step suggestions according to the mode]