Skip to content

Commit e339513

Browse files
authored
more rules (#172)
* feat: make diffs more easy to understand * refactor: update the base cursorrules with alwaysApply * feat: add a new rule for working in existing projects
1 parent 1f3ccb1 commit e339513

File tree

3 files changed

+138
-1
lines changed

3 files changed

+138
-1
lines changed

.cursor/rules/000-cursor-rules.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Common glob patterns for different rule types:
6666
### Frontmatter
6767
- description: ACTION TRIGGER OUTCOME format
6868
- globs: `glob pattern for files and folders`
69+
- alwaysApply: `true | false`
6970

7071
### Body
7172
- <version>X.Y.Z</version>
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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>

bin/apply-rules.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ for rule_file in $DOTFILES_DIR/.cursor/rules/*.mdc; do
5656
;;
5757
[Dd]* )
5858
echo "📊 Showing diff for $filename:"
59-
diff -u "$target_path" "$rule_file"
59+
echo -e "\033[1;37m$(diff -u "$target_path" "$rule_file" | sed -e 's/^-/\x1b[1;31m-/;s/^+/\x1b[1;32m+/;s/^@/\x1b[1;36m@/')\033[0m"
6060
echo "----------------------------------------"
6161
;;
6262
* )

0 commit comments

Comments
 (0)