commit-changes
について
このスキルは、開発者がコンベンショナルコミットメッセージを使用して変更をステージング、コミット、修正することを支援します。選択的なステージング、HEREDOC形式による記述的なメッセージ作成、コミット履歴の検証を可能にします。Gitワークフローにおいて、論理的な作業単位を保存したり、最近のコミットを修正したりするためにご利用ください。
クイックインストール
Claude Code
推奨npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/commit-changesこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします
ドキュメント
Commit Changes
Stage files selectively, write clear commit messages, and verify commit history.
When to Use
- Saving a logical unit of work to version control
- Creating a commit with a descriptive, conventional message
- Amending the most recent commit (message or content)
- Reviewing what will be committed before committing
Inputs
- Required: One or more changed files to commit
- Optional: Commit message (will be drafted if not provided)
- Optional: Whether to amend the previous commit
- Optional: Co-author attribution
Procedure
Step 1: Review Current Changes
Check working tree status and inspect diffs:
# See which files are modified, staged, or untracked
git status
# See unstaged changes
git diff
# See staged changes
git diff --staged
Got: A clear picture of all modified, staged, and untracked files.
If fail: If git status fails, verify you are inside a git repository (git rev-parse --is-inside-work-tree).
Step 2: Stage Files Selectively
Stage specific files rather than using git add . or git add -A to avoid accidentally including sensitive files or unrelated changes:
# Stage specific files by name
git add src/feature.R tests/test-feature.R
# Stage all changes in a specific directory
git add src/
# Stage parts of a file interactively (not supported in non-interactive contexts)
# git add -p filename
Review what is staged before committing:
git diff --staged
Got: Only the intended files and changes are staged. No .env, credentials, or large binaries.
If fail: Unstage accidentally added files with git reset HEAD <file>. If sensitive data was staged, unstage before committing.
Step 3: Write a Commit Message
Use conventional commits format. Always pass the message via HEREDOC for proper formatting:
git commit -m "$(cat <<'EOF'
feat: add weighted mean calculation
Implements weighted_mean() with support for NA handling and
zero-weight filtering. Includes input validation for mismatched
vector lengths.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
EOF
)"
Conventional commit types:
| Type | When to use |
|---|---|
feat | New feature |
fix | Bug fix |
docs | Documentation only |
test | Adding or updating tests |
refactor | Code change that neither fixes nor adds |
chore | Build, CI, dependency updates |
style | Formatting, whitespace (no logic change) |
Got: Commit created with a descriptive message that explains why, not what.
If fail: If a pre-commit hook fails, fix the issue, re-stage with git add, and create a new commit (do not use --amend since the failed commit was never created).
Step 4: Amend the Last Commit (Optional)
Only amend if the commit has not been pushed to a shared remote:
# Amend message only
git commit --amend -m "$(cat <<'EOF'
fix: correct weighted mean edge case for empty vectors
EOF
)"
# Amend with additional staged changes
git add forgotten-file.R
git commit --amend --no-edit
Got: The previous commit is updated in-place. git log -1 shows the amended content.
If fail: If the commit was already pushed, do not amend. Create a new commit instead. Force-pushing amended commits to shared branches causes history divergence.
Step 5: Verify the Commit
# View the last commit
git log -1 --stat
# View recent commit history
git log --oneline -5
# Verify the commit content
git show HEAD
Got: The commit appears in history with the correct message, author, and file changes.
If fail: If the commit contains wrong files, use git reset --soft HEAD~1 to undo the commit while keeping changes staged, then re-commit correctly.
Validation
- Only intended files are included in the commit
- No sensitive data (tokens, passwords,
.envfiles) committed - Commit message follows conventional commits format
- Message body explains why the change was made
-
git logshows the commit with correct metadata - Pre-commit hooks (if any) passed
Pitfalls
- Committing too much at once: Each commit should represent one logical change. Split unrelated changes into separate commits.
- Using
git add .blindly: Always reviewgit statusfirst. Prefer staging specific files by name. - Amending pushed commits: Never amend commits that have been pushed to a shared branch. This rewrites history and causes problems for collaborators.
- Vague commit messages: "fix bug" or "update" tells nothing. Describe what changed and why.
- Forgetting
--no-editon content amends: When adding forgotten files to the last commit, use--no-editto keep the existing message. - Hook failure leading to
--amend: When a pre-commit hook fails, the commit was never created. Using--amendwould modify the previous commit. Always create a new commit after fixing hook issues.
Related Skills
manage-git-branches- branch workflow before committingcreate-pull-request- next step after committingresolve-git-conflicts- handling conflicts during merge/rebaseconfigure-git-repository- repository setup and conventions
GitHub リポジトリ
関連スキル
content-collections
メタこのスキルは、Content Collections(Markdown/MDXファイルを型安全なデータコレクションに変換するTypeScriptファーストのツール)の本番環境でテストされた設定を提供します。Zodバリデーションによる型安全性を実現し、ブログ、ドキュメントサイト、コンテンツ重視のVite + Reactアプリケーション構築時にご利用ください。Viteプラグインの設定、MDXコンパイルから、デプロイ最適化、スキーマバリデーションまで、すべてを網羅しています。
polymarket
メタこのスキルは、開発者がPolymarket予測市場プラットフォームを活用したアプリケーション構築を可能にします。API統合による取引や市場データの取得に加え、WebSocketを介したリアルタイムデータストリーミングにより、ライブ取引や市場活動を監視できます。取引戦略の実装や、ライブ市場更新を処理するツールの作成にご利用ください。
creating-opencode-plugins
メタこのスキルは、開発者がコマンド、ファイル、LSP操作など25種類以上のイベントタイプにフックするOpenCodeプラグインを作成することを支援します。JavaScript/TypeScriptモジュール向けに、プラグイン構造、イベントAPI仕様、および実装パターンを提供します。カスタムイベント駆動ロジックでOpenCode AIアシスタントのライフサイクルをインターセプト、監視、または拡張する必要がある場合にご利用ください。
sglang
メタSGLangは、高性能なLLMサービングフレームワークであり、RadixAttentionプレフィックスキャッシュを活用したJSON、正規表現、エージェントワークフロー向けの高速で構造化された生成を特長とします。特にプレフィックスが繰り返されるタスクにおいて、大幅に高速な推論を実現し、複雑な構造化出力やマルチターン対話に最適です。制約付きデコードが必要な場合や、広範なプレフィックス共有を伴うアプリケーションを構築する場合は、vLLMなどの代替案ではなくSGLangを選択してください。
