Skip to content

Commit 95b25cf

Browse files
authored
Merge pull request #162 (docs)
docs: enhance AGENT.md with comprehensive git workflow improvements
2 parents 29cc5cd + 1f73efc commit 95b25cf

File tree

1 file changed

+84
-6
lines changed

1 file changed

+84
-6
lines changed

AGENT.md

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,18 +364,61 @@ The issue with unicorn rules stems from:
364364

365365
### Commit Guidelines
366366

367+
#### CRITICAL: THINK BEFORE YOU COMMIT - READ THIS SECTION TWICE
368+
369+
##### Pre-commit Checklist (MANDATORY)
370+
371+
1. Run `git status` and READ every file listed
372+
2. Ask yourself: "Do ALL these files belong in this commit?"
373+
3. If working on feature X, do NOT include unrelated feature Y files
374+
4. NEVER stage files in bulk with `git add -A` or `git add .`
375+
5. Check if your changes require updates to:
376+
- **CHANGELOG.md** - for any user-facing changes or fixes
377+
- **README.md** - for new features, API changes, or usage examples
378+
- **AGENT.md** - for new development guidelines or workflow changes
379+
380+
##### Commit Rules (STRICT ENFORCEMENT)
381+
367382
- Always use `-s` flag for signed commits
368383
- Never use `-m` flag
369384
- Use `-F` flag with a commit message file
370-
- Create unique commit message files: `.commit-msg-<timestamp>` in CWD
385+
- Create unique commit message files: `.commit-msg-<descriptive-slug>` in CWD
371386
- Delete commit message files after use to avoid conflicts
372-
- Always specify explicit file names in the commit command
387+
- **ALWAYS specify explicit file names in EVERY git command** — for example:
388+
- `git commit` - list every file
389+
- `git commit --amend` - list every file being added
390+
- `git add` - list specific files, never use `-A` or `.`
373391
- Use the Write tool to create commit message files (avoid echo/heredoc to
374392
prevent shell expansion issues)
375-
- Example workflow:
376-
1. Use Write tool to create `.commit-msg-<timestamp>`
377-
2. Run: `git commit -s -F .commit-msg-<timestamp> file1 file2`
378-
3. Delete the commit message file after use
393+
- When editing PRs with `gh pr edit`, use `--body-file` with a file created
394+
by the Write tool to avoid shell expansion issues
395+
396+
##### Example workflow (FOLLOW EXACTLY)
397+
398+
1. Run `git status` and identify files for THIS commit only
399+
2. Stage files individually: `git add src/file1.ts src/file2.ts`
400+
3. Use Write tool to create `.commit-msg-<descriptive-slug>`
401+
4. Run: `git commit -s -F .commit-msg-<descriptive-slug> src/file1.ts src/file2.ts`
402+
5. Delete the commit message file after use
403+
6. If you need to amend:
404+
405+
```bash
406+
git commit --amend -F .commit-msg-<descriptive-slug> \
407+
src/file1.ts src/file2.ts src/file3.ts
408+
```
409+
410+
##### Common Mistakes That Waste Credits
411+
412+
- Committing unrelated work (e.g., CSS fixes + future migration plans)
413+
- Using `git add -A` or `git add .`
414+
- Not reading `git status` output before committing
415+
- Using `--amend` without explicit file lists
416+
- Rushing commits without thoughtful review
417+
- Including package.json/pnpm-lock.yaml updates without thinking if they belong
418+
- Mixing example updates with core library changes
419+
- Forgetting to delete commit message files after use
420+
- Using `cd` in bash commands instead of absolute paths
421+
- Committing generated files (.nuxt/, dist/) or editor files (.vscode/)
379422

380423
## Development Practices
381424

@@ -387,6 +430,9 @@ The issue with unicorn rules stems from:
387430
- Use semantic versioning for releases
388431
- Follow the .editorconfig rules for consistent formatting
389432
- Use atomic commits with explicit file lists
433+
- Update CHANGELOG.md for user-facing changes
434+
- Update README.md when adding features or changing APIs
435+
- Update AGENT.md when changing development workflows
390436

391437
### DON'T
392438

@@ -397,3 +443,35 @@ The issue with unicorn rules stems from:
397443
- Mix tabs and spaces - follow the .editorconfig rules for each file type
398444
- Use `git commit -m` (use `-F` with a file instead)
399445
- Rely on staged files - always specify files explicitly in commits
446+
- Use `cd` in bash commands - use absolute paths or `pnpm --filter`
447+
- Delete files without explicit permission
448+
449+
## Agent-Specific Instructions
450+
451+
### Claude Code-Specific Instructions
452+
453+
- Use the TodoWrite tool for complex multi-step tasks
454+
- **CRITICAL: Always enumerate files explicitly in git commit commands**
455+
- **NEVER use bare `git commit` without file arguments**
456+
- Fix issues immediately without commentary
457+
- Stay focused on the task at hand
458+
459+
### Universal Agent Guidelines
460+
461+
- Test changes thoroughly before considering tasks complete
462+
- Follow the pre-commit checklist strictly
463+
- Use Write tool for commit messages, not echo, -m, or heredocs
464+
- Create commit message files with descriptive slugs: `.commit-msg-<descriptive-slug>`
465+
- NEVER USE `cd` IN BASH COMMANDS - use absolute paths
466+
- When testing examples, use `pnpm --filter` instead of changing directories
467+
468+
## Debugging Tips
469+
470+
1. **Build Issues**: Run `pnpm clean` then `pnpm build`
471+
2. **Type Errors**: Check `tsconfig.json` and ensure all imports have types
472+
3. **ESLint Not Working**: Use `DEBUG=eslint:eslint pnpm lint` for verbose output
473+
4. **Test Failures**: Check if config changes affect self-linting
474+
5. **Example Issues**: Each example has its own dependencies - check
475+
package.json
476+
6. **Plugin Conflicts**: Different plugin instances = check version consistency
477+
7. **CSS Rule Errors**: Rules meant for JS don't work on CSS files

0 commit comments

Comments
 (0)