atomic-commits について
atomic-commitsは、複数のGit変更を個別にレビューできるコミットへ整理する開発者向けスキルです。変更の分析、論理的な分類、段階的なステージング、コミット順の決定、履歴確認を案内します。
主な機能
- 01Gitの状態と差分を確認
- 02変更を種類ごとに分類
- 03変更を段階的にステージしてコミット
- 04リスクと目的に応じて順序付け
- 05プッシュ前に履歴を確認
活用シーン
- 01レビュー前に無関係な変更を分離
- 02混在した差分から読みやすい履歴を作成
- 03git add -pでファイルの一部をステージ
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ nullswan/ atomic-commits --skill atomic-commitsインストール後、Claude Code で/atomic-commitsを入力して読み込まれたか確認します。
同梱ファイルreferences/advanced.md
詳細
アトミックコミット
複数の git 変更を、適切な git 履歴を維持できるよう、整理されたアトミックなコミットにまとめます。
ワークフロー
1. 変更を分析する
git status
git diff --stat
git diff
2. 変更を論理的にグループ化する
種類ごとに分類します:
- feat:新機能
- fix:バグ修正
- refactor:コードの改善
- docs:ドキュメント
- test:テストの変更
- chore:メンテナンス
3. 段階的にコミットする
論理的なコミットごとに、対象のファイルをステージングします:
git add path/to/related/files
git commit -m "feat: add user authentication"
git add path/to/other/files
git commit -m "fix: correct null check in validator"
4. プッシュする
git log --oneline -10 # Verify commits
git push origin <branch>
コミットの順序
- ドキュメント(リスクが最も低い)
- テスト(検証の準備)
- バグ修正(独立した修正)
- 機能(主な変更)
- リファクタリング(改善)
コミットメッセージの形式
<type>(<scope>): <description>
[optional body]
種類:feat、fix、docs、style、refactor、test、chore
例
ログインページ、アバターの修正、README の更新、新しいテストに変更がある場合:
git add README.md
git commit -m "docs: update README with login instructions"
git add tests/login.test.ts
git commit -m "test: add login component tests"
git add src/components/Avatar.tsx
git commit -m "fix: correct avatar display on retina screens"
git add src/pages/Login.tsx src/components/LoginForm.tsx
git commit -m "feat: add login page with validation"
git push origin feature/login
ヒント
- 各コミットは単独でレビューできるようにします
- 各コミット後も、コードベースが正常に動作する状態を保ちます
- 迷った場合は、コミット数を減らすより増やすことを優先します
- ファイルの一部を対話的にステージングするには、
git add -pを使用します
高度なパターンについては、references/advanced.md を参照してください。
コメント
Markdown 対応