Skip to content

Commit 7cc5986

Browse files
feat: add comprehensive research-plan-implement workflow commands
- Add multi-modal /research command supporting codebase, docs, and web research - Enhance /plan command with research integration and interactive refinement - Add /implement command for executing approved plans - Add /validate command for post-implementation verification - Add /workflow orchestrator for complete pipeline management - Add /commit command with pre-commit cleanup rules These commands provide a complete development workflow from research through implementation with validation, based on sophisticated parallel agent patterns for efficiency. All commands are generic and portable to any project.
1 parent a13e688 commit 7cc5986

File tree

6 files changed

+1607
-34
lines changed

6 files changed

+1607
-34
lines changed

claude-code/commands/commit.md

Lines changed: 352 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,352 @@
1+
# Commit
2+
3+
You are tasked with creating git commits for the changes made during this session.
4+
5+
## Initial Response
6+
7+
When invoked, respond with:
8+
```
9+
I'll help you create git commits for the changes in this session.
10+
11+
Let me review what was accomplished and prepare appropriate commits.
12+
```
13+
14+
## Process
15+
16+
### Step 1: Pre-Commit Cleanup
17+
18+
Before creating any commits, ALWAYS perform cleanup:
19+
20+
1. **Check for files that should NOT be committed**:
21+
```bash
22+
# Look for env files that might not be ignored
23+
ls -la .env* env.* *.env
24+
25+
# Check if they're in .gitignore
26+
cat .gitignore | grep -E "\.env|env\."
27+
```
28+
29+
If any `.env` files are not in `.gitignore`, add them:
30+
```bash
31+
echo ".env*" >> .gitignore
32+
echo "*.env" >> .gitignore
33+
```
34+
35+
2. **Remove debug/test files created during development**:
36+
```bash
37+
# Look for common debug/test files
38+
ls -la test_*.* debug_*.* tmp_*.* temp_*.*
39+
```
40+
41+
Remove any files that were created just to assist development:
42+
```bash
43+
rm test_script.js debug_output.txt temp_*.py
44+
```
45+
46+
3. **Remove unnecessary documentation**:
47+
```bash
48+
# Check for markdown files created during this session
49+
git status | grep "\.md"
50+
```
51+
52+
Unless explicitly requested by the user, remove:
53+
- Work tracking documents
54+
- Temporary notes
55+
- Auto-generated docs
56+
57+
Keep only:
58+
- Explicitly requested documentation
59+
- Essential README updates
60+
- API documentation if requested
61+
62+
4. **Verify cleanup**:
63+
```bash
64+
git status
65+
```
66+
67+
Present to user if cleanup is needed:
68+
```
69+
I found some files that should be cleaned up before committing:
70+
71+
Files to remove:
72+
- test_oauth.js (debug script)
73+
- debug_notes.md (work tracking)
74+
- .env.local (should be in .gitignore)
75+
76+
Shall I clean these up before creating commits?
77+
```
78+
79+
### Step 2: Understand What Changed
80+
81+
1. **Review the conversation history**:
82+
- Understand what was accomplished in this session
83+
- Identify the purpose and context of changes
84+
- Note any bug fixes, features, or refactoring done
85+
86+
2. **Check git status** (after cleanup):
87+
```bash
88+
git status
89+
```
90+
- See all modified, added, and deleted files
91+
- Identify untracked files that need to be added
92+
93+
3. **Review the actual changes**:
94+
```bash
95+
git diff
96+
git diff --staged
97+
```
98+
- Understand the specific modifications
99+
- Group related changes together
100+
- Identify if changes should be one commit or multiple
101+
102+
### Step 3: Plan Your Commits
103+
104+
1. **Determine commit strategy**:
105+
- Single commit for related changes
106+
- Multiple commits for distinct features/fixes
107+
- Atomic commits that each serve a single purpose
108+
109+
2. **Group files logically**:
110+
- Feature files together
111+
- Test files with their implementation
112+
- Configuration changes separately if significant
113+
114+
3. **Draft commit messages**:
115+
- Use imperative mood ("Add", "Fix", "Update", not "Added", "Fixed")
116+
- First line: concise summary (50 chars or less ideally)
117+
- Blank line, then detailed explanation if needed
118+
- Focus on WHY the change was made, not just what
119+
120+
### Step 4: Present Your Plan
121+
122+
Show the user your commit plan:
123+
124+
```
125+
Based on the changes, I plan to create [N] commit(s):
126+
127+
**Commit 1**: [Type]: [Summary]
128+
Files:
129+
- path/to/file1.js
130+
- path/to/file2.js
131+
132+
Message:
133+
```
134+
feat: add OAuth2 authentication support
135+
136+
- Implement OAuth2 flow with refresh tokens
137+
- Add token storage and validation
138+
- Include error handling for auth failures
139+
```
140+
141+
**Commit 2**: [Type]: [Summary]
142+
Files:
143+
- tests/auth.test.js
144+
145+
Message:
146+
```
147+
test: add comprehensive OAuth2 tests
148+
149+
- Test token refresh flow
150+
- Verify error handling
151+
- Add integration tests for providers
152+
```
153+
154+
Shall I proceed with these commits?
155+
```
156+
157+
### Step 5: Execute Upon Confirmation
158+
159+
1. **Stage files for each commit**:
160+
```bash
161+
# For each commit, add specific files
162+
git add path/to/file1.js path/to/file2.js
163+
164+
# NEVER use git add -A or git add .
165+
# Always be specific about what you're committing
166+
```
167+
168+
2. **Create the commit**:
169+
```bash
170+
git commit -m "feat: add OAuth2 authentication support
171+
172+
- Implement OAuth2 flow with refresh tokens
173+
- Add token storage and validation
174+
- Include error handling for auth failures"
175+
```
176+
177+
3. **Verify the commits**:
178+
```bash
179+
git log --oneline -n 3
180+
```
181+
Show the user the created commits
182+
183+
## Commit Message Format
184+
185+
Follow conventional commits format:
186+
187+
### Types:
188+
- **feat**: New feature
189+
- **fix**: Bug fix
190+
- **docs**: Documentation changes
191+
- **style**: Code style changes (formatting, semicolons, etc)
192+
- **refactor**: Code refactoring without changing functionality
193+
- **perf**: Performance improvements
194+
- **test**: Adding or updating tests
195+
- **build**: Build system or dependencies
196+
- **ci**: CI/CD changes
197+
- **chore**: Maintenance tasks
198+
199+
### Structure:
200+
```
201+
<type>(<scope>): <subject>
202+
203+
<body>
204+
205+
<footer>
206+
```
207+
208+
### Examples:
209+
210+
```bash
211+
# Simple feature
212+
git commit -m "feat: add user profile page"
213+
214+
# Bug fix with detail
215+
git commit -m "fix: resolve race condition in payment processing
216+
217+
The payment webhook could process twice if requests arrived
218+
simultaneously. Added mutex locking to ensure single processing."
219+
220+
# Breaking change
221+
git commit -m "feat!: update API response format
222+
223+
BREAKING CHANGE: API now returns data in 'result' field instead
224+
of root level. Clients need to update response parsing."
225+
```
226+
227+
## Important Rules
228+
229+
### 🚫 Cleanup Rules (MUST DO BEFORE COMMITS)
230+
1. **ALL `.env.*` files MUST be in `.gitignore`**
231+
- Never commit environment files
232+
- Add patterns to .gitignore if missing
233+
234+
2. **REMOVE all debug/test scripts created to assist agent**
235+
- Delete temporary test files
236+
- Remove debug output files
237+
- Clean up any helper scripts
238+
239+
3. **NO documentation unless explicitly requested**
240+
- Delete work tracking documents
241+
- Remove temporary markdown notes
242+
- Only keep docs the user specifically asked for
243+
244+
### Commit Rules
245+
1. **NEVER add co-author information or Claude attribution**:
246+
- No "Generated with Claude" messages
247+
- No "Co-Authored-By" lines
248+
- Commits should be authored solely by the user
249+
250+
2. **Write commits as if the user wrote them**:
251+
- Use the project's commit style if evident
252+
- Match the tone of existing commits
253+
- Be professional and concise
254+
255+
3. **Be selective with staging**:
256+
- Only commit files that are ready
257+
- Don't include debug code or temporary files
258+
- Ensure no sensitive information is committed
259+
260+
## Handling Complex Scenarios
261+
262+
### Multiple Features in One Session
263+
264+
If multiple unrelated features were implemented:
265+
```
266+
I notice we worked on several distinct features. I'll create separate commits for:
267+
268+
1. OAuth implementation (5 files)
269+
2. User profile updates (3 files)
270+
3. Bug fix for payment processing (2 files)
271+
272+
This keeps the git history clean and makes reverting easier if needed.
273+
```
274+
275+
### Large Changes
276+
277+
For extensive changes, consider:
278+
```
279+
This is a large change. I recommend breaking it into logical commits:
280+
281+
1. Core implementation
282+
2. Tests
283+
3. Documentation
284+
4. Configuration changes
285+
286+
This makes code review easier and helps track what changed where.
287+
```
288+
289+
### Work in Progress
290+
291+
If implementation is incomplete:
292+
```
293+
The implementation isn't complete yet. Would you like me to:
294+
295+
1. Commit completed parts with a clear message
296+
2. Create a WIP commit to save progress
297+
3. Wait until the feature is complete
298+
299+
What's your preference?
300+
```
301+
302+
## Verification Steps
303+
304+
After committing, always:
305+
306+
1. **Show the commit log**:
307+
```bash
308+
git log --oneline -5
309+
```
310+
311+
2. **Verify nothing was missed**:
312+
```bash
313+
git status
314+
```
315+
316+
3. **Check the commit contents** (if requested):
317+
```bash
318+
git show HEAD
319+
```
320+
321+
## Best Practices
322+
323+
1. **Atomic commits**: Each commit should work independently
324+
2. **Clear messages**: Future developers should understand why
325+
3. **Group related changes**: But don't mix unrelated changes
326+
4. **Test before committing**: Ensure code works
327+
5. **Review diff carefully**: Check for debug code, comments, secrets
328+
329+
## Quick Reference
330+
331+
```bash
332+
# See what changed
333+
git status
334+
git diff
335+
336+
# Stage specific files
337+
git add src/feature.js tests/feature.test.js
338+
339+
# Commit with message
340+
git commit -m "feat: implement new feature"
341+
342+
# View recent commits
343+
git log --oneline -10
344+
345+
# Amend last commit (if needed)
346+
git commit --amend
347+
348+
# Unstage files (if needed)
349+
git reset HEAD file.js
350+
```
351+
352+
Remember: You have the full context of what was done in this session. Use that knowledge to create meaningful, well-organized commits that tell the story of what was accomplished.

0 commit comments

Comments
 (0)