You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(workflows:work): add incremental commits and branch safety (#93)
- Add branch detection at start of Setup Environment step
- Support continuing on existing feature branch or creating new
- Require explicit confirmation to commit to default branch
- Add incremental commit guidance with decision criteria table
- Include heuristic: "Can I write a meaningful commit message?"
- Generalize test commands to be framework-agnostic
**If already on a feature branch** (not the default branch):
46
+
- Ask: "Continue working on `[current_branch]`, or create a new branch?"
47
+
- If continuing, proceed to step 3
48
+
- If creating new, follow Option A or B below
49
+
50
+
**If on the default branch**, choose how to proceed:
51
+
52
+
**Option A: Create a new branch**
53
+
```bash
54
+
git pull origin [default_branch]
38
55
git checkout -b feature-branch-name
39
56
```
57
+
Use a meaningful name based on the work (e.g., `feat/user-authentication`, `fix/email-validation`).
40
58
41
-
**Option B: Parallel work with worktree (recommended for parallel development)**
59
+
**Option B: Use a worktree (recommended for parallel development)**
42
60
```bash
43
-
# Ask user first: "Work in parallel with worktree or on current branch?"
44
-
# If worktree:
45
61
skill: git-worktree
46
-
# The skill will create a new branch from main in an isolated worktree
62
+
# The skill will create a new branch from the default branch in an isolated worktree
47
63
```
48
64
65
+
**Option C: Continue on the default branch**
66
+
- Requires explicit user confirmation
67
+
- Only proceed after user explicitly says "yes, commit to [default_branch]"
68
+
- Never commit directly to the default branch without explicit permission
69
+
49
70
**Recommendation**: Use worktree if:
50
71
- You want to work on multiple features simultaneously
51
-
- You want to keep main clean while experimenting
72
+
- You want to keep the default branch clean while experimenting
52
73
- You plan to switch between branches frequently
53
74
54
-
Use live branch if:
55
-
- You're working on a single feature
56
-
- You prefer staying in the main repository
57
-
58
75
3.**Create Todo List**
59
76
- Use TodoWrite to break plan into actionable tasks
60
77
- Include dependencies between tasks
@@ -78,26 +95,56 @@ This command takes a work document (plan, specification, or todo file) and execu
78
95
- Run tests after changes
79
96
- Mark task as completed in TodoWrite
80
97
- Mark off the corresponding checkbox in the plan file ([ ] → [x])
98
+
- Evaluate for incremental commit (see below)
81
99
```
82
100
83
101
**IMPORTANT**: Always update the original plan document by checking off completed items. Use the Edit tool to change `- [ ]` to `- [x]` for each task you finish. This keeps the plan as a living document showing progress and ensures no checkboxes are left unchecked.
84
102
85
-
2.**Follow Existing Patterns**
103
+
2.**Incremental Commits**
104
+
105
+
After completing each task, evaluate whether to create an incremental commit:
106
+
107
+
| Commit when... | Don't commit when... |
108
+
|----------------|---------------------|
109
+
| Logical unit complete (model, service, component) | Small part of a larger unit |
| About to switch contexts (backend → frontend) | Purely scaffolding with no behavior |
112
+
| About to attempt risky/uncertain changes | Would need a "WIP" commit message |
113
+
114
+
**Heuristic:** "Can I write a commit message that describes a complete, valuable change? If yes, commit. If the message would be 'WIP' or 'partial X', wait."
115
+
116
+
**Commit workflow:**
117
+
```bash
118
+
# 1. Verify tests pass (use project's test command)
119
+
# Examples: bin/rails test, npm test, pytest, go test, etc.
120
+
121
+
# 2. Stage only files related to this logical unit (not `git add .`)
122
+
git add <files related to this logical unit>
123
+
124
+
# 3. Commit with conventional message
125
+
git commit -m "feat(scope): description of this unit"
126
+
```
127
+
128
+
**Handling merge conflicts:** If conflicts arise during rebasing or merging, resolve them immediately. Incremental commits make conflict resolution easier since each commit is small and focused.
129
+
130
+
**Note:** Incremental commits use clean conventional messages without attribution footers. The final Phase 4 commit/PR includes the full attribution.
131
+
132
+
3.**Follow Existing Patterns**
86
133
87
134
- The plan should reference similar code - read those files first
88
135
- Match naming conventions exactly
89
136
- Reuse existing components where possible
90
137
- Follow project coding standards (see CLAUDE.md)
91
138
- When in doubt, grep for similar implementations
92
139
93
-
3.**Test Continuously**
140
+
4.**Test Continuously**
94
141
95
142
- Run relevant tests after each significant change
96
143
- Don't wait until the end to test
97
144
- Fix failures immediately
98
145
- Add new tests for new functionality
99
146
100
-
4.**Figma Design Sync** (if applicable)
147
+
5.**Figma Design Sync** (if applicable)
101
148
102
149
For UI work with Figma designs:
103
150
@@ -106,7 +153,7 @@ This command takes a work document (plan, specification, or todo file) and execu
106
153
- Fix visual differences identified
107
154
- Repeat until implementation matches design
108
155
109
-
5.**Track Progress**
156
+
6.**Track Progress**
110
157
- Keep TodoWrite updated as you complete tasks
111
158
- Note any blockers or unexpected discoveries
112
159
- Create new tasks if scope expands
@@ -119,8 +166,8 @@ This command takes a work document (plan, specification, or todo file) and execu
119
166
Always run before submitting:
120
167
121
168
```bash
122
-
# Run full test suite
123
-
bin/rails test
169
+
# Run full test suite (use project's test command)
170
+
# Examples: bin/rails test, npm test, pytest, go test, etc.
124
171
125
172
# Run linting (per CLAUDE.md)
126
173
# Use linting-agent before pushing to origin
@@ -284,7 +331,7 @@ Before creating PR, verify:
284
331
285
332
- [ ] All clarifying questions asked and answered
286
333
- [ ] All TodoWrite tasks marked completed
287
-
- [ ] Tests pass (run `bin/rails test`)
334
+
- [ ] Tests pass (run project's test command)
288
335
- [ ] Linting passes (use linting-agent)
289
336
- [ ] Code follows existing patterns
290
337
- [ ] Figma designs match implementation (if applicable)
0 commit comments