一键导入
git-commit
Create professional git commits following conventional commit format with proper staging and verification
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create professional git commits following conventional commit format with proper staging and verification
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Conduct thorough code reviews for pull requests and pre-commit changes
Run comprehensive project health checks including code quality, documentation, git status, and project structure
Check CI/CD workflow status and troubleshoot failing checks in GitHub Actions
Initialize .docent/ directory structure and configuration for a new project
Comprehensive guide for AI agents on proactive documentation capture using /docent:tell
Migrate a docent v0.9 project to v1.0 skills-based architecture
| name | git-commit |
| description | Create professional git commits following conventional commit format with proper staging and verification |
| group | git |
| keywords | ["commit","git","conventional commits","staging","version control","commits"] |
| version | 1.0.0 |
| author | docent |
This runbook guides you through creating professional, well-structured git commits that follow project conventions and represent logical units of work.
Create git commits that:
Action: Gather complete context about changes and repository state
git status # See untracked files and modifications
git diff # Review unstaged changes
git diff --staged # Review already staged changes
git log --oneline -10 # Check recent commit style
git branch --show-current # Confirm current branch
Analysis Required:
Before proceeding, analyze:
Single Commit When:
Multiple Commits When:
Action: Identify project conventions
Look for patterns in git log:
Match the existing style exactly.
For Single Commit:
# Review and stage relevant files
git add src/feature.ts
git add tests/feature.test.ts
git add README.md
# Or stage all tracked changes
git add -u
# Or stage specific hunks interactively
git add -p src/complex-file.ts
For Multiple Commits:
Stage files in logical groups:
# Example: Stage only configuration files first
git add config/ .env.example docker-compose.yml
Exclusion Checklist:
Do NOT stage:
Format:
type(scope): brief description in imperative mood
[optional body explaining WHY, not HOW]
[optional footer with breaking changes or issue refs]
Conventional Commit Types:
feat: - New feature for usersfix: - Bug fixdocs: - Documentation changes onlystyle: - Formatting, whitespace, no code changerefactor: - Code restructuring without behavior changetest: - Adding or updating testschore: - Maintenance, dependencies, toolingperf: - Performance improvementsci: - CI/CD configuration changesbuild: - Build system or external dependency changesQuality Standards:
Examples:
# Simple feature
git commit -m "feat: add user profile page"
# Feature with scope
git commit -m "feat(auth): implement JWT token refresh"
# Bug fix with body
git commit -m "fix: prevent race condition in file upload
The previous implementation didn't properly lock the upload queue,
causing concurrent uploads to overwrite each other. Added mutex
to ensure sequential processing."
# Breaking change
git commit -m "feat!: migrate to v2 API endpoints
BREAKING CHANGE: All API endpoints now require /v2/ prefix"
git commit -m "feat: add user authentication system
- Implement JWT token generation
- Add login/logout endpoints
- Create user session management"
For Multi-line Messages:
Use heredoc for clean formatting:
git commit -m "$(cat <<'EOF'
feat: implement full-text search
Add search functionality across all content types:
- Product catalog search with fuzzy matching
- User directory search
- Document full-text indexing
Improves user experience by providing unified search interface.
EOF
)"
Action: Confirm commit was created correctly
git log -1 --oneline # Confirm commit exists
git show --stat HEAD # Show committed files
git status # Should show clean working directory
Success Criteria:
If hooks modify files:
git status # See what hook changed
git diff # Review hook modifications
git add -u # Stage hook changes
git commit --reuse-message=HEAD # Retry with same message
If hooks fail with errors:
Do NOT use --no-verify unless explicitly necessary.
When analysis reveals multiple logical units:
Group related files by:
Example: Feature with Tests and Documentation
# Commit 1: Core implementation
git add src/features/search/ src/utils/search-helpers.ts
git commit -m "feat: implement full-text search functionality"
git log -1 --oneline # Verify
# Commit 2: Tests
git add tests/search/ tests/fixtures/search-data.json
git commit -m "test: add search feature test coverage"
git log -1 --oneline # Verify
# Commit 3: Documentation
git add README.md docs/search.md
git commit -m "docs: document search API and configuration"
git log -1 --oneline # Verify
Example: Bug Fix with Refactoring
# Fix first (higher priority)
git add src/validator.ts
git commit -m "fix: correct email validation regex"
# Then refactor
git add src/validator.ts src/types.ts
git commit -m "refactor: extract validation helpers"
Example: Configuration and Feature
# Infrastructure first (feature may depend on it)
git add package.json package-lock.json
git commit -m "chore: add lodash dependency"
# Then feature
git add src/utils/collection-helpers.ts
git commit -m "feat: add collection utility functions"
When single file contains multiple logical changes:
git add -p src/app.ts # Interactively stage hunks
# Stage only auth-related changes
git commit -m "feat: add authentication middleware"
# Stage remaining changes
git add src/app.ts
git commit -m "refactor: reorganize route registration"
Run verification protocol after EACH commit in multi-commit workflow.
Before committing, verify:
Undo Last Commit (Keep Changes):
git reset --soft HEAD~1
Amend Last Commit Message:
git commit --amend -m "corrected message"
Unstage Specific File:
git reset HEAD <file>
Undo All Staging:
git reset HEAD
main branch unless specifiedgit branch --show-currentgit add README.md docs/
git commit -m "docs: update installation instructions"
git add package.json package-lock.json
git commit -m "chore: update dependencies to latest versions"
git add .eslintrc.json prettier.config.js
git commit -m "chore: update linting rules"
git add src/api/users.ts
git commit -m "perf: optimize user query with database indexing
Reduced query time from 450ms to 23ms by adding composite index
on (email, status) columns."
git commit -m "feat!: migrate to ESM module format
BREAKING CHANGE: All imports now require .js extension.
Update import statements from:
import {foo} from './bar'
to:
import {foo} from './bar.js'
"
After completing commits:
git log shows commit(s) with proper messagesgit status shows clean working directory or only intentionally uncommitted files