Windsurf rules
.windsurf/rules/guard-git.mdBlock dangerous git commands (push, force push, reset --hard, clean, branch -D, checkout/restore .) and enforce Conventional Commits & Branch Protection before an AI agent runs them. Installs hook scripts for Claude Code, Cursor, Cursor CLI, and Gemini CLI; documents Google Antigravity Terminal deny lists. Use when the user wants git safety hooks, to block git push or destructive git in agents, or to mirror the same policy across AI coding tools.
Windsurf rules
Quality
89/100
Scores the file, not the repository.Length
788 words
21 headings · 11 code blocksRepository
114
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# Guard Git8> **HARD GATE** — **HARD GATE** — Before committing, verify: branch is not main/master, author is correct, git user is configured. Bad commits are hard to fix.91011Installs a shared hook that blocks destructive git operations and enforces workflow discipline. **Requires `jq` on the agent's PATH** when the hook runs.1213## What gets blocked/enforced1415- **Safety**: `git push --force`, `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`.16- **Discipline**: Blocks direct commits or pushes to protected branches (`main`, `master`) unless `GIT_BIGPOWERS_LAND=1` (set only by `scripts/land-branch.sh`).17- **Allows**: `git push origin <feature-branch>` for backup/CI; solo land push to `main` only inside `land-branch.sh`.18- **Standardization**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all `git commit` commands.19- **Secrets**: Blocks commits containing common secret patterns (`sk-`, `ghp_`, `AKIA`, `xoxb-`, `-----BEGIN` private keys) — see [REFERENCE.md](REFERENCE.md).2021## Quick start22231. **Scope**: ask project-only vs global (paths differ per product).242. **Write the hook bundle** from [REFERENCE.md](REFERENCE.md) into the client's hooks directory.253. **Run `chmod +x`** on `pre-tool-use.sh`.264. **Merge** the hook snippet from [REFERENCE.md](REFERENCE.md) into the right settings file — do not wipe unrelated keys.275. **Verify** with the tests in [REFERENCE.md](REFERENCE.md).2829| Client | Mechanism | Config |30|--------|-----------|--------|31| Claude Code | `PreToolUse` (Bash) | `.claude/settings.json` or `~/.claude/settings.json` |32| Cursor / Cursor CLI | `beforeShellExecution` | `.cursor/hooks.json` or `~/.cursor/hooks.json` |33| Gemini CLI | `BeforeTool` + `run_shell_command` | `.gemini/settings.json` or `~/.gemini/settings.json` |34| Google Antigravity | Built-in Terminal **Deny list** | Settings UI (no shell hook) |3536**Modes (env on the hook command):** `GIT_GUARDRAILS_MODE` is `claude` (default) or `cursor` → stderr + exit `2` on block. Set `gemini` for Gemini CLI → JSON `decision` on stdout.3738## Customization3940To add or remove patterns or protected branches, edit `pre-tool-use.sh`.4142## Advanced4344Full JSON examples, merge rules, Antigravity deny-list entries, and test commands: [REFERENCE.md](REFERENCE.md).45464748<!-- story: e01s03 -->4950---5152# Git guardrails — reference5354## Navigation5556| Lines | Section |57|-------|---------|58| 1 | Title |59| 3–16 | Navigation |60| 17–28 | Secret patterns (audit + pre-commit) |61| 29–46 | Copy layout |62| 47–72 | Claude Code |63| 73–94 | Cursor and Cursor CLI |64| 95–122 | Gemini CLI |65| 123–137 | Google Antigravity |66| 138–180 | Verify (local tests) |6768## Secret patterns (audit + pre-commit)6970Agents must not commit files containing:7172- `sk-` (OpenAI API keys)73- `ghp_` / `gho_` (GitHub tokens)74- `AKIA` (AWS access key id)75- `xoxb-` (Slack bot tokens)76- `-----BEGIN` private keys7778Use `audit-code` supply-chain checklist before commit. Consider `git-secrets` or custom pre-commit hook in target projects.7980## Copy layout8182The main script is `pre-tool-use.sh`.8384```text85<hooks-dir>/pre-tool-use.sh86```8788Example project locations:8990- Claude: `.claude/hooks/`91- Cursor: `.cursor/hooks/`92- Gemini: `.gemini/hooks/`9394Use the same layout for user-level hooks (`~/.claude/hooks`, `~/.cursor/hooks`, `~/.gemini/hooks`).9596---9798## Claude Code99100Hook command does **not** need `GIT_GUARDRAILS_MODE` (defaults to `claude`).101102**Project** (`.claude/settings.json`):103104```json105{106 "hooks": {107 "PreToolUse": [108 {109 "matcher": "Bash",110 "hooks": [111 {112 "type": "command",113 "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/pre-tool-use.sh"114 }115 ]116 }117 ]118 }119}120```121122---123124## Cursor and Cursor CLI125126Use `beforeShellExecution`. Set `GIT_GUARDRAILS_MODE=cursor`.127128**Project** (`.cursor/hooks.json`):129130```json131{132 "version": 1,133 "hooks": {134 "beforeShellExecution": [135 {136 "command": "GIT_GUARDRAILS_MODE=cursor .cursor/hooks/pre-tool-use.sh",137 "matcher": "git"138 }139 ]140 }141}142```143144---145146## Gemini CLI147148Use `BeforeTool` with matcher `run_shell_command`. Set **`GIT_GUARDRAILS_MODE=gemini`**.149150**Project** (`.gemini/settings.json`):151152```json153{154 "hooks": {155 "BeforeTool": [156 {157 "matcher": "run_shell_command",158 "hooks": [159 {160 "name": "git-guardrails",161 "type": "command",162 "command": "GIT_GUARDRAILS_MODE=gemini \"$GEMINI_PROJECT_DIR\"/.gemini/hooks/pre-tool-use.sh",163 "timeout": 5000164 }165 ]166 }167 ]168 }169}170```171172---173174## Google Antigravity175176Add **Deny list** entries in **Antigravity → Settings → Terminal**:177178- `git push --force`179- `git push origin main`180- `git push origin master`181- `git reset --hard`182- `git clean`183- `git branch -D`184- `git checkout .`185- `git restore .`186187---188189## Verify (local tests)190191**1. Block push to main without land mode (Claude mode):**192```bash193echo '{"tool_input":{"command":"git push origin main"}}' | ./pre-tool-use.sh194# Expected: exit 2, protected branch message195```196197**2. Allow push to main with GIT_BIGPOWERS_LAND=1:**198```bash199GIT_BIGPOWERS_LAND=1 echo '{"tool_input":{"command":"git push origin main"}}' | ./pre-tool-use.sh200# Expected: exit 0 (when on main)201```202203**3. Allow push to feature branch:**204```bash205echo '{"tool_input":{"command":"git push -u origin feat/my-task"}}' | ./pre-tool-use.sh206# Expected: exit 0207```208209**4. Conventional Commits (Gemini mode):**210```bash211echo '{"tool_input":{"command":"git commit -m \"bad message\""}}' | GIT_GUARDRAILS_MODE=gemini ./pre-tool-use.sh212# Expected: exit 0, {"decision":"deny", "reason":"..."}213```214215**5. Protected Branch commit (Cursor mode):**216```bash217# Run on 'main' branch218echo '{"command":"git commit -m \"feat: valid message\""}' | GIT_GUARDRAILS_MODE=cursor ./pre-tool-use.sh219# Expected: exit 2, "Direct commits to protected branch 'main' are forbidden"220```221222**6. Land script exists:**223```bash224test -x scripts/land-branch.sh && echo OK225```226227**7. Allow (Gemini mode):**228```bash229echo '{"tool_input":{"command":"git status"}}' | GIT_GUARDRAILS_MODE=gemini ./pre-tool-use.sh230# Expected: exit 0, {"decision":"allow"}231```232
Also in danielvm-git/bigpowers
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.cursor/rules/align-grid.mdc · 114 | Cursor rules | lint-formatdo-notagent-behaviour | 65/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/assess-impact.mdc · 114 | Cursor rules | testtesting-strategydeployment | 66/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/audit-code.mdc · 114 | Cursor rules | setuptestlint-formatstyle+4 | 66/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/audit-plan.mdc · 114 | Cursor rules | buildteststylegit | 74/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/build-epic.mdc · 114 | Cursor rules | buildgit | 58/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/change-request.mdc · 114 | Cursor rules | no sections | 48/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/commit-message.mdc · 114 | Cursor rules | lint-formatstyletypesgit+3 | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/compose-workflow.mdc · 114 | Cursor rules | styledo-notagent-behaviour | 65/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/context7-mcp.mdc · 114 | Cursor rules | style | 54/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/craft-skill.mdc · 114 | Cursor rules | stylearchgitdo-not | 69/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/deepen-architecture.mdc · 114 | Cursor rules | testtesting-strategydo-not | 57/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/define-language.mdc · 114 | Cursor rules | lint-formatdo-not | 65/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/define-success.mdc · 114 | Cursor rules | no sections | 4/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/delegate-task.mdc · 114 | Cursor rules | git | 62/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/deploy.mdc · 114 | Cursor rules | setupbuildtestdeployment | 77/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/design-interface.mdc · 114 | Cursor rules | styleagent-behaviour | 58/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/develop-tdd.mdc · 114 | Cursor rules | teststylearchtesting-strategy+5 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/diagnose-root.mdc · 114 | Cursor rules | no sections | 39/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/diagnose-stall.mdc · 114 | Cursor rules | no sections | 44/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/dispatch-agents.mdc · 114 | Cursor rules | git | 54/100 | 3 days ago |
Diff against .cursor/rules/align-grid.mdc Diff against .cursor/rules/assess-impact.mdc Diff against .cursor/rules/audit-code.mdc Diff against .cursor/rules/audit-plan.mdc Diff against .cursor/rules/build-epic.mdc Diff against .cursor/rules/change-request.mdc Diff against .cursor/rules/commit-message.mdc Diff against .cursor/rules/compose-workflow.mdc Diff against .cursor/rules/context7-mcp.mdc Diff against .cursor/rules/craft-skill.mdc Diff against .cursor/rules/deepen-architecture.mdc Diff against .cursor/rules/define-language.mdc Diff against .cursor/rules/define-success.mdc Diff against .cursor/rules/delegate-task.mdc Diff against .cursor/rules/deploy.mdc Diff against .cursor/rules/design-interface.mdc Diff against .cursor/rules/develop-tdd.mdc Diff against .cursor/rules/diagnose-root.mdc Diff against .cursor/rules/diagnose-stall.mdc Diff against .cursor/rules/dispatch-agents.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.windsurf/rules/organize-workspace.md · 114 | Windsurf rules | buildstylegitdeployment+2 | 89/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/develop-tdd.md · 114 | Windsurf rules | teststylearchtesting-strategy+5 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/quick-fix.md · 114 | Windsurf rules | teststylegitdeployment+1 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/session-state.md · 114 | Windsurf rules | lint-formatstyleagent-behaviour | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/extract-design.md · 114 | Windsurf rules | lint-formatstyledependenciesui | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/commit-message.md · 114 | Windsurf rules | lint-formatstyletypesgit+3 | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/setup-environment.md · 114 | Windsurf rules | setupstylesecuritydo-not+1 | 81/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/wire-ci.md · 114 | Windsurf rules | buildtestlint-formatstyle+1 | 81/100 | 3 days ago |
