---
name: Auto Generate PRD
description: Generate complete PRD from project description file (no questions)
author: PRD Auto-Generator
version: 1.0.0
tags: [prd, automation, ai-generation]
---

# Auto-Generate PRD from Project Description

## Overview
Automatically generate a complete Product Requirements Document from a simple project description file. No user interaction required - full AI inference.

## Input File Detection

Look for description files in this order:
1. File specified by user: `--file path/to/description.md`
2. `project_description.md` (root directory)
3. `docs/project_description.md`
4. `PROJECT_DESCRIPTION.md`
5. `README.md` (if contains project description)

## Inference Rules

### Step 1: Read Description File

Extract:
- App name and purpose
- Target users
- Key features (3-10)
- Special requirements (compliance, offline, etc.)

### Step 2: Infer Project Type

**Keywords → Type:**
- "patient", "doctor", "medical", "health", "HIPAA", "telemedicine" → **healthcare**
- "payment", "bank", "transaction", "credit card", "financial", "PCI" → **fintech**
- "student", "teacher", "course", "learning", "education", "FERPA" → **education**
- "delivery", "tracking", "shipping", "logistics", "fleet" → **logistics**
- "shopping", "cart", "checkout", "ecommerce", "marketplace" → **ecommerce**
- "business", "workflow", "productivity", "SaaS", "enterprise" → **saas**
- None of above → **generic**

### Step 3: Infer Compliance Requirements

**Keywords → Compliance:**
- "HIPAA", "PHI", "protected health information" → Add "hipaa"
- "PCI-DSS", "PCI", "credit card", "payment card" → Add "pci-dss"
- "GDPR", "European", "EU users", "data protection" → Add "gdpr"
- "SOX", "Sarbanes-Oxley" → Add "sox"
- "COPPA", "children under 13", "parental consent" → Add "coppa"
- "FERPA", "student records" → Add "ferpa"
- "FDA", "medical device" → Add "fda"

### Step 4: Infer Platforms

**Default:** ["ios", "android"] (if not mentioned)

**Keywords → Platforms:**
- "iOS", "iPhone", "iPad" → Add "ios"
- "Android", "Play Store" → Add "android"
- "web", "website", "browser" → Add "web"
- "desktop", "Windows", "macOS" → Add respective platform

### Step 5: Infer Authentication Method

**Keywords → Auth Method:**
- "JWT", "JSON Web Token" → **jwt**
- "OAuth", "OAuth2", "social login" → **oauth2**
- "Firebase Auth", "Google sign-in" → **firebase**
- "Auth0", "Okta" → **auth0**

**Default:** "jwt"

### Step 6: Infer Offline Support

**Keywords → offline_support: true:**
- "offline", "work without internet", "rural areas"
- "sync", "background sync", "local storage"
- "airplane mode", "poor network"

**Default:** false

### Step 7: Infer Real-Time Requirements

**Keywords → real_time: true:**
- "real-time", "live", "instant", "WebSocket"
- "chat", "messaging", "notifications"
- "live updates", "streaming", "collaborative"

**Default:** false

### Step 8: Infer Sensitive Data

**Keywords → Sensitive Data:**
- "medical records", "health data", "diagnosis" → Add "phi"
- "personal information", "PII", "name", "email" → Add "pii"
- "credit card", "payment", "bank account" → Add "payment"
- "financial data", "balance", "transaction" → Add "financial"
- "biometric", "fingerprint", "Face ID" → Add "biometric"

### Step 9: Infer Team Size

**Calculate Complexity Score (S):**
- Compliance requirements: +2 per standard
- Platforms: +1 per platform
- Real-time: +2
- Offline: +2
- Complex features (video, ML, payments): +3 each
- Basic features (CRUD, lists): +1 each

**Score → Team Size:**
- S < 10: "small" (1-5 people)
- S 10-20: "medium" (6-15 people)
- S > 20: "large" (16+ people)

### Step 10: Infer Demo Frequency

**Keywords → Demo Frequency:**
- "weekly demo", "every week" → "weekly"
- "biweekly", "every two weeks" → "biweekly"
- "monthly", "once a month" → "monthly"
- No mention → "weekly" (default)

### Step 11: Infer Features with Complexity

**Complexity Heuristic:**
- **Low:** Simple CRUD, lists, forms, settings
- **Medium:** Authentication, search, filtering, dashboards
- **High:** Real-time chat, file upload, notifications, analytics
- **Critical:** Video/audio, payments, ML/AI, medical device integration

### Step 12: Generate Complete YAML Frontmatter

