agentleFS
golid-aigolid-ai/golid/.cursor/rules/git-commits.mdc

golid / rules

Cursor rule40 starsChanged 6 months agoMITView on GitHub

Git commit and branch conventions

  • Reads credentials

The file

We split this git-commits.mdc into the rules it gives an agent

8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    No period at end of first line

    line 39
  2. Very specific:

    Before committing code that touches module-owned files, run scripts/check_spec_drift.sh <base-ref> and fix any drift in the same commit.

    line 42
  3. Very specific:

    Use HEREDOC for multi-line: git commit -m "$(cat <<'EOF' ...

    line 43
  4. Very specific:

    Do NOT commit .env, credentials, or secret files

    line 44
  5. Distinctive:

    Do NOT amend commits that have been pushed

    line 45
  6. Very specific:

    If you're writing one, name it explicitly: chore: sweep-up shared-file edits from <batch-name>.

    line 53
  7. Distinctive:

    When in doubt: smaller. Squashing later is trivial.

    line 70
  8. Very specific:

    Use the same type prefixes as commits: feat/payment-schedule, fix/token-expiry, chore/upgrade-deps, docs/api-reference.

    line 89

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
git-commits.mdc
---
description: Git commit and branch conventions
alwaysApply: true
---

# Git Commits

> **Thesis:** Atomic commits with consistent prefixes make history scannable,
> bisectable, and reviewable. One logical change per commit, imperative mood,
> body explains "why" not "what".

## Commit Message Format

```
type: short description (imperative, lowercase after type)

Optional body explaining the "why" — not the "what".
Keep to 1-3 sentences. Reference specific files or functions
only when it adds clarity.
```

## Types

| Type | When |
|---|---|
| `feat` | New feature or capability |
| `fix` | Bug fix |
| `refactor` | Code restructure with no behavior change |
| `perf` | Performance improvement |
| `docs` | Documentation only |
| `test` | Adding or updating tests |
| `chore` | Deps, config, CI, dead code removal |
| `style` | Formatting, whitespace, CSS-only changes |

## Rules

- First line under 72 characters
- Imperative mood: "add", "fix", "remove" — not "added", "fixes", "removing"
- No period at end of first line
- Body separated from title by blank line
- One logical change per commit — don't bundle unrelated changes
- Before committing code that touches module-owned files, run `scripts/check_spec_drift.sh <base-ref>` and fix any drift in the same commit. If the change legitimately does not affect module behavior, add the required `[skip-spec(<module>): <reason>]` marker to the commit message.
- Use HEREDOC for multi-line: `git commit -m "$(cat <<'EOF' ... EOF)"`
- Do NOT commit `.env`, credentials, or secret files
- Do NOT amend commits that have been pushed

## Parallel Shared-File Exception

The "one logical change" rule has one narrow exception: cross-cutting touches
produced by parallel subagents working on shared files. See `parallel-subagents`
before using this exception.

If you're writing one, name it explicitly:
`chore: sweep-up shared-file edits from <batch-name>`. Full checklist and
examples live in `docs/git-reference.md`.

## Change Sizing

Aim for ~100 lines of diff per logical commit. Reviewable in one sitting, bisects to a single intent. The line count is a guideline, not a hard cap — but if you're past 300 lines the commit is almost certainly bundling.

Heuristics for "this should be N commits":

- The commit body wants sub-headings (`### Backend`, `### Frontend`, `### Tests`).
- The diff touches three or more unrelated subsystems.
- The message uses "and" between non-trivial verbs ("add X **and** refactor Y **and** fix Z").
- A future bisect would want to land on a finer-grained commit ("which of these five things broke autopay?").

Real example of the failure mode: one `chore:` commit bundling five independent bug fixes across unrelated subsystems (match expiry, external API error handling, upload error surfacing, logging, TTL config). Should have been five commits. A body with four sub-sections is the tell.

When in doubt: smaller. Squashing later is trivial; splitting later requires `git rebase -i` and is error-prone.

## Anti-Rationalization

| Excuse | Counter |
|---|---|
| "These changes are related, one commit is fine" | "Related" usually means "I noticed both at the same time", not "they fail/pass as a unit". If they could be reverted independently, they're independent. |
| "Splitting takes too long" | Stage hunks (`git add -p`). 30 seconds per split. The bisect savings on a future bug pay it back instantly. |
| "It's all part of the same card/PR" | Cards group commits for review; they don't dictate commit boundaries. A 5-commit PR is fine. |
| "I'll squash before merge" | Squashing destroys exactly the granularity bisect needs. We don't squash on merge — keep commits atomic from the start. |
| "It's just a chore commit, doesn't matter" | Audit-cleanup chore commits that bundle unrelated fixes bisect-block real bugs the most. Split them. |
| "It's a sweep-up from parallel subagents, the rule allows it" | Only if it's shared-file edits and the body maps each edit to its source feature. If you're sweeping up bug fixes or unrelated chores, the exception doesn't apply — split them. |

## Branch Naming

```
type/short-description
```

Use the same type prefixes as commits: `feat/payment-schedule`, `fix/token-expiry`,
`chore/upgrade-deps`, `docs/api-reference`. Keep descriptions to 2-4 words,
hyphen-separated.

## Examples

See `docs/git-reference.md` for commit examples and detailed edge-case guidance.

Download now (ZIP)

Does 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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.