prprompts-flutter-generator
Version:
AI-powered Flutter development with full automation + official extension support - Generate 32 security-audited guides & auto-implement in 2-3 hours. NEW v5.1: Official Claude Code plugin with hooks, Gemini TOML commands, Qwen MCP settings. Features: Comp
530 lines (417 loc) ⢠17.6 kB
Markdown
---
name: Auto-Generate PRD from All Project Files
description: Automatically discover and consolidate all markdown files in project into comprehensive PRD
author: Auto PRD Generator
version: 1.0.0
tags: [prd, automation, discovery, consolidation]
---
# Auto-Generate PRD from All Project Markdown Files
## Overview
Automatically discover ALL `.md` files in the project, analyze their content, map to appropriate PRD sections using filename patterns, and generate a comprehensive PRD with fresh YAML frontmatter.
## Instructions
### Step 1: Discover All Markdown Files
Use glob pattern to find ALL `.md` files in project:
```bash
# Find all markdown files (no exclusions)
**/*.md
```
List all discovered files to user:
```
š Discovered Markdown Files:
- README.md
- docs/requirements.md
- docs/features.md
- docs/architecture.md
- features/user-auth.md
- features/dashboard.md
- [... all other .md files]
Total: XX markdown files found
Proceeding to analyze and consolidate...
```
### Step 2: Categorize Files by Pattern
Map each file to PRD section using filename patterns (priority order):
**Pattern Matching Rules:**
1. **README.md** ā Executive Summary + Product Vision (highest priority)
2. **requirements*.md** (case-insensitive) ā Requirements section
3. **features*.md** or **feature*.md** ā Features section
4. **user*.md** or **persona*.md** ā Target Users section
5. **architecture*.md** or **tech*.md** or **technical*.md** ā Technical Architecture
6. **security*.md** or **compliance*.md** ā Security & Compliance section
7. **api*.md** ā API Specifications
8. **design*.md** or **ui*.md** or **ux*.md** ā Design section
9. **test*.md** or **qa*.md** ā Testing Strategy
10. **deploy*.md** or **release*.md** ā Deployment section
11. **risk*.md** ā Risks & Mitigation
12. **timeline*.md** or **roadmap*.md** or **schedule*.md** ā Timeline/Roadmap
13. **metric*.md** or **kpi*.md** or **success*.md** ā Success Metrics
14. **glossary*.md** or **terms*.md** ā Glossary/Appendices
15. **Others** ā Categorized by directory name or Appendices
**Directory-based fallback categorization:**
- Files in `/features/` or `/feature/` ā Features
- Files in `/docs/requirements/` ā Requirements
- Files in `/architecture/` or `/arch/` ā Technical Architecture
- Files in `/api/` ā API Specifications
- Files in `/design/` ā Design
- Files in `/compliance/` or `/security/` ā Security & Compliance
- Unknown ā Appendices (preserve as-is)
### Step 3: Read and Parse Each File
For each discovered file:
1. **Read full content**
2. **Extract headers** (H1, H2, H3 for structure)
3. **Identify key information**:
- Compliance mentions (HIPAA, PCI-DSS, GDPR, SOX, COPPA, FERPA)
- Platform mentions (iOS, Android, Web, Windows, macOS, Linux)
- Technology stack (Flutter, React Native, Node.js, PostgreSQL, etc.)
- Authentication methods (JWT, OAuth2, Firebase, Auth0)
- Feature lists (bullet points, numbered lists)
- Team mentions (developers, designers, QA, etc.)
- Timeline/dates (MVP timeline, launch date, milestones)
- User personas (target users, user types)
4. **Note source** (file path for traceability)
### Step 4: Analyze Content for YAML Frontmatter
Scan ALL content to extract metadata:
**Project Type Detection:**
Look for keywords to determine `project_type`:
- "patient", "medical", "healthcare", "PHI", "HIPAA" ā `healthcare`
- "payment", "transaction", "banking", "fintech", "PCI" ā `fintech`
- "student", "education", "learning", "LMS", "COPPA", "FERPA" ā `education`
- "delivery", "logistics", "shipping", "tracking", "route" ā `logistics`
- "ecommerce", "shopping", "cart", "checkout", "store" ā `ecommerce`
- "SaaS", "B2B", "tenant", "subscription", "enterprise" ā `saas`
- Default ā `generic`
**Compliance Detection:**
Extract from content:
- "HIPAA" ā add `"hipaa"` to `compliance` array
- "PCI-DSS", "PCI DSS", "payment card" ā add `"pci-dss"`
- "GDPR", "European data", "EU privacy" ā add `"gdpr"`
- "SOX", "Sarbanes" ā add `"sox"`
- "COPPA", "children under 13" ā add `"coppa"`
- "FERPA", "education records" ā add `"ferpa"`
- "FDA", "medical device" ā add `"fda"`
**Platforms Detection:**
- "iOS", "iPhone", "iPad", "Apple" ā add `"ios"`
- "Android" ā add `"android"`
- "Web", "browser", "webapp" ā add `"web"`
- "Windows" ā add `"windows"`
- "macOS", "Mac" ā add `"macos"`
- "Linux" ā add `"linux"`
**Authentication Method:**
- "JWT", "JSON Web Token" ā `auth_method: "jwt"`
- "OAuth", "OAuth2", "OpenID" ā `auth_method: "oauth2"`
- "Firebase Auth" ā `auth_method: "firebase"`
- "Auth0" ā `auth_method: "auth0"`
- Default ā `auth_method: "jwt"`
**Sensitive Data:**
- "PHI", "Protected Health Information" ā add `"phi"`
- "PII", "personally identifiable" ā add `"pii"`
- "payment", "credit card" ā add `"payment"`
- "financial data" ā add `"financial"`
- "biometric" ā add `"biometric"`
**Architecture Flags:**
- "offline", "offline-first", "local storage" ā `offline_support: true`
- "real-time", "websocket", "live updates" ā `real_time: true`
- "BLoC" ā `state_management: "bloc"`
- "Riverpod" ā `state_management: "riverpod"`
- "Provider" ā `state_management: "provider"`
- "GetX" ā `state_management: "getx"`
- "Clean Architecture" ā `architecture_style: "clean_architecture"`
- "REST", "RESTful" ā `backend_type: "rest"`
- "GraphQL" ā `backend_type: "graphql"`
- "Firebase" ā `backend_type: "firebase"`
**Team Composition:**
Look for team size mentions:
- "X developers", "Y person team" ā extract numbers
- "junior developer" ā count juniors
- "senior developer" ā count seniors
- "QA", "tester" ā count QA
- "designer" ā count design
- Map to `team_size`: small (1-5), medium (6-15), large (16+)
**Timeline:**
- Look for "X months", "Y weeks", "launch in Z"
- Extract project timeline
- Extract MVP timeline if mentioned separately
**Features Extraction:**
- Parse all feature lists from features*.md files
- Extract feature names from headers
- Determine complexity from keywords:
- "critical", "complex", "advanced" ā `complexity: "critical"`
- "high priority", "difficult" ā `complexity: "high"`
- "medium", "moderate" ā `complexity: "medium"`
- "simple", "basic", "easy" ā `complexity: "low"`
- Determine priority from keywords:
- "must have", "essential", "required", "P0" ā `priority: "p0"`
- "should have", "important", "P1" ā `priority: "p1"`
- "nice to have", "optional", "P2" ā `priority: "p2"`
### Step 5: Generate YAML Frontmatter
Construct complete frontmatter from analyzed data:
```yaml
---
# PROJECT METADATA
project_name: "[Inferred from README or directory name]"
project_version: "1.0.0"
created_date: "[Today's date YYYY-MM-DD]"
last_updated: "[Today's date]"
# CLASSIFICATION
project_type: "[Detected type: healthcare/fintech/education/logistics/ecommerce/saas/generic]"
compliance: [Detected compliance requirements] # ["hipaa", "gdpr", etc.] or []
platforms: [Detected platforms] # ["ios", "android", "web"]
# AUTHENTICATION & SECURITY
auth_method: "[Detected: jwt/oauth2/firebase/auth0/custom]"
jwt_config: # Only if auth_method is jwt
algorithm: "RS256" # Default, override if specified
access_token_expiry: "15m"
refresh_token_expiry: "7d"
validate_claims: ["aud", "iss", "exp", "sub"]
oauth2_config: # Only if auth_method is oauth2
providers: [Detected providers] # ["google", "microsoft", etc.]
sensitive_data: [Detected data types] # ["phi", "pii", "payment", etc.]
encryption_requirements:
at_rest: "AES-256-GCM" # Default for sensitive data
in_transit: "TLS-1.3"
e2e_required: [true if messaging/chat detected, else false]
# ARCHITECTURE
offline_support: [Detected: true/false]
real_time: [Detected: true/false]
state_management: "[Detected: bloc/riverpod/provider/getx or default to bloc]"
architecture_style: "clean_architecture" # Default
backend_type: "[Detected: rest/graphql/grpc/firebase]"
# FEATURES (extracted from content)
features:
- name: "[Feature 1 from features*.md]"
complexity: "[Detected: low/medium/high/critical]"
priority: "[Detected: p0/p1/p2]"
notes: "[Any notes from content]"
- name: "[Feature 2]"
complexity: "[Detected]"
priority: "[Detected]"
# ... all detected features
# TEAM (inferred from content)
team_size: "[Detected: small/medium/large]"
team_composition:
mobile:
size: [Detected count or estimate]
junior: [Detected count]
mid: [Estimated]
senior: [Detected count]
backend:
size: [Detected count or estimate]
tech_stack: [Detected technologies] # ["node.js", "postgresql", etc.]
qa:
size: [Detected count or estimate]
design:
size: [Detected count or estimate]
# PERFORMANCE & QUALITY
performance_targets:
cold_start_time: "2s" # Default
frame_rate: "60fps"
api_response_time: "500ms" # Override if specified
testing_requirements:
unit_test_coverage: 85 # Default, override if specified
widget_test_coverage: 75
integration_tests_required: true
# DEPLOYMENT
demo_frequency: "[Detected: none/weekly/biweekly/monthly or default to none]"
# BUSINESS
business_context:
timeline: "[Detected timeline]"
mvp_timeline: "[Detected MVP timeline or default to half of timeline]"
target_users: [Detected user count or default to 10000]
# CUSTOMIZATION
prprompts_config:
generate_all_files: true
verbosity: "detailed"
include_junior_explanations: [true if junior devs detected, else false]
auto_generate_subagents: true
---
```
### Step 6: Organize Content into PRD Sections
Build complete PRD markdown body:
#### Section 1: Executive Summary
- Source: README.md primary content
- Fallback: Synthesize from all content
- 2-3 paragraphs covering:
- What the app does
- Target users (from user*.md files)
- Core value proposition
- Key differentiators
#### Section 2: Product Vision
- Source: README.md, vision*.md
- Include:
- Problem being solved
- Long-term vision (3-5 years)
- Success metrics (from metric*.md)
#### Section 3: Target Users
- Source: user*.md, persona*.md
- Format:
- **Primary Users:** [List personas from files]
- **Secondary Users:** [List if present]
#### Section 4: Core Features (Detailed)
- Source: features*.md, feature*.md files
- For each feature detected:
- **4.X [Feature Name]**
- **Description:** [From file content]
- **User Stories:** [Extract if present, else generate]
- **Acceptance Criteria:** [Extract if present]
- **Technical Requirements:** [From technical*.md]
- **Compliance Considerations:** [If compliance detected]
#### Section 5: Non-Functional Requirements
- Source: requirements*.md (non-feature requirements)
- Include: Performance, Security, Scalability, Availability
#### Section 6: Compliance & Regulatory Requirements
- Source: compliance*.md, security*.md
- Detail each compliance requirement from frontmatter
#### Section 7: User Flows
- Source: flow*.md, journey*.md
- Include diagrams if present (as code blocks)
#### Section 8: Data Model
- Source: data*.md, model*.md, schema*.md
- Include entity descriptions
#### Section 9: API Specifications
- Source: api*.md
- Include endpoints, request/response formats
#### Section 10: Design Guidelines
- Source: design*.md, ui*.md, ux*.md
- Include style guides, component specs
#### Section 11: Technical Architecture
- Source: architecture*.md, tech*.md, technical*.md
- Include system diagrams, tech stack details
#### Section 12: Testing Strategy
- Source: test*.md, qa*.md
- Include test types, coverage requirements
#### Section 13: Deployment & DevOps
- Source: deploy*.md, devops*.md, release*.md
- Include CI/CD, environments
#### Section 14: Project Timeline & Milestones
- Source: timeline*.md, roadmap*.md, schedule*.md
- Include phases, milestones, deadlines
#### Section 15: Risks & Mitigation
- Source: risk*.md
- Include identified risks and mitigation strategies
#### Section 16: Success Metrics & KPIs
- Source: metric*.md, kpi*.md, success*.md
- Include measurable success criteria
#### Section 17: Glossary & Appendices
- Source: glossary*.md, terms*.md
- Include all other uncategorized files
- Maintain source file references
### Step 7: Handle Duplicate Content
If same information appears in multiple files:
1. **Consolidate**: Merge into single section
2. **Preserve unique details**: Keep all non-duplicate information
3. **Flag conflicts**: Note when files contradict each other
4. **Cite sources**: Add comment `<!-- Source: path/to/file.md -->`
### Step 8: Generate Complete PRD File
Write to `docs/PRD.md`:
```markdown
[YAML Frontmatter from Step 5]
---
# [Project Name] - Product Requirements Document
**Version:** 1.0.0
**Last Updated:** [Date]
**Generated From:** [X] markdown files across project
---
## Document Change Log
| Version | Date | Changes | Source Files |
|---------|------|---------|--------------|
| 1.0.0 | [Date] | Initial PRD auto-generated from project files | [Count] .md files |
---
## File Sources
This PRD was automatically generated by consolidating the following markdown files:
[Bulleted list of all source files with paths]
---
[Section 1: Executive Summary]
[Section 2: Product Vision]
[... All 17 sections ...]
---
## Source File References
Detailed mapping of PRD sections to source files:
- Executive Summary: `README.md`
- Features: `docs/features.md`, `features/user-auth.md`, [...]
- Technical Architecture: `docs/architecture.md`
- [... complete mapping]
---
*This PRD was automatically generated from project markdown files.*
*Review and customize as needed before generating PRPROMPTS.*
```
### Step 9: Validation & Output
After generating PRD:
1. **Validate YAML**: Ensure frontmatter is valid YAML syntax
2. **Check completeness**: Verify all 17 sections have content
3. **Flag missing info**: Warn about any critical missing data
4. **Output message**:
```
ā
Auto-generated PRD at docs/PRD.md
š Generation Summary:
- Source files processed: XX markdown files
- Project type detected: [Type]
- Compliance detected: [List]
- Platforms detected: [List]
- Features extracted: XX
- Sections populated: 17/17
š File Mapping:
- Executive Summary ā README.md
- Features ā docs/features.md, features/*.md (X files)
- Architecture ā docs/architecture.md
- [... top 5 mappings]
ā ļø Review Needed:
[List any missing critical information or conflicts]
š” Next Steps:
1. Review generated PRD: cat docs/PRD.md
2. Customize/refine as needed
3. Analyze quality: claude analyze-prd
4. Improve if needed: claude refine-prd
5. Generate PRPROMPTS: claude gen-prprompts
The generated PRD includes source file references for traceability.
Want to analyze the PRD quality now? (y/n)
```
3. **If user says "y"**: Automatically run `analyze-prd` command
## Content Analysis Guidelines
**When analyzing content:**
1. **Be comprehensive**: Read ALL discovered files completely
2. **Preserve detail**: Don't lose important information during consolidation
3. **Intelligent inference**: Make reasonable assumptions when data is implicit
4. **Flag ambiguity**: Note when content is unclear or contradictory
5. **Maintain traceability**: Always cite source files
6. **Respect structure**: Use existing headers and organization where clear
**Quality indicators:**
- ā
**High confidence**: Multiple files confirm same information
- ā ļø **Medium confidence**: Information from single file, seems reasonable
- ā **Low confidence**: Conflicting information or heavy inference needed
## Error Handling
**If no .md files found:**
```
ā No markdown files found in project.
Suggestions:
1. Ensure you're in the project root directory
2. Create initial docs (README.md, requirements.md, features.md)
3. Or use: claude create-prd (interactive wizard)
```
**If only README.md found:**
```
ā ļø Only README.md found. PRD will be basic.
Recommendation:
- Use claude create-prd for comprehensive PRD creation
- Or add more documentation files (requirements.md, features.md, etc.)
Proceed with README.md only? (y/n)
```
**If critical frontmatter data missing:**
```
ā ļø Could not detect:
- Project type (defaulted to 'generic')
- Timeline (please add manually)
- Team size (defaulted to 'medium')
PRD generated but needs manual review.
```
## Notes
- **No exclusions**: Scans ALL directories (AI filters irrelevant content)
- **Fresh frontmatter**: Always generates new YAML from content analysis
- **Filename patterns**: Primary categorization method
- **Directory fallback**: Used when filename doesn't match patterns
- **Traceability**: Source files referenced for audit trail
- **Idempotent**: Can re-run safely, overwrites docs/PRD.md
## Limitations
- Cannot read non-markdown files (images, PDFs, code files)
- Inference may miss implicit requirements
- May over-consolidate closely related but distinct concepts
- YAML generation is best-effort, may need manual adjustment
- Pattern matching is case-insensitive but requires English filenames