```yaml
---
# AUTO-GENERATED from project description
# Generated: [timestamp]
# Source: [filename]

project_name: "[Extracted from title]"
project_version: "1.0.0"
created_date: "[today]"
last_updated: "[today]"
generation_method: "auto"

project_type: "[inferred]"
compliance: [inferred list]
platforms: [inferred list]

auth_method: "[inferred]"
jwt_config:  # Only if auth_method is jwt
  algorithm: "RS256"
  access_token_expiry: "15m"
  refresh_token_expiry: "7d"
  validate_claims: ["aud", "iss", "exp", "sub"]

sensitive_data: [inferred list]
encryption_requirements:
  at_rest: "AES-256-GCM"
  in_transit: "TLS-1.3"
  e2e_required: [true if messaging]

offline_support: [inferred]
real_time: [inferred]
state_management: "bloc"
architecture_style: "clean_architecture"
backend_type: "rest"

features: [inferred list with complexity]

team_size: "[inferred]"
team_composition: [based on team_size]

performance_targets:
  cold_start_time: "2s"
  frame_rate: "60fps"
  api_response_time: "500ms"

testing_requirements:
  unit_test_coverage: [85-90 based on compliance]
  widget_test_coverage: [75-85 based on compliance]
  integration_tests_required: true

demo_frequency: "[inferred]"
demo_requirements:
  environment: "dedicated"
  entry_point: "lib/main_demo.dart"
  synthetic_data: [true if PHI/payment]

business_context:
  timeline: "[calculated from complexity]"
  mvp_timeline: "[40-50% of timeline]"
  target_users: [10k/50k/100k based on team size]

prprompts_config:
  generate_all_files: true
  verbosity: "detailed"
  include_junior_explanations: [true if juniors > 0]
  auto_generate_subagents: true

inference_notes:
  confidence_score: [0-100]
  ambiguous_fields: [list]
  assumptions: [list]
---
```

### Step 13: Generate Document Body

Generate complete PRD following template structure with:
1. Executive Summary (from description)
2. Product Vision (inferred)
3. Target Users (extracted or generated personas)
4. Core Features (expanded from list)
5. Non-Functional Requirements (based on inferred data)
6. Compliance Requirements (only for inferred standards)
7. Technical Architecture
8. Testing Strategy
9. Timeline & Milestones
10. All other standard sections

### Step 14: Add AI Inference Notes Section

At end of PRD:

```markdown
## 18. AI Inference Notes

**Generation Method:** Automatic (from project description)
**Inference Confidence:** [High/Medium/Low]

**Key Inferences:**
- Project Type: [type] (keywords: [list])
- Compliance: [list] (keywords: [list])
- Offline Support: [true/false] (reason: [explanation])
- Real-Time: [true/false] (reason: [explanation])

**Ambiguous Areas:**
[List low-confidence areas]

**Recommended Reviews:**
- [ ] Verify compliance requirements
- [ ] Review feature priorities
- [ ] Confirm timeline estimates
- [ ] Validate team size

**Manual Customization:**
To customize this auto-generated PRD:
1. Edit docs/PRD.md
2. Update YAML frontmatter
3. Regenerate PRPROMPTS: claude gen-prprompts
```

## Output File

Save complete PRD to: `docs/PRD.md`

## Success Message

```
✅ Auto-generated PRD from [filename]

Generated docs/PRD.md with:
- Project Type: [type]
- Compliance: [list or "None"]
- Platforms: [list]
- Features: [count] ([X] P0, [Y] P1)
- Team Size: [size]
- Timeline: [duration] (MVP: [duration])

Inference Confidence: [High/Medium/Low]

[If Medium/Low:]
⚠️  Some fields inferred with low confidence.
   Review section 18 (AI Inference Notes).

Next steps:
1. Review: cat docs/PRD.md
2. Customize if needed: vim docs/PRD.md
3. Analyze: claude analyze-prd
4. Generate PRPROMPTS: claude gen-prprompts

Auto-generate PRPROMPTS now? (y/n)
```

## Error Handling

### If description file not found:
```
❌ Error: No project description file found.

Searched locations:
- project_description.md
- docs/project_description.md
- PROJECT_DESCRIPTION.md

Please create a project description file with:
- What the app does
- Target users
- Key features (3-10)

Or specify file: claude auto-gen-prd --file path/to/description.md
```

### If description too vague:
```
⚠️  Warning: Low confidence in inference

Generated PRD with best guesses. Low confidence areas:
- Project type (assumed: generic)
- Compliance (none detected)
- Platforms (assumed: iOS + Android)

Please review docs/PRD.md and update as needed.
```
