|
| 1 | +--- |
| 2 | +name: crew-commit |
| 3 | +description: > |
| 4 | + Canonical commit workflow for Gas Town crew members: pre-flight checks, |
| 5 | + branch creation, gt commit with agent identity, push, and PR creation. |
| 6 | + Use when ready to commit and submit work for review. |
| 7 | +allowed-tools: "Bash(git *), Bash(gt *), Bash(gh *)" |
| 8 | +version: "1.0.0" |
| 9 | +author: "Gas Town" |
| 10 | +--- |
| 11 | + |
| 12 | +# Crew Commit — Canonical Git Workflow |
| 13 | + |
| 14 | +This skill guides crew members through the standard Gas Town commit workflow: |
| 15 | +pre-flight → branch → stage → commit → push → PR. |
| 16 | + |
| 17 | +> **⚠️ NEVER commit directly to `main`.** All crew work goes through branches |
| 18 | +> and pull requests. The Refinery handles merges to main. |
| 19 | +
|
| 20 | +## Usage |
| 21 | + |
| 22 | +``` |
| 23 | +/crew-commit |
| 24 | +``` |
| 25 | + |
| 26 | +Run this when you have changes ready to commit. The skill walks you through |
| 27 | +each step in order. |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Step 1: Pre-flight Checks |
| 32 | + |
| 33 | +Before touching anything, sync with origin and verify your state. |
| 34 | + |
| 35 | +```bash |
| 36 | +# Fetch latest from origin |
| 37 | +git fetch origin |
| 38 | + |
| 39 | +# Check current branch and status |
| 40 | +git status |
| 41 | +git branch --show-current |
| 42 | + |
| 43 | +# If you're on main, STOP — create a branch first (Step 2) |
| 44 | +``` |
| 45 | + |
| 46 | +**If you're behind origin/main**, rebase now: |
| 47 | + |
| 48 | +```bash |
| 49 | +git rebase origin/main |
| 50 | +``` |
| 51 | + |
| 52 | +If there are conflicts, resolve them carefully before proceeding. |
| 53 | +If stuck on a rebase conflict, stop and get help rather than force-pushing. |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## Step 2: Create a Feature Branch |
| 58 | + |
| 59 | +**If you're already on a feature branch**, skip to Step 3. |
| 60 | + |
| 61 | +Branch naming convention: `<type>/<short-description>` |
| 62 | + |
| 63 | +Types: |
| 64 | +- `feat/` — new feature |
| 65 | +- `fix/` — bug fix |
| 66 | +- `refactor/` — code restructuring |
| 67 | +- `docs/` — documentation only |
| 68 | +- `chore/` — maintenance, deps, config |
| 69 | +- `test/` — tests only |
| 70 | + |
| 71 | +```bash |
| 72 | +# Create and switch to feature branch |
| 73 | +git checkout -b feat/my-feature-description |
| 74 | + |
| 75 | +# Or use the crew/<name> prefix for crew-specific branches |
| 76 | +git checkout -b crew/<your-name>/description |
| 77 | +``` |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## Step 3: Submodule Warning |
| 82 | + |
| 83 | +**Check for submodules before staging.** Accidentally committing a submodule |
| 84 | +pointer change causes cascading failures for other crew members. |
| 85 | + |
| 86 | +```bash |
| 87 | +# Check if repo has submodules |
| 88 | +cat .gitmodules 2>/dev/null || echo "(no submodules)" |
| 89 | + |
| 90 | +# Check for dirty submodule state |
| 91 | +git submodule status 2>/dev/null |
| 92 | +``` |
| 93 | + |
| 94 | +**Common submodule paths to watch:** `shared/`, `config/`, `vendor/` |
| 95 | + |
| 96 | +If you see changes in submodule directories: |
| 97 | +- Do NOT `git add shared/` or `git add config/` unless you intentionally |
| 98 | + bumped the submodule pointer |
| 99 | +- Submodule pointer changes should be explicit and deliberate |
| 100 | +- When in doubt, ask before including submodule changes |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +## Step 4: Stage Your Changes |
| 105 | + |
| 106 | +Prefer staging specific files over `git add .` or `git add -A`. |
| 107 | + |
| 108 | +```bash |
| 109 | +# Review what changed |
| 110 | +git diff |
| 111 | +git status |
| 112 | + |
| 113 | +# Stage specific files (preferred) |
| 114 | +git add src/myfile.go tests/myfile_test.go |
| 115 | + |
| 116 | +# If you need to stage all intentional changes and have verified no secrets: |
| 117 | +git add -p # Interactive staging — review each hunk |
| 118 | +``` |
| 119 | + |
| 120 | +**Before staging, verify:** |
| 121 | +- [ ] No `.env` files, API keys, or credentials |
| 122 | +- [ ] No debug prints or temporary test code |
| 123 | +- [ ] No unrelated changes mixed in |
| 124 | +- [ ] Submodule directories NOT accidentally staged (unless intentional) |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## Step 5: Commit with gt commit |
| 129 | + |
| 130 | +Use `gt commit` instead of `git commit`. It automatically sets the correct |
| 131 | +agent identity (name + email) based on your `GT_ROLE`. |
| 132 | + |
| 133 | +```bash |
| 134 | +gt commit -m "$(cat <<'EOF' |
| 135 | +<type>: <concise description of what and why> |
| 136 | +
|
| 137 | +<optional body: context, motivation, or notable details> |
| 138 | +EOF |
| 139 | +)" |
| 140 | +``` |
| 141 | + |
| 142 | +**Commit message format:** |
| 143 | +- First line: `<type>: <subject>` (50 chars or less) |
| 144 | +- Types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore` |
| 145 | +- Use imperative mood: "add feature" not "added feature" |
| 146 | +- Body is optional but valuable for non-obvious changes |
| 147 | + |
| 148 | +**Good examples:** |
| 149 | +``` |
| 150 | +feat: add retry logic to webhook delivery |
| 151 | +fix: prevent nil pointer when session token expires |
| 152 | +docs: clarify crew commit workflow in CONTRIBUTING.md |
| 153 | +``` |
| 154 | + |
| 155 | +--- |
| 156 | + |
| 157 | +## Step 6: Push Branch to Origin |
| 158 | + |
| 159 | +```bash |
| 160 | +git push origin <your-branch-name> |
| 161 | + |
| 162 | +# Or, if branch doesn't exist on remote yet: |
| 163 | +git push -u origin <your-branch-name> |
| 164 | +``` |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | +## Step 7: Create Pull Request |
| 169 | + |
| 170 | +```bash |
| 171 | +gh pr create --title "<type>: <concise description>" \ |
| 172 | + --body "$(cat <<'EOF' |
| 173 | +## Summary |
| 174 | +
|
| 175 | +- <what changed and why> |
| 176 | +
|
| 177 | +## Test plan |
| 178 | +
|
| 179 | +- [ ] <how to verify this works> |
| 180 | +
|
| 181 | +## Notes |
| 182 | +
|
| 183 | +<any context reviewers need> |
| 184 | +
|
| 185 | +🤖 Generated with [Claude Code](https://claude.com/claude-code) |
| 186 | +EOF |
| 187 | +)" |
| 188 | +``` |
| 189 | + |
| 190 | +After creating the PR, note the PR number from the output. |
| 191 | + |
| 192 | +--- |
| 193 | + |
| 194 | +## Step 8: Notify (Optional) |
| 195 | + |
| 196 | +If your work affects others or is high priority: |
| 197 | + |
| 198 | +```bash |
| 199 | +notify "PR ready: <brief description> — #<PR number>" |
| 200 | +``` |
| 201 | + |
| 202 | +--- |
| 203 | + |
| 204 | +## Completion Checklist |
| 205 | + |
| 206 | +- [ ] Synced with origin/main (git fetch + rebase) |
| 207 | +- [ ] On a feature branch (NOT main) |
| 208 | +- [ ] Submodules NOT accidentally staged |
| 209 | +- [ ] Specific files staged (no secrets, no debug code) |
| 210 | +- [ ] Used `gt commit` (not `git commit`) |
| 211 | +- [ ] Branch pushed to origin |
| 212 | +- [ ] PR created via `gh pr create` |
| 213 | + |
| 214 | +--- |
| 215 | + |
| 216 | +## Anti-Patterns |
| 217 | + |
| 218 | +| ❌ Don't | ✅ Do instead | |
| 219 | +|----------|--------------| |
| 220 | +| `git push origin main` | Push feature branch, create PR | |
| 221 | +| `git commit` directly | `gt commit` (sets agent identity) | |
| 222 | +| `git add .` blindly | Stage specific files, verify with `git status` | |
| 223 | +| Include `shared/` or `config/` without intent | Check `git submodule status` first | |
| 224 | +| Force-push without understanding why | Resolve the root cause | |
| 225 | +| Commit secrets or .env files | Always check `git diff` before staging | |
| 226 | + |
| 227 | +--- |
| 228 | + |
| 229 | +## If You Get Stuck |
| 230 | + |
| 231 | +- **Rebase conflicts**: resolve carefully, then `git rebase --continue` |
| 232 | +- **Pushed wrong branch**: ask before force-pushing; usually `git push origin <branch>` is fine |
| 233 | +- **Need to undo last commit**: `git reset HEAD~1` (keeps changes staged) |
| 234 | +- **Committed to main by mistake**: stop immediately, ask for help |
0 commit comments