git-commit
Use when the user asks to create/make/save a commit in ANY language (English/Spanish/paraphrase). Follows Conventional Commits with JIRA ticket detection.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when the user asks to create/make/save a commit in ANY language (English/Spanish/paraphrase). Follows Conventional Commits with JIRA ticket detection.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | git:commit |
| description | Use when the user asks to create/make/save a commit in ANY language (English/Spanish/paraphrase). Follows Conventional Commits with JIRA ticket detection. |
| metadata | {"version":"1.1","scope":["git","vcs"],"trigger":"User requests creating a new commit, in any language or paraphrase","auto_invoke":"Invoke by INTENT not literal phrase. EN: \"commit\", \"commit my changes\", \"create/make a commit\", \"save as commit\", \"ship this as a commit\". ES: \"haz commit\", \"crea un commit\", \"mete commit\", \"guarda en commit\", \"genera el commit\". Skip for history reads (\"show last commit\", \"what was in commit X\")."} |
| allowed-tools | ["Read","Grep","Glob","Write","AskUserQuestion","Bash(git:*)","Bash(pwd)","Bash(find:*)","mcp__atlassian__jira_get_issue"] |
| model | haiku |
pwdgit rev-parse --is-inside-work-tree 2>/dev/null || echo "__NO_GIT__"Heavy git context (branch, status, diff, log) is resolved in Step 0 below using
git -C <target_path>after the target repo is determined. This avoids frontmatter pre-execution failures when CWD is a workspace, not a repo.
This skill automates the creation of git commits following the Conventional Commits specification with optional JIRA ticket integration. Analyze local changes, determine commit type and scope, detect breaking changes, and create properly formatted commits automatically.
Invoke this skill whenever the user asks you to create a commit, in any language or paraphrase. Match by intent, not by literal phrase:
Do NOT invoke for history reads or amendments ("show me the last commit", "what was in commit X", "amend the previous commit"). The trigger is creating a new commit on top of working-tree changes.
This skill reads config.json from its own directory for project-specific settings:
default_base_branch — Base branch for comparisons (default: "main")jira_project_prefix — Expected JIRA project prefix for branch detection (optional, e.g., "BUYERS")workspace — Workspace-aware target resolution. See Step 0 below for the schema and resolution algorithm.If config.json is not present or has empty values, the skill falls back to auto-detection from git context.
The skill may propose updates to config.json (via Write tool) when it learns something new — e.g., discovers repos in a workspace, detects a recurring JIRA prefix, or the user asks to "always" target a specific repo. Write-back is always opt-in: the skill asks via AskUserQuestion before persisting, never overwrites a non-empty value silently, and only modifies its own config.json.
This skill must work in two scenarios: (a) CWD is a git repository (direct mode) and (b) CWD is a workspace containing one or more git repositories nested inside (workspace mode). Resolve the target repo before running any git command.
Inputs:
CWD and Is git repo from the Dynamic Context block aboveconfig.json in this skill's directory, specifically the workspace block:
{
"workspace": {
"mode": "auto",
"default_target": "",
"known_repos": []
}
}
commit on lib-purchaseai)Resolution algorithm:
config.json from this skill's directory.Is git repo == true AND workspace.mode != "multi-repo" → set target_path = ".", skip to step 6 (direct mode).known_repos[].name first, else against known_repos[].path, else against any directory at <CWD>/<arg> containing a .git/ entry.
b. workspace.default_target — if non-empty AND the resolved path exists AND contains .git/, use it.
c. Single known repo — if known_repos.length == 1 AND the path is valid, use it.
d. Multiple known repos — call AskUserQuestion listing known_repos[].name as options. Add an "Other / scan again" option.
e. Empty known_repos — scan with find . -maxdepth 2 -name .git -type d 2>/dev/null | grep -v "/worktrees/" | grep -v "/.claude/". Each match's parent directory is a repo. Populate a discovery list with {name: <basename>, path: <relative>}. If exactly one → use it. If many → AskUserQuestion. If none → report "no git repository found" and stop.target_path — relative or absolute path to the repo (input to git -C)target_owner_repo — owner/repo string for gh (compute via git -C <target_path> remote get-url origin, parse SSH or HTTPS form, e.g., git@github.com:owner/repo.git → owner/repo). Not used by git:commit directly but kept for parity across skills.AskUserQuestion. Never write silently; never overwrite a non-empty value without explicit confirmation:
known_repos from a scan → "Save these N repos to known_repos so I don't re-scan?"known_repos → "Add it to known_repos?"default_target?"jira_project_prefix is empty → "Save jira_project_prefix: <PREFIX>?"
On confirmation, use the Write tool to update config.json (preserve all other fields, write the file atomically).git -C <target_path> <subcommand>. Never cd <target_path> && git ... — Claude Code's anti-pattern alert blocks compound cd && git even with allowlists.Anti-patterns:
cd <target_path> && git <cmd> — blocked by Claude Code, prompts user, cannot be silenced.!``) without || echo "__NO_GIT__" — fails skill loading when CWD is not a git repo.config.json based on a single signal — always confirm with the user before persisting.All commits must follow this format:
[JIRA-ID] <type>(<scope>): <description>
[optional body]
[optional footer(s)]
Breaking changes use this format:
[JIRA-ID] <type>(<scope>)!: <description>
Quick path: If the branch name does not contain a JIRA-like pattern ([A-Z]+-\d+) AND no JIRA ID is found in recent commits, skip JIRA context enrichment (steps 1-2) and proceed directly to change analysis (step 3).
Extract the JIRA ticket ID from the current git branch name.
Branch naming convention:
<type>/<JIRA-ID>-<description>
Examples:
feature/PROJ-123-user-authentication → PROJ-123bugfix/PROJ-456-fix-validation → PROJ-456refactor/APP-789-improve-performance → APP-789Commands:
# Get current branch name (always with -C from Step 0)
git -C <target_path> rev-parse --abbrev-ref HEAD
# Extract JIRA ID using regex pattern: [A-Z]+-[0-9]+
Extraction pattern:
[A-Z]+-[0-9]+Handle edge case: If no JIRA ID is found in branch name, skip the JIRA ID prefix in the commit message and proceed without JIRA context.
A helper script scripts/branch-to-jira.sh is available for reliable JIRA ID extraction from branch names. Usage: bash scripts/branch-to-jira.sh [branch-name] — returns the JIRA ID or empty string. If no argument is provided, it reads the current branch from git automatically.
Once the JIRA ID is extracted, fetch the ticket details to enrich the commit message with context.
Use the JIRA MCP tool:
mcp__atlassian__jira_get_issue
Parameters:
issue_key: The extracted JIRA ID (e.g., "PROJ-456")fields: "summary,description,issuetype,labels"Extract relevant information:
Mapping JIRA Issue Type to Commit Type:
| JIRA Issue Type | Suggested Commit Type | Notes |
|---|---|---|
| Bug, Defect | fix | Bug fixes |
| Story, User Story | feat | New features |
| Task | feat or refactor | Depends on the nature of work |
| Technical Debt | refactor | Code improvements |
| Epic | feat | Large features (usually) |
| Spike | docs or refactor | Research work |
How to use JIRA context:
Example:
JIRA ID: PROJ-456
Summary: "Migrate external service integration to v2"
Issue Type: Task
Description: "Update integration with external service to use new v2 API..."
→ This suggests:
- Type: `feat` (new integration version)
- Scope: `infrastructure` (external service integration)
- Description should mention "migrate" and "v2"
Handle errors gracefully:
Analyze the current git diff to understand what has changed.
Commands:
# Get list of changed files with status
git -C <target_path> diff --name-status
# Get detailed diff
git -C <target_path> diff
# Get diff statistics
git -C <target_path> diff --stat
Analyze the diff output to identify:
Combine with JIRA context:
Based on the analyzed changes, determine the commit type using these patterns:
| Type | When to Use | Keywords in Changes |
|---|---|---|
feat | New functionality or feature | "add", "implement", "introduce", "create" |
fix | Bug fix or error correction | "fix", "resolve", "correct", "repair", "patch" |
refactor | Code restructuring without behavior change | "refactor", "rename", "extract", "move", "simplify" |
docs | Documentation only changes | Changes only to .md files, docstrings, comments |
test | Test additions or modifications | Changes only to test files (*_test.go, *Test.java, *.test.ts, etc.) |
style | Code formatting, no logic change | "format", "style", "lint", whitespace only |
perf | Performance improvements | "cache", "optimize", "performance", "efficient" |
build | Build system or dependencies | Changes to build config (pom.xml, go.mod, package.json, Makefile, etc.) |
ci | CI/CD pipeline changes | Changes to .github/workflows, pipelines |
chore | Maintenance tasks | Configuration updates, cleanup |
Priority when multiple types apply:
feat (new functionality)fix (bug fixes)perf (performance)refactor (code improvements)Combine git diff analysis with JIRA issue type:
featReference: For detailed detection patterns and examples, see commit-patterns.md when needed.
Extract the scope from the changed files to indicate which part of the codebase is affected.
Scope detection strategies:
domain/ or models/ → domainapplication/ or services/ → applicationinfrastructure/ or adapters/ → infrastructureapi/ or controllers/ or routes/ → apiconfig/ or bootstrap/ → configOrderService.java, OrderRepository.java → orderUserEntity.java, UserMapper.java → userPaymentProcessor.java, PaymentValidator.java → paymentauthvalidationsecurityExamples:
domain/entities/Order.java → scope: domain or order
api-rest/controllers/UserController.java → scope: api or user
infrastructure/repositories/ProductRepositoryImpl.java → scope: infrastructure or product
Consider JIRA labels for scope:
Identify if the changes include breaking changes that require the '!' marker.
Breaking change indicators:
Keywords in diff:
If breaking change detected: Add '!' after type and scope:
feat(api)!: remove deprecated endpointfix(domain)!: change order status validationCheck JIRA description for breaking change mentions:
Create a concise, imperative description of the change.
Description guidelines:
Incorporate JIRA summary:
Good examples:
add user authentication servicefix null pointer in order validationrefactor payment processing logicimprove query performance with cachingmigrate external service integration to v2 (from JIRA + git context)Bad examples:
Added new stuff (too vague, wrong tense)Fixed a bug. (too vague, has period)I have updated the code to use a better algorithm for processing orders (too long, wrong perspective)Generate the final commit message and create the commit.
Commit message format:
[JIRA-ID] <type>(<scope>): <description>
Examples:
[PROJ-123] feat(domain): add order creation validation
[PROJ-456] fix(api): handle null pointer in user lookup
[APP-789] refactor(infrastructure): simplify repository implementation
[TASK-321] perf(application)!: change caching strategy for performance
Commands to create commit (always with -C from Step 0):
# Review staged and unstaged files first
git -C <target_path> status
# Stage only reviewed files — avoid git add . to prevent committing sensitive files (.env, credentials)
git -C <target_path> add <file1> <file2> …
# Create commit with generated message
git -C <target_path> commit -m "[JIRA-ID] type(scope): description"
# Verify commit was created
git -C <target_path> log -1 --oneline
Important:
git add . only if all unstaged files have been verified via git statusCommit body (optional but recommended for complex changes): If the change is complex or involves multiple aspects, use the commit body to provide more context:
[JIRA-ID] type(scope): description
- Detail 1 from git diff
- Detail 2 from git diff
- Detail 3 from git diff
Example incorporating JIRA context:
[PROJ-456] feat(infrastructure): migrate external service integration to v2
- Update rest client to use service-rest v2.0.0
- Refactor domain model and mapper for new API contract
- Update repository implementation for v2 endpoints
- Remove deprecated fields from domain model
- Add new configuration properties for v2 endpoints
After creating the commit, verify it was successful and report to the user.
Verification commands:
# Show the created commit
git -C <target_path> log -1 --format="%h %s"
# Show commit details
git -C <target_path> show --stat HEAD
Report to user:
[A-Z]+[A-Z]+-[0-9]+ for JIRA ID extraction — it fails on single-letter project keys (e.g., A-123). Always use [A-Z]+-\d+.git add . without first reviewing git status — unverified files (.env, credentials, binaries) may be staged accidentally.git diff is empty — report "nothing to commit" instead of proceeding.!) always take precedence, then feat, then fix.A full end-to-end walkthrough covering branch parsing, JIRA lookup, diff analysis, and commit creation. For the detailed step-by-step execution, see commit-examples.md.
Covers multiple unrelated changes, breaking changes, missing JIRA IDs, and how JIRA context improves commit messages. For detailed scenarios and examples, see commit-examples.md.
git:pull-request)[A-Z]+[A-Z]+-[0-9]+ for JIRA ID extraction; use [A-Z]+-[0-9]+git add . without first running git status to reviewgit diff is empty — report "nothing to commit" insteadgit add . before committing[JIRA-ID] prefix is omitted from the commit messagemcp__atlassian__jira_get_issue) requires proper authentication and network access to Jira instanceUse when creating an SDD implementation plan from exploration.md, with deep interview, task breakdown, and batch assignments.
Generate a Product Requirements Document via interactive interview. Writes a markdown PRD that captures intent, user stories, and out-of-scope. Use when the brief is vague, when no ticket is bound, or when SDD invokes it from its PRD gate.
Use when executing an SDD plan via batch-based task implementation, tracking progress with [ ]/[X] markers and quality gates.
Use when starting an SDD workflow to discover codebase context, curate relevant files, and prepare exploration.md for planning.
SDD Orchestrator coordinates SDD (Spec-Driven Development) workflow via sub-agents
Use when reviewing code changes before commit, comparing implementation against SDD plan, or doing standalone code review with advisor consultation.