|
| 1 | +--- |
| 2 | +description: Git workflow, commit conventions, and pull request guidelines. (project) |
| 3 | +alwaysApply: true |
| 4 | +--- |
| 5 | + |
| 6 | +# Git Workflow |
| 7 | + |
| 8 | +This rule provides guidance on git workflow, commit conventions, and pull request guidelines. |
| 9 | + |
| 10 | +## Branch Strategy |
| 11 | + |
| 12 | +- **Never push directly to main** without permission |
| 13 | +- Create a new branch for changes |
| 14 | +- Create a pull request to merge into main |
| 15 | +- Use `git switch -c feature-name` to start |
| 16 | + |
| 17 | +## Development Flow |
| 18 | + |
| 19 | +1. Create feature branch: `git switch -c feature-name` |
| 20 | +2. Make changes to source files |
| 21 | +3. Run linter: `just lint` |
| 22 | +4. Run tests: `just test` |
| 23 | +5. Fix linting issues: `just lint-fix` |
| 24 | +6. Commit with detailed messages |
| 25 | +7. Push and create PR: `gh pr create` |
| 26 | + |
| 27 | +## Commit Strategy |
| 28 | + |
| 29 | +Keep commits tiny but meaningful: |
| 30 | + |
| 31 | +- Use git hunks (`-p` flag) to selectively commit changes |
| 32 | +- Write detailed commit messages |
| 33 | +- Ensure each commit is logically complete |
| 34 | +- Use English for all commit messages |
| 35 | + |
| 36 | +## Commit Message Format |
| 37 | + |
| 38 | +Format: `type(scope): description` |
| 39 | + |
| 40 | +Types: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `ci`, `perf` |
| 41 | + |
| 42 | +Example: |
| 43 | + |
| 44 | +``` |
| 45 | +feat(parser): add support for custom parameter transformers |
| 46 | +
|
| 47 | +- Add new transformer hooks to OpenAPI parser |
| 48 | +- Enable pre-processing of tool parameters |
| 49 | +- Implement docs for custom transformers |
| 50 | +``` |
| 51 | + |
| 52 | +### Guidelines |
| 53 | + |
| 54 | +- Keep each commit as tiny as possible |
| 55 | +- Write detailed commit messages explaining the "why" |
| 56 | +- Each commit should be meaningful (not just a single line change) |
| 57 | +- Use git hunks (`-p` flag) to selectively commit related changes |
| 58 | +- **Always use English** for commit messages |
| 59 | +- Reference issues and PRs when relevant |
| 60 | + |
| 61 | +### When Committing |
| 62 | + |
| 63 | +1. Run `git diff` to review all changes |
| 64 | +2. Use `git add -p` to review and stage hunks selectively |
| 65 | +3. Write comprehensive message explaining the purpose |
| 66 | +4. Verify with `git status` before committing |
| 67 | + |
| 68 | +### File Moves for History Preservation |
| 69 | + |
| 70 | +When moving files (e.g., migrating from skills to rules), combine the deletion and creation in a single commit so git treats it as a rename. This preserves file history. |
| 71 | + |
| 72 | +```bash |
| 73 | +# Instead of separate add/delete commits: |
| 74 | +git add .claude/rules/new-file.md |
| 75 | +git rm .claude/skills/old-file/SKILL.md |
| 76 | +git commit -m "refactor(rules): migrate old-file to rules directory" |
| 77 | +``` |
| 78 | + |
| 79 | +## Pull Request Guidelines |
| 80 | + |
| 81 | +### PR Title Format |
| 82 | + |
| 83 | +Use the same format as commit messages: `type(scope): description` |
| 84 | + |
| 85 | +Examples: |
| 86 | + |
| 87 | +- `feat(tools): add support for custom OpenAPI specs` |
| 88 | +- `fix(parser): handle empty response bodies` |
| 89 | +- `refactor(rules): unify cursor rules and claude rules` |
| 90 | + |
| 91 | +### PR Body |
| 92 | + |
| 93 | +Include: |
| 94 | + |
| 95 | +- **Summary**: 1-3 bullet points describing changes |
| 96 | +- **Test plan**: How to verify the changes work |
| 97 | +- Reference related issues with `Closes #123` or `Fixes #123` |
0 commit comments