cursor-like-pro / rules
Cursor rule17 starsChanged 20 months agoMITView on GitHub
Git conventions and workflow guidelines using Conventional Commits
- Commits and pushes
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- .cursor/rules/cursor-rules.mdcCursor rule
- .cursor/rules/readme-conventions.mdcCursor rule
The file
Show its rules and text
We split this git-conventions.mdc into the rules it gives an agent
37 rules. About 0 are common, 35 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈35
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
All git-related text MUST be written in English:
- Distinctive: line 19
All commit messages MUST follow the Conventional Commits specification:
- Distinctive: line 50
Use the imperative, present tense: "change" not "changed" nor "changes"
- Distinctive: line 51
Don't capitalize first letter
- Distinctive: line 52
No dot (.) at the end
- Distinctive: line 79
All changes must come through Pull Requests
- Distinctive: line 102
Create PR from feature branch to main/master
- Distinctive: line 103
Use PR template if available
- Distinctive: line 105
All tests must pass
- Distinctive: line 146
Consider using pre-commit hooks to enforce these conventions:
- Distinctive: line 147
Commit message format validation
- Distinctive: line 246
Always create a feature branch first
- Distinctive: line 247
Use Pull Requests for merging changes
- Distinctive: line 259
Follow type/description format for branches
- Distinctive: line 260
Follow conventional commits for messages
- Distinctive: line 261
Keep descriptions clear and concise
- Distinctive: line 265
When using MCP Git with our recommended tools:
- Distinctive: line 270
Branch Protection: Ensure your repository has branch protection rules enabled for main/master
- Distinctive: line 277
When working with MCP Git operations, follow these guidelines for path handling:
- Distinctive: line 280
Use normalized Windows paths (backslashes)
- Distinctive: line 281
Remove URL encoding from paths
- Distinctive: line 282
Remove duplicate drive letters
- Distinctive: line 311
Always normalize paths before passing to MCP Git functions
- Distinctive: line 312
Use consistent path separators (Windows style for Windows)
- Distinctive: line 314
Remove any URL encoding artifacts
- Very specific: line 337
When using any MCP Git command, the repo_path parameter MUST follow these exact rules:
- Distinctive: line 352
Use forward slashes (/) instead of backslashes (\)
- Distinctive: line 353
Start with drive letter (e.g., C:/)
- Distinctive: line 354
NO URL encoding (%3A)
- Distinctive: line 355
NO duplicate drive letters
- Distinctive: line 356
NO leading slashes before drive letter
- Distinctive: line 372
When using MCP Git with other tools or systems:
- Distinctive: line 375
Ensure path normalization before passing to MCP Git
- Very specific: line 379
Use os.path functions for path manipulation
- Distinctive: line 380
Consider platform-specific path separators
- Distinctive: line 383
Keep path handling consistent across commits
- Distinctive: line 384
Document path handling requirements
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
description: Git conventions and workflow guidelines using Conventional Commits
globs:
alwaysApply: false
---
# Git Conventions and Workflow Guidelines 🔄
## Language Requirements
All git-related text MUST be written in English:
- Commit messages
- Branch names
- Pull request titles and descriptions
- Code review comments
- Issue titles and descriptions
## Commit Message Format
All commit messages MUST follow the [Conventional Commits](mdc:https:/www.conventionalcommits.org) specification:
```
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
```
### Types
- `feat`: A new feature
- `fix`: A bug fix
- `docs`: Documentation only changes
- `style`: Changes that do not affect the meaning of the code (formatting, etc)
- `refactor`: A code change that neither fixes a bug nor adds a feature
- `perf`: A code change that improves performance
- `test`: Adding missing tests or correcting existing tests
- `chore`: Changes to the build process or auxiliary tools
- `ci`: Changes to CI configuration files and scripts
### Scope
The scope should be the name of the component affected (as perceived by the person reading the changelog).
Examples:
- `feat(auth): add login with Google`
- `fix(api): handle null response from server`
- `docs(readme): update installation steps`
### Description
- Use the imperative, present tense: "change" not "changed" nor "changes"
- Don't capitalize first letter
- No dot (.) at the end
- Write in english
## Branch Naming Convention
Branches should follow this pattern:
```
<type>/<short-description>
```
For features and fixes that are tracked in a project management system, include the ticket number:
```
<type>/<ticket-number>-<short-description>
```
Examples:
- `feat/add-google-auth`
- `fix/handle-null-responses`
- `docs/update-readme`
- `feat/PROJ-123-add-google-auth`
- `fix/PROJ-456-handle-null-responses`
## Workflow Guidelines
1. **Protected Branches**
- `main` (or `master`): Production-ready code, protected branch
- Direct commits to protected branches are NOT allowed
- All changes must come through Pull Requests
2. **Feature Development**
```bash
# First, check if you're on a protected branch
git branch --show-current
# If on main/master, create and checkout a new feature branch
git checkout -b feat/my-new-feature main
# Make changes and commit
git add .
git commit -m "feat(scope): add new feature"
# Keep branch updated with main
git fetch origin main
git rebase origin/main
# Push changes
git push origin feat/my-new-feature
```
3. **Pull Request Process**
- Create PR from feature branch to main/master
- Use PR template if available
- Request at least 2 code reviews
- All tests must pass
- No merge conflicts
- Squash commits when merging
4. **Release Process**
```bash
# Create release branch from main
git checkout main
git pull origin main
git checkout -b release/v1.0.0
# After testing, merge back to main via PR
# After PR is approved and merged:
git checkout main
git pull origin main
git tag -a v1.0.0 -m "version 1.0.0"
git push origin main --tags
```
## Examples
✅ Good Commits:
```bash
feat(auth): implement JWT authentication
fix(api): handle edge case in user validation
docs(api): update API documentation
style(components): format according to style guide
refactor(database): optimize query performance
test(auth): add unit tests for login flow
```
❌ Bad Commits:
```bash
Fixed stuff
Updated code
WIP
Quick fix
```
## Pre-commit Hooks
Consider using pre-commit hooks to enforce these conventions:
- Commit message format validation
- Code linting
- Test execution
- Branch naming validation
- Protected branch validation
## Using MCP Git in Cursor 🤖
The Model Context Protocol (MCP) Git integration allows you to perform Git operations directly from Cursor while following our commit conventions.
> **Important**: For proper path handling in MCP Git operations, please refer to the `mcp-git-path-encoding.mdc` rule file. This ensures consistent path handling across different platforms and prevents encoding issues.
### Basic MCP Git Commands
1. **Check Current Branch and Create Feature Branch if Needed**
```python
# First check current branch
mcp_git_git_status(repo_path=".")
# If on main/master, create and switch to feature branch
mcp_git_git_create_branch(
repo_path=".",
branch_name="feat/my-new-feature",
base_branch="main"
)
mcp_git_git_checkout(
repo_path=".",
branch_name="feat/my-new-feature"
)
```
2. **Viewing Changes**
```python
# View unstaged changes
mcp_git_git_diff_unstaged(repo_path=".")
# View staged changes
mcp_git_git_diff_staged(repo_path=".")
```
3. **Making Commits**
```python
# First ensure you're not on a protected branch
status = mcp_git_git_status(repo_path=".")
if "main" in status or "master" in status:
# Create feature branch first
branch_name = "feat/my-feature"
mcp_git_git_create_branch(
repo_path=".",
branch_name=branch_name,
base_branch="main"
)
mcp_git_git_checkout(repo_path=".", branch_name=branch_name)
# Then stage and commit
mcp_git_git_add(repo_path=".", files=["path/to/file"])
mcp_git_git_commit(
repo_path=".",
message="feat(component): add new feature"
)
```
### MCP Git Workflow Example
```python
# 1. Check current branch
mcp_git_git_status(repo_path=".")
# 2. If on main/master, create feature branch
mcp_git_git_create_branch(
repo_path=".",
branch_name="feat/user-auth",
base_branch="main"
)
mcp_git_git_checkout(
repo_path=".",
branch_name="feat/user-auth"
)
# 3. Make changes and commit
mcp_git_git_add(repo_path=".", files=["src/auth/*"])
mcp_git_git_commit(
repo_path=".",
message="feat(auth): implement user authentication"
)
# 4. View commit history
mcp_git_git_log(repo_path=".", max_count=5)
```
### Best Practices for MCP Git
1. **Always Check Branch First**
```python
# Check current branch before any operations
mcp_git_git_status(repo_path=".")
```
2. **Never Commit Directly to Protected Branches**
- Always create a feature branch first
- Use Pull Requests for merging changes
3. **Review Changes Before Committing**
```python
# Review unstaged changes
mcp_git_git_diff_unstaged(repo_path=".")
# Review staged changes
mcp_git_git_diff_staged(repo_path=".")
```
4. **Use Meaningful Branch Names and Commit Messages**
- Follow type/description format for branches
- Follow conventional commits for messages
- Keep descriptions clear and concise
### Integration with Development Tools
When using MCP Git with our recommended tools:
1. **Commitlint**: MCP Git commits will be validated against our commit conventions
2. **Husky**: Pre-commit hooks will run on MCP Git commits
3. **CI/CD**: MCP Git commits trigger the same workflows as regular Git commits
4. **Branch Protection**: Ensure your repository has branch protection rules enabled for main/master
# MCP Git Path Encoding Guidelines 🛠️
## Path Handling in MCP Git Operations
When working with MCP Git operations, follow these guidelines for path handling:
1. **Path Format**
- Use normalized Windows paths (backslashes)
- Remove URL encoding from paths
- Remove duplicate drive letters
2. **Path Transformation**
```python
# Instead of using raw workspace path
repo_path = "/c%3A/Users/path/to/repo" # ❌ Wrong
# Transform the path before using
import os
def normalize_path(path):
# Remove URL encoding
path = path.replace("%3A", ":")
# Convert to Windows path format
path = path.replace("/", "\\")
# Remove leading slashes and handle drive letter properly
if ":" in path:
# Split on drive letter colon
parts = path.split(":", 1)
drive = parts[0].strip("\\") # Remove any leading slashes
remaining = parts[1]
path = f"{drive}:{remaining}"
return path
repo_path = normalize_path("/Users/path/to/repo") # ✅ Correct
# Result: c:\Users\path\to\repo
```
3. **Best Practices**
- Always normalize paths before passing to MCP Git functions
- Use consistent path separators (Windows style for Windows)
- Handle drive letter properly
- Remove any URL encoding artifacts
4. **Example Usage**
```python
# Before any MCP Git operation
repo_path = normalize_path(workspace_path)
# Then use in MCP Git commands
mcp_git_git_status(repo_path=repo_path)
mcp_git_git_add(repo_path=repo_path, files=["file.txt"])
mcp_git_git_commit(repo_path=repo_path, message="feat: add new feature")
```
5. **Common Issues to Avoid**
- Using paths with URL encoding (e.g. %3A)
- Using paths that start with / or \\ before the drive letter
- Mixing forward and backward slashes
- Using paths with improper encoding
## Critical Path Format Requirements for MCP Git
### Repo Path Format Specification
When using any MCP Git command, the `repo_path` parameter MUST follow these exact rules:
1. **Correct Format**
```
C:/Users/path/to/repo ✅ Correct
```
2. **Forbidden Formats**
```
/c%3A/Users/path/to/repo ❌ Wrong (URL encoded)
C:\c%3A\Users\path\to\repo ❌ Wrong (Duplicated drive)
\c%3A\Users\path\to\repo ❌ Wrong (Leading slash + encoding)
```
3. **Rules**
- Use forward slashes (/) instead of backslashes (\)
- Start with drive letter (e.g., C:/)
- NO URL encoding (%3A)
- NO duplicate drive letters
- NO leading slashes before drive letter
- Path must be absolute
4. **Example Usage in MCP Git Commands**
```python
# Correct usage
mcp_git_git_log(repo_path="C:/Users/path/to/repo")
mcp_git_git_status(repo_path="C:/Users/path/to/repo")
mcp_git_git_commit(repo_path="C:/Users/path/to/repo", message="feat: add feature")
```
> **IMPORTANT**: Failure to follow this exact format will result in path resolution errors and incorrect Git operations.
## Integration with Other Tools
When using MCP Git with other tools or systems:
1. **IDE Integration**
- Ensure path normalization before passing to MCP Git
- Handle workspace paths consistently
2. **Cross-platform Compatibility**
- Use `os.path` functions for path manipulation
- Consider platform-specific path separators
3. **Version Control**
- Keep path handling consistent across commits
- Document path handling requirementsDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

