Skip to content

Commit e3f8bee

Browse files
authored
Cursor Rules: Add development QA and git commit standards (#488)
- Add dev-loop.mdc: QA process for code edits - Type checking with mypy - Linting with ruff - Test validation with pytest - Ensures edits are validated before commits - Add git-commits.mdc: Commit message standards - Structured format with why/what sections - Defined commit types and guidelines - Examples of good/bad commits - AI assistance instructions Note: These rules help maintain code quality and commit history consistency across the project. See also: https://docs.cursor.com/context/rules-for-ai
2 parents 46409a6 + c3ec643 commit e3f8bee

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed

.cursor/rules/dev-loop.mdc

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
description: QA every edit
3+
globs: *.py
4+
---
5+
6+
# First: QA Every edit
7+
8+
Run these commands between edits:
9+
10+
Check typings:
11+
12+
```
13+
uv run mypy
14+
```
15+
16+
Lint:
17+
18+
```
19+
uv run ruff check . --fix; uv run ruff format .;
20+
```
21+
22+
Check tests:
23+
24+
```
25+
uv run py.test
26+
```
27+
28+
Between every edit, rerun:
29+
- Type checks
30+
- Lint
31+
- Tests
32+
33+
If there's any failures *due to the edits*, fix them first, then:
34+
35+
# When your edit is complete: Commit it
36+
37+
Make an atomic commit for the edit, using conventional commits.

.cursor/rules/git-commits.mdc

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
description: git-commits: Git commit message standards and AI assistance
3+
globs: git-commits: Git commit message standards and AI assistance | *.git/* .gitignore .github/* CHANGELOG.md CHANGES.md
4+
---
5+
# Git Commit Standards
6+
7+
## Format
8+
```
9+
type(scope[component]): concise description
10+
11+
why: explanation of necessity/impact
12+
what:
13+
- technical changes made
14+
- keep focused on single topic
15+
16+
refs: #issue-number, breaking changes, links
17+
```
18+
19+
## Commit Types
20+
- `feat`: New features/enhancements
21+
- `fix`: Bug fixes
22+
- `refactor`: Code restructuring
23+
- `docs`: Documentation changes
24+
- `chore`: Maintenance tasks (deps, tooling)
25+
- `test`: Test-related changes
26+
- `style`: Code style/formatting
27+
28+
## Guidelines
29+
- Subject line: max 50 chars
30+
- Body lines: max 72 chars
31+
- Use imperative mood ("Add" not "Added")
32+
- Single topic per commit
33+
- Blank line between subject and body
34+
- Mark breaking changes with "BREAKING:"
35+
- Use "See also:" for external links
36+
37+
## AI Assistance in Cursor
38+
- Stage changes with `git add`
39+
- Use `@commit` to generate initial message
40+
- Review and adjust the generated message
41+
- Ensure it follows format above
42+
43+
## Examples
44+
45+
Good commit:
46+
```
47+
feat(subprocess[run]): Switch to unicode-only text handling
48+
49+
why: Improve consistency and type safety in subprocess handling
50+
what:
51+
- BREAKING: Changed run() to use text=True by default
52+
- Removed console_to_str() helper and encoding logic
53+
- Simplified output handling
54+
- Updated type hints for better safety
55+
56+
refs: #485
57+
See also: https://docs.python.org/3/library/subprocess.html
58+
```
59+
60+
Bad commit:
61+
```
62+
updated some stuff and fixed bugs
63+
```
64+
65+
Cursor Rules: Add development QA and git commit standards (#cursor-rules)
66+
67+
- Add dev-loop.mdc: QA process for code edits
68+
- Type checking with mypy
69+
- Linting with ruff
70+
- Test validation with pytest
71+
- Ensures edits are validated before commits
72+
73+
- Add git-commits.mdc: Commit message standards
74+
- Structured format with why/what sections
75+
- Defined commit types and guidelines
76+
- Examples of good/bad commits
77+
- AI assistance instructions
78+
79+
Note: These rules help maintain code quality and commit history
80+
consistency across the project.
81+
82+
See also: https://docs.cursor.com/context/rules-for-ai

CHANGES

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ $ pip install --user --upgrade --pre libvcs
1515

1616
<!-- Maintainers, insert changes / features for the next release here -->
1717

18+
### Development
19+
20+
- Cursor rules for development loop and git commit messages (#488)
21+
1822
## libvcs 0.35.0 (2025-02-22)
1923

2024
### Breaking changes

0 commit comments

Comments
 (0)