agentleFS
bybren-llcbybren-llc/safe-agentic-workflow/.cursor/rules/01-git-workflow.mdc

safe-agentic-workflow / rules

Cursor rule419 starsChanged 4 months agoMITView on GitHub

Git branch naming, commit message format, rebase-first workflow, and PR process for SAFe development. Apply to ALL git operations.

  • Deletes or force-pushes
  • Commits and pushes

The file

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

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    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. Very specific:

    MUST start with {{TICKET_PREFIX}}-{number}

    line 19
  2. Distinctive:

    Use lowercase letters and hyphens only

    line 20
  3. Distinctive:

    Keep total length under 50 characters

    line 21
  4. Distinctive:

    Never include personal names or dates

    line 22
  5. Distinctive:

    Rebase-first: Never create merge commits.

    line 82
  6. Very specific:

    Force-with-lease: Use --force-with-lease after rebase, never --force.

    line 83
  7. Very specific:

    PR template: Always use .github/pull_request_template.md and fill ALL sections.

    line 86

≈ “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
01-git-workflow.mdc
---
description: "Git branch naming, commit message format, rebase-first workflow, and PR process for SAFe development. Apply to ALL git operations."
alwaysApply: true
---

# Git Workflow

This project enforces a **rebase-first workflow** validated by CI/CD automation. See `CONTRIBUTING.md` for the full guide.

## Branch Naming

**Required format:** `{{TICKET_PREFIX}}-{number}-{short-description}`

Examples:
- `{{TICKET_PREFIX}}-42-add-user-authentication`
- `{{TICKET_PREFIX}}-57-fix-profile-image-upload`

Rules:
- MUST start with `{{TICKET_PREFIX}}-{number}`
- Use lowercase letters and hyphens only
- Keep total length under 50 characters
- Never include personal names or dates
- CI will reject branches that do not follow this format

## Commit Message Format

**Required format:** `type(scope): description [{{TICKET_PREFIX}}-XXX]`

### Types

- `feat` -- New feature
- `fix` -- Bug fix
- `docs` -- Documentation changes
- `style` -- Code formatting (no logic changes)
- `refactor` -- Code restructuring
- `test` -- Adding or updating tests
- `chore` -- Maintenance tasks, dependencies
- `ci` -- CI/CD pipeline changes

### Scopes (optional)

- `payments`, `auth`, `ui`, `api`, `db`, `scheduler`, `security`, `cursor`

### Examples

```
feat(payments): add Stripe checkout integration [{{TICKET_PREFIX}}-42]
fix(auth): resolve login redirect issue [{{TICKET_PREFIX}}-57]
docs: update API documentation [{{TICKET_PREFIX}}-123]
```

CI will reject commits that do not include a ticket reference.

## Workflow Steps

```bash
# 1. Start from latest base branch
git checkout {{MAIN_BRANCH}}
git pull origin {{MAIN_BRANCH}}
git checkout -b {{TICKET_PREFIX}}-{number}-{description}

# 2. Make changes and commit
git add <files>
git commit -m "feat(scope): description [{{TICKET_PREFIX}}-XXX]"

# 3. Keep branch updated (rebase, NEVER merge)
git fetch origin
git rebase origin/{{MAIN_BRANCH}}

# 4. Validate before pushing
# Run: {{CI_VALIDATE_COMMAND}}

# 5. Push
git push --force-with-lease origin {{TICKET_PREFIX}}-{number}-{description}

# 6. Create PR using .github/pull_request_template.md
# 7. Merge using "Rebase and merge" ONLY (never squash or merge commit)
```

## Rules

- **Rebase-first**: Never create merge commits. Always rebase onto the base branch.
- **Force-with-lease**: Use `--force-with-lease` after rebase, never `--force`.
- **Linear history**: The project requires a clean linear commit history.
- **One ticket per branch**: Each branch maps to exactly one project management ticket.
- **PR template**: Always use `.github/pull_request_template.md` and fill ALL sections.

## Role Collapsing

- **RTE** role is collapsible (PR creation can be done by implementer)
- **QAS** role is NOT collapsible (independence gate)
- **SecEng** role is NOT collapsible (security audit requires independence)

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.