|
| 1 | +--- |
| 2 | +description: ALWAYS use when working with existing projects to establish agile workflow and documentation |
| 3 | +globs: |
| 4 | +alwaysApply: false |
| 5 | +--- |
| 6 | + |
| 7 | +# Existing Project Integration Workflow |
| 8 | + |
| 9 | +## Context |
| 10 | +- When working with an existing codebase that lacks agile documentation |
| 11 | +- When needing to understand and document an established project |
| 12 | +- When transitioning a project to the agile workflow |
| 13 | + |
| 14 | +## Requirements |
| 15 | + |
| 16 | +### Initial Project Analysis |
| 17 | +- Perform a comprehensive exploration of the codebase structure |
| 18 | +- Analyze git history to understand project evolution |
| 19 | +- Identify core components, dependencies, and architecture |
| 20 | +- Document existing functionality and features |
| 21 | + |
| 22 | +### Documentation Creation |
| 23 | + |
| 24 | +1. Create the `.ai` directory at the project root if it doesn't exist |
| 25 | +2. Generate PRD document based on existing functionality: |
| 26 | + - Use [901-prd.mdc](mdc:.cursor/rules/901-prd.mdc) as a template |
| 27 | + - Begin with "Reverse Engineered" status |
| 28 | + - Document observed project purpose and scope |
| 29 | + - Extract feature sets from existing implementation |
| 30 | + - Organize into logical Epics based on codebase structure |
| 31 | + - Mark current status based on git history analysis |
| 32 | +3. Generate Architecture document: |
| 33 | + - Use [902-arch.mdc](mdc:.cursor/rules/902-arch.mdc) as a template |
| 34 | + - Document existing technology stack and dependencies |
| 35 | + - Create diagrams of the observed architecture |
| 36 | + - Identify data models and schemas from the codebase |
| 37 | + - Document current project structure |
| 38 | +4. Create appropriate Epic and Story structure: |
| 39 | + - Use [903-story.mdc](mdc:.cursor/rules/903-story.mdc) as a template |
| 40 | + - Identify completed work based on git history |
| 41 | + - Document current work in progress |
| 42 | + - Create stories for incomplete features |
| 43 | + |
| 44 | +### Workflow Integration |
| 45 | + |
| 46 | +1. Consult with the user to validate understanding of: |
| 47 | + - Project purpose and goals |
| 48 | + - Architectural decisions |
| 49 | + - Feature organization |
| 50 | +2. Update documentation based on user feedback |
| 51 | +3. Apply standard agile workflow for ongoing work |
| 52 | + |
| 53 | +## Steps for Existing Project Analysis |
| 54 | + |
| 55 | +1. **Codebase Exploration** |
| 56 | + - List the directory structure to understand project organization |
| 57 | + - Examine key configuration files (package.json, requirements.txt, etc.) |
| 58 | + - Identify main entry points and core components |
| 59 | + - Analyze dependencies and third-party integrations |
| 60 | + |
| 61 | +2. **Git History Analysis** |
| 62 | + - Check recent commits to understand current work |
| 63 | + - Identify major releases or versions |
| 64 | + - Note contributors and their areas of focus |
| 65 | + - Recognize patterns in development flow |
| 66 | + |
| 67 | +3. **Documentation Generation** |
| 68 | + - Create PRD.md following the 901-prd.mdc template |
| 69 | + - Create arch.md following the 902-arch.mdc template |
| 70 | + - Establish Epic structure based on major feature sets |
| 71 | + - Document existing stories and create new ones as needed |
| 72 | + |
| 73 | +4. **User Consultation** |
| 74 | + - Present findings and seek clarification |
| 75 | + - Validate assumptions about project purpose and architecture |
| 76 | + - Confirm Epic and Story organization |
| 77 | + - Establish priorities for ongoing work |
| 78 | + |
| 79 | +## Examples |
| 80 | + |
| 81 | +<example> |
| 82 | +# Initial Project Analysis |
| 83 | + |
| 84 | +## Directory Structure Analysis |
| 85 | +``` |
| 86 | +$ ls -la |
| 87 | +total 928 |
| 88 | +drwxr-xr-x 18 user group 576 May 10 15:42 . |
| 89 | +drwxr-xr-x 21 user group 672 May 8 09:13 .. |
| 90 | +-rw-r--r-- 1 user group 182 May 8 09:30 .gitignore |
| 91 | +-rw-r--r-- 1 user group 1073 May 8 09:30 README.md |
| 92 | +drwxr-xr-x 8 user group 256 May 10 15:42 src |
| 93 | +drwxr-xr-x 12 user group 384 May 10 15:42 tests |
| 94 | +-rw-r--r-- 1 user group 12289 May 10 15:42 package.json |
| 95 | +... |
| 96 | +``` |
| 97 | + |
| 98 | +## Git History Analysis |
| 99 | +``` |
| 100 | +$ git log --oneline -n 10 |
| 101 | +a1b2c3d Added user authentication feature |
| 102 | +e4f5g6h Fixed responsive layout issues on mobile |
| 103 | +i7j8k9l Implemented product search functionality |
| 104 | +... |
| 105 | +``` |
| 106 | + |
| 107 | +## Major Components Identified |
| 108 | +1. User Authentication System |
| 109 | +2. Product Catalog |
| 110 | +3. Search Functionality |
| 111 | +4. Shopping Cart |
| 112 | +5. Checkout Process |
| 113 | + |
| 114 | +## Documentation Creation |
| 115 | +- Created .ai/prd.md with "Reverse Engineered" status |
| 116 | +- Created .ai/arch.md documenting observed React/Node architecture |
| 117 | +- Established Epic structure based on major components |
| 118 | +- Created stories for current work based on recent commits |
| 119 | + |
| 120 | +## User Consultation |
| 121 | +- Confirmed e-commerce focus with client |
| 122 | +- Clarified business goals for the platform |
| 123 | +- Verified technology choices and constraints |
| 124 | +- Agreed on priorities for ongoing development |
| 125 | +</example> |
| 126 | + |
| 127 | +<example type="invalid"> |
| 128 | +# Quick Analysis |
| 129 | + |
| 130 | +Looked at the code and here's what I found: |
| 131 | +- It seems to be a web app |
| 132 | +- Uses some JavaScript framework |
| 133 | +- Has a database |
| 134 | + |
| 135 | +Let's start working on new features right away. |
| 136 | +</example> |
0 commit comments