Commit message conventions, staging practices, and commit best practices. Covers conventional commits, explicit staging workflow, logical change grouping, and humble fact-based communication style. Use when user mentions committing changes, writing commit messages, git add, git commit, staging files, or conventional commit format.
/plugin marketplace add laurigates/claude-plugins/plugin install git-plugin@lgates-claude-pluginsThis skill is limited to using the following tools:
Expert guidance for commit message conventions, staging practices, and commit best practices using conventional commits and explicit staging workflows.
Note: Commits are made on main branch and pushed to remote feature branches for PRs. See git-branch-pr-workflow skill for the main-branch development pattern.
type(scope): description
[optional body]
[optional footer(s)]
# Feature with scope
git commit -m "feat(auth): implement OAuth2 integration"
# Bug fix with body
git commit -m "fix(api): resolve null pointer in user service
Fixed race condition where user object could be null during
concurrent authentication requests."
# Documentation update
git commit -m "docs(readme): update installation instructions"
# Breaking change
git commit -m "feat(api)!: migrate to GraphQL endpoints
BREAKING CHANGE: REST endpoints removed in favor of GraphQL.
See migration guide at docs/migration.md"
# Multiple fixes
git commit -m "fix(auth): resolve login validation issues
- Handle empty email addresses
- Validate password strength requirements
- Add rate limiting to prevent brute force
Fixes #123, #124"
DO:
Fixes #123, Closes #456, Resolves #789Refs #N for related issues that shouldn't auto-closeDON'T:
Fixes) when you only mean to reference (Refs)Common scopes by area:
# Feature areas
feat(auth): login system changes
feat(api): API endpoint changes
feat(ui): user interface changes
feat(db): database schema changes
# Component-specific
fix(header): navigation menu bug
fix(footer): copyright date
fix(sidebar): responsive layout
# Infrastructure
chore(deps): dependency updates
chore(ci): CI/CD configuration
chore(docker): container configuration
# Show current status
git status --porcelain
# Stage files one by one for visibility
git add src/auth/login.ts
git add src/auth/oauth.ts
git status # Verify what's staged
# Show what will be committed
git diff --cached --stat
git diff --cached # Review actual changes
# Commit with conventional message
git commit -m "feat(auth): add OAuth2 support"
Pre-commit hooks often AUTO-MODIFY files (formatters, linters with autofix). This is expected behavior.
# 1. Run pre-commit checks
pre-commit run --all-files --show-diff-on-failure
# 2. Check if pre-commit modified any files
git status --porcelain
# M src/file.ts <- Modified by pre-commit (formatting)
# 3. Stage modified tracked files (original + pre-commit modifications)
git add -u
# 4. Verify pre-commit passes now
pre-commit run --all-files # Should exit 0
# 5. Commit with all changes
git commit -m "feat(feature): add feature with formatting fixes"
Understanding Pre-commit Exit Codes:
Pre-commit file modifications are normal - stage them and proceed with the commit.
# ✅ Explicit staging with review
git status
git add src/feature/new-file.ts
git add tests/feature.test.ts
git diff --cached --stat
git commit -m "feat(feature): add new feature with tests"
# Example: Authentication feature with multiple files
# Group 1: Core implementation
git add src/auth/oauth.ts
git add src/auth/token.ts
git commit -m "feat(auth): implement OAuth2 token handling"
# Group 2: Tests
git add tests/auth/oauth.test.ts
git add tests/auth/token.test.ts
git commit -m "test(auth): add OAuth2 integration tests"
# Group 3: Documentation
git add docs/api/authentication.md
git add README.md
git commit -m "docs(auth): document OAuth2 flow"
# Example: Mixed changes
# Separate linter fixes from feature work
# Group 1: Linter/formatting (chore commit)
git add src/**/*.ts # (only formatting changes)
git add .eslintrc
git commit -m "chore(lint): apply ESLint fixes and update config"
# Group 2: Feature implementation (feat commit)
git add src/feature/implementation.ts
git add tests/feature.test.ts
git commit -m "feat(feature): add new user management feature"
Linter/Formatting Group:
choreFeature/Fix Groups:
feat, fix, refactorDocumentation Group:
docs# ✅ GOOD: Concise, factual, modest
git commit -m "fix(auth): handle edge case in token refresh"
git commit -m "feat(api): add pagination support
Implements cursor-based pagination for list endpoints.
Includes tests and documentation."
# ❌ BAD: Vague, verbose, or overly confident
git commit -m "fix stuff"
git commit -m "AMAZING new feature that revolutionizes everything!!!"
git commit -m "Updated some files to make things work better and faster"
# Example with context
git commit -m "perf(db): optimize user query with index
Added composite index on (user_id, created_at) to improve
query performance for user activity feeds.
Reduces query time from 800ms to 45ms for typical workloads."
# 1. Check current state
git status
# 2. Run pre-commit checks
pre-commit run --all-files
# 3. Stage files explicitly
git add src/feature.ts
git add tests/feature.test.ts
# 4. Review what's staged
git status
git diff --cached --stat
# 5. Commit with conventional message
git commit -m "feat(feature): add new capability
Implements X feature with Y functionality.
Includes unit tests and integration tests.
Closes #123"
# 6. Verify commit
git log -1 --stat
# Fix last commit (before pushing)
git add forgotten-file.ts
git commit --amend --no-edit
# Update commit message
git commit --amend -m "feat(auth): improved OAuth2 implementation"
# Stage parts of a file
git add -p file.ts
# Review hunks and choose:
# y - stage this hunk
# n - do not stage
# s - split into smaller hunks
# e - manually edit hunk
# Subject line: ≤ 72 characters
feat(auth): add OAuth2 support
# Body: ≤ 72 characters per line (wrap)
# Use blank line between subject and body
ALWAYS reference related GitHub issues in commit messages. This creates traceability, enables project management, and provides context for future code archaeology.
GitHub automatically converts these patterns into clickable links:
| Format | Example | Use Case |
|---|---|---|
#N | #123 | Same repository issue/PR |
GH-N | GH-123 | Alternative same-repo format |
owner/repo#N | octo-org/api#456 | Cross-repository reference |
GitHub recognizes 9 keywords to automatically close issues when commits merge to the default branch:
| Keyword | Variants | Effect |
|---|---|---|
| close | close, closes, closed | Closes the issue |
| fix | fix, fixes, fixed | Closes the issue |
| resolve | resolve, resolves, resolved | Closes the issue |
# Close issue in same repository
Fixes #123
Closes #456
Resolves #789
# Close issue in different repository
Fixes octo-org/octo-repo#100
# Close multiple issues (use full keyword for each)
Fixes #123, fixes #456, fixes #789
# Reference without closing (for related context)
Refs #234
Related to #567
See #890
FIXES #123, Fixes #123, fixes #123Fixes: #123, Fixes #123Fixes #123 or Fixes#123 (space optional)| Scenario | Pattern | Example |
|---|---|---|
| Bug fix that resolves an issue | Fixes #N | Fixes #123 |
| Feature that completes an issue | Closes #N | Closes #456 |
| Work related to but not completing issue | Refs #N | Refs #789 |
| Partial progress on larger issue | Refs #N | Refs #101 |
| Breaking change with migration guide | See #N | See #202 |
Important: Keywords only auto-close issues when merged to the default branch. PRs targeting other branches link but don't auto-close.
# Fix with auto-close (single issue)
git commit -m "fix(api): handle timeout
Fixes #123"
# Feature linked to multiple issues
git commit -m "feat(ui): redesign dashboard
Implements designs from #456
Closes #457, closes #458"
# Cross-repository reference
git commit -m "fix(shared): resolve validation bug
Fixes org/shared-lib#42"
# Breaking change with migration reference
git commit -m "feat(api)!: change authentication
BREAKING CHANGE: API key format changed.
See migration guide: #789"
# Reference without closing (use "Refs" or "Related to")
git commit -m "refactor(auth): extract token validation
Refs #234"
# Unstage specific file
git restore --staged wrong-file.ts
# Unstage all
git restore --staged .
# Amend last commit message (before push)
git commit --amend -m "corrected message"
# After push (prefer pre-push correction when possible)
git commit --amend -m "corrected message"
git push --force-with-lease origin branch-name
# Add file and amend
git add forgotten-file.ts
git commit --amend --no-edit
# Undo last commit but keep changes staged
git reset --soft HEAD~1
# Unstage all
git restore --staged .
# Stage and commit in groups
git add group1-file.ts
git commit -m "first logical group"
git add group2-file.ts
git commit -m "second logical group"
This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.