-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathrules.mdc
More file actions
152 lines (111 loc) · 4.02 KB
/
rules.mdc
File metadata and controls
152 lines (111 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
description: How to create or update Cursor rule files for GoodData Python SDK repository
alwaysApply: false
---
# How to Create/Update Cursor Rule Files
## Rule File Structure
```
.cursor/rules/
├── cursor/ # Meta-rules about Cursor
│ ├── rules.mdc # This file
│ └── workflow-validation.mdc
├── general/ # Always-applied core rules
│ └── workflow-and-testing.mdc # ESSENTIAL: Keep concise!
└── libraries/ # Library-specific rules
└── gooddata-api-client.mdc
```
## Rule Categories
### General Rules (alwaysApply: true)
Located in `general/`, always included in context.
**CRITICAL**: Keep these concise - they're always loaded!
- Focus on essential workflows
- Use tables for quick reference
- Remove redundancy
- Typical size: 100-200 lines max
Example: `workflow-and-testing.mdc` (merged workflow + testing essentials)
### Library Rules (alwaysApply: false)
Located in `libraries/`, loaded when relevant.
Can be more detailed since they're conditional.
Example: `gooddata-api-client.mdc` (API client regeneration)
## Rule File Format
```markdown
---
description: Specific, keyword-rich description for Cursor's relevance detection
alwaysApply: true # or false
---
# Clear Title
## Essential sections only
```
### Writing Concise Rules
**DO**:
- ✅ Focus on commands and workflows
- ✅ Use tables for quick reference
- ✅ Include concrete examples
- ✅ Keep always-applied rules under 200 lines
- ✅ Merge related topics to avoid redundancy
**DON'T**:
- ❌ Repeat information across files
- ❌ Include every possible detail
- ❌ Write long explanations for obvious things
- ❌ Create separate files for related topics
## Description Guidelines
The `description` field is critical for Cursor's relevance matching.
**Good**:
```yaml
description: Essential development workflow and testing commands for GoodData Python SDK - formatting, linting, testing, and validation procedures
```
**Bad**:
```yaml
description: How to work with the code
```
Include keywords: package names, technologies, workflows, concepts.
## Creating New Rules
### When to Create
- ✅ Critical workflow not covered
- ✅ Library-specific patterns needed
- ✅ Common mistakes to prevent
### Process
1. **Determine category**: General (always) or Library (conditional)?
2. **Keep it concise**: Merge related topics
3. **Test usefulness**: Would this solve real problems?
4. **Check redundancy**: Does existing rule cover this?
### Example: Adding Library Rule
**User**: "Add rules for gooddata-sdk"
**Action**:
```bash
# Create libraries/gooddata-sdk.mdc with:
# - SDK-specific patterns (catalog services, data sources)
# - Common imports and class structures
# - Testing patterns for SDK
# - Integration with API client
```
Keep focused on SDK-specific knowledge, not general workflow (already in `general/`).
## Repository Context
### Package Structure
```
gooddata-api-client/ # Generated (DO NOT EDIT)
gooddata-sdk/ # Core SDK
gooddata-pandas/ # Pandas integration
gooddata-pipelines/ # Pipelines
```
### Key Files
- `Makefile` - Root commands (api-client, test, lint)
- `project_common.mk` - Shared package rules
- `pyproject.toml` - Ruff configuration
- `.pre-commit-config.yaml` - Pre-commit hooks
## Validation Checklist
Before committing a rule:
- [ ] Description is specific and keyword-rich
- [ ] If `alwaysApply: true`, file is under 200 lines
- [ ] No redundancy with other rules
- [ ] Commands are accurate and tested
- [ ] Examples are concrete
- [ ] File is in correct directory
## TODO: Future Rules
Only create if truly needed:
- [ ] `libraries/gooddata-sdk.mdc` - SDK patterns (if not covered by api-client rule)
- [ ] `libraries/gooddata-pandas.mdc` - Pandas integration (if needed)
## Related Rules
- **workflow-validation.mdc** - How Cursor reports used rules
- **workflow-and-testing.mdc** - Example of concise, merged general rule
- **libraries/gooddata-api-client.mdc** - Example of library-specific rule