Skip to content

Commit 2dc79a7

Browse files
authored
docs: add branch naming convention to AGENTS.md and CONTRIBUTING.md (#2678)
- AGENTS.md: branch naming as a requirement for AI coding agents - CONTRIBUTING.md: branch naming as a recommendation for human contributors - Convention: <type>/<number>-<short-slug> where number is issue or PR number Closes #2677
1 parent 3b024f9 commit 2dc79a7

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,32 @@ Implementation: Extends `YamlIntegration` (parallel to `TomlIntegration`):
379379
4. Uses `yaml.safe_dump()` for header fields to ensure proper escaping
380380
5. Sets `context_file = "AGENTS.md"` so the base setup manages the Spec Kit context section there
381381

382+
## Branch Naming Convention
383+
384+
All branches **must** follow this pattern:
385+
386+
```
387+
<type>/<number>-<short-slug>
388+
```
389+
390+
Where `<number>` is either an issue number or a PR number — whichever is created first.
391+
392+
| Prefix | When to use | Example |
393+
|---|---|---|
394+
| `feat/` | New features | `feat/2342-workflow-cli-alignment` |
395+
| `fix/` | Bug fixes | `fix/2653-paths-only-validation` |
396+
| `docs/` | Documentation changes | `docs/2677-branch-naming-convention` |
397+
| `community/` | Community catalog additions | `community/2492-add-mde-extension` |
398+
| `chore/` | Maintenance, tooling, CI | `chore/2366-editorconfig` |
399+
400+
**Rules:**
401+
402+
1. Always include the issue or PR number immediately after the prefix — this is what makes branches traceable
403+
2. Use kebab-case for the slug
404+
3. Keep the slug short — enough to identify the work without looking up the issue
405+
406+
---
407+
382408
## Common Pitfalls
383409

384410
1. **Using shorthand keys for CLI-based integrations**: For CLI-based integrations (`requires_cli: True`), the `key` must match the executable name (e.g., `"cursor-agent"` not `"cursor"`). `shutil.which(key)` is used for CLI tool checks — mismatches require special-case mappings. IDE-based integrations (`requires_cli: False`) are not subject to this constraint.

CONTRIBUTING.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ On [GitHub Codespaces](https://github.com/features/codespaces) it's even simpler
3838
1. Fork and clone the repository
3939
1. Configure and install the dependencies: `uv sync --extra test`
4040
1. Make sure the CLI works on your machine: `uv run specify --help`
41-
1. Create a new branch: `git checkout -b my-branch-name`
41+
1. Create a new branch: `git checkout -b <type>/<number>-<short-slug>` (see [Branch naming](#branch-naming) below)
4242
1. Make your change, add tests, and make sure everything still works
4343
1. Test the CLI functionality with a sample project if relevant
4444
1. Push to your fork and submit a pull request
@@ -55,6 +55,20 @@ Here are a few things you can do that will increase the likelihood of your pull
5555
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
5656
- Test your changes with the Spec-Driven Development workflow to ensure compatibility.
5757

58+
### Branch naming
59+
60+
We recommend naming branches as `<type>/<number>-<short-slug>`, where `<number>` is the issue or PR number (whichever comes first) and `<type>` is one of:
61+
62+
| Prefix | When to use | Example |
63+
|---|---|---|
64+
| `feat/` | New features | `feat/2342-workflow-cli-alignment` |
65+
| `fix/` | Bug fixes | `fix/2653-paths-only-validation` |
66+
| `docs/` | Documentation changes | `docs/2677-branch-naming-convention` |
67+
| `community/` | Community catalog additions | `community/2492-add-mde-extension` |
68+
| `chore/` | Maintenance, tooling, CI | `chore/2366-editorconfig` |
69+
70+
Including the issue or PR number makes branches traceable — especially useful since the project uses squash merges and `git branch --merged` won't detect merged branches. If you start with a PR (no issue), use the PR number once it's assigned.
71+
5872
## Development workflow
5973

6074
When working on spec-kit:

0 commit comments

Comments
 (0)