一键导入
atomic-git-commits
Write atomic, human-reviewable git commits — one logical change per commit with clear conventional messages
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Write atomic, human-reviewable git commits — one logical change per commit with clear conventional messages
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Build full-stack apps with TanStack Start on Cloudflare Workers — routing, server functions, middleware, better-auth, Drizzle ORM with D1
Implement canonical log lines / wide events pattern — one structured JSON line per request with full context, sampling, and observability integration
| name | atomic-git-commits |
| description | Write atomic, human-reviewable git commits — one logical change per commit with clear conventional messages |
| version | 1.0.4 |
Write atomic, human-reviewable git commits. Each commit should represent one logical change that can be understood, reviewed, and reverted independently.
An atomic commit:
Use Conventional Commits with scope:
<type>(<scope>): <subject>
<body — optional, explains WHY>
Co-Authored-By: Name <email>
| Type | When to Use |
|---|---|
feat | New feature or capability |
fix | Bug fix |
refactor | Code restructuring without behavior change |
docs | Documentation only |
test | Adding or updating tests |
chore | Build, CI, dependency updates |
perf | Performance improvement |
feat(web): add session timeout with configurable TTL
refactor(web): replace stateless logger with wide event Logger class
fix(cli): handle 429 rate limit with exponential backoff
docs: add server functions middleware documentation
When refactoring, commit in dependency order so each commit compiles:
1. feat(shared): add new validation types ← foundation
2. refactor(web): update middleware to use types ← consumer
3. feat(web): enrich auth middleware with logger ← integration
1. refactor(web): extract Logger class ← mechanism (the tool)
2. refactor(web): wire Logger into middleware ← policy (how it's used)
3. feat(web): add user identity to wide events ← enrichment
1. chore(web): add rate limiting middleware ← infrastructure
2. feat(api): apply rate limits to publish route ← feature using it
# Bad — two unrelated changes in one commit
git commit -m "fix login bug and update README"
# Good — separate commits
git commit -m "fix(auth): validate email before session create"
git commit -m "docs: update README with auth setup instructions"
# Bad — breaks the build between commits
commit 1: "remove old auth module" ← build breaks here
commit 2: "add new auth module" ← build works again
# Good — atomic swap
commit 1: "refactor(auth): replace old auth with better-auth"
# Bad — noise in the diff
commit: "feat(web): add dashboard route"
+ src/routes/dashboard.tsx ← your code
+ src/routeTree.gen.ts ← auto-generated noise
# Good — separate or .gitignore generated files
commit: "feat(web): add dashboard route"
+ src/routes/dashboard.tsx
Always stage explicitly — avoid git add -A which can catch secrets or generated files:
# Stage specific files for this logical change
git add src/lib/logger.ts src/lib/middleware/types.ts
# Commit with heredoc for multi-line messages
git commit -m "$(cat <<'EOF'
refactor(web): replace stateless logger with wide event Logger class
Introduce a Logger class that accumulates context throughout a request
lifecycle and flushes a single canonical log line.
Co-Authored-By: Name <email>
EOF
)"
Before each commit, verify:
git diff --staged shows only changes related to this commit's purpose.env files, or large binaries are stagedIf you made messy WIP commits, clean up before pushing:
# Squash/reorder last N commits
git rebase -i HEAD~N
# In the editor:
pick abc1234 feat(web): add Logger class
squash def5678 wip: fix typo in Logger ← squash into previous
pick ghi9012 refactor(web): wire Logger into middleware
drop jkl3456 debug: add console.log ← drop entirely
Important: Only rebase commits that haven't been pushed. Never rebase shared history.
Given a task to refactor a stateless logger into a wide event Logger class that touches 5 files, split into 3 atomic commits:
| Commit | Files | Purpose |
|---|---|---|
1. refactor: replace logger with Logger class | logger.ts, types.ts | Core abstraction + type update |
2. refactor: simplify logging middleware | with-logging.ts | Main consumer of new Logger |
3. feat: enrich wide events with user identity | auth.ts, index.ts | Auth integration + re-export |
Each commit: