AGENT SKILL

git

Project-aware git workflow: conventional commits, PR creation, safe pushes, PR merges, and branch naming suggestions. Triggers on: "conventional commit", "create PR", "push changes".

License 许可
MIT
最近更新
2026-10-26
Stars
★ 0
Forks
0

01 前言 Front Matter

name
git
description
Project-aware git workflow: conventional commits, PR creation, safe pushes, PR merges, and branch naming suggestions. Triggers on: "conventional commit", "create PR", "push changes".
argument-hint
[subcommand]

03 SKILL.md 正文

/git

A project-aware git workflow command: craft conventional commits, create PRs, push with the right safety rails, merge into main, and suggest branch names.

Your Domain

Component Responsibility
Commits Craft precise, conventional commit messages
Staging Smart git add with awareness of what changed
PRs Generate PR descriptions with /git pr
Branches Branch suggestions with /git suggest
Merging Merge to main with /git main
Pushing Smart push with /git push
History Log analysis, blame, bisect

Primary Command: Auto-Commit

When invoked without a subcommand, execute this workflow:

Step 1: Analyze Changes

git status --porcelain
git diff --stat
git diff --cached --stat

Step 2: Understand the Changes

Read the diff to understand:

  • What files changed (which area: app code, docs, tests, infra)
  • Why they changed (feature, fix, refactor, docs, test, chore)
  • Scope of change (single file, single feature, multiple concerns)

Step 3: Stage

Prefer staging specific files by name rather than git add . or git add -A. Only stage what's part of this logical change. If there are unrelated pending changes, surface them and ask.

Step 4: Craft Commit Message

Use Conventional Commits format:

<type>(<scope>): <subject>

[optional body]

[optional footer]

Types

Type When to Use
feat New feature or capability
fix Bug fix
refactor Code change that neither fixes nor adds
docs Documentation only
test Adding or updating tests
chore Maintenance, deps, config
style Formatting, whitespace (no logic change)
perf Performance improvement
ci CI / workflow changes

Scopes

Infer the scope from the top-level directory or domain concept touched (e.g., api, frontend, config, docs, deps). If the repo has a CLAUDE.md or CONTRIBUTING.md section listing allowed scopes, follow that. Otherwise, a short area tag is fine.

Subject Rules

  • Imperative mood: "add feature" not "added feature"
  • No period at the end
  • ≤72 characters for the subject line (50 preferred)
  • Lowercase first letter

Step 5: Execute Commit

git commit -m "<crafted message>"

Step 6: Confirm

Output:

Committed: <hash>
Message:   <type>(<scope>): <subject>
Files:     <count> changed

Message Crafting Examples

Single File Change

git commit -m "feat(config): add staging environment configuration"

Multiple Related Files

git commit -m "feat(api): implement user profile endpoint"

Bug Fix

git commit -m "fix(storage): ensure timestamps use timezone-aware UTC"

Documentation

git commit -m "docs: mark Phase 2 as complete"

Refactor

git commit -m "refactor(config): extract resolver helper function"

Multi-Concern Detection

If git diff shows unrelated changes, warn:

Detected multiple unrelated changes:
   - <file-a> (bug fix)
   - <file-b> (docs update)

Recommendation: commit separately for clean history.

Proceed with combined commit? [y/N]

If the user confirms, use a multi-line commit body that lists each concern.


Action: /git main

Checkout main and merge the previous branch into it.

PREVIOUS_BRANCH=$(git branch --show-current)
git checkout main
git pull origin main
git merge "$PREVIOUS_BRANCH"

Error handling:

  • If merge conflicts occur, report them and do NOT auto-resolve.
  • If the working directory is dirty, warn and abort.
  • If the repo has an explicit rule against committing on main directly (e.g., CLAUDE.md requiring worktrees or PRs), stop and escalate.

Action: /git push

Push the current branch, using --force-with-lease when history has diverged (post-rebase or post-amend).

BRANCH=$(git branch --show-current)
git fetch origin

LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u} 2>/dev/null || echo "none")
BASE=$(git merge-base @ @{u} 2>/dev/null || echo "none")

if [ "$REMOTE" = "none" ]; then
    git push -u origin "$BRANCH"
elif [ "$LOCAL" = "$REMOTE" ]; then
    echo "Already up to date with remote"
elif [ "$BASE" = "$REMOTE" ]; then
    git push origin "$BRANCH"
else
    echo "Branch has diverged from remote, using --force-with-lease"
    git push --force-with-lease origin "$BRANCH"
fi

Safety rules:

  • Never --force without --with-lease.
  • Never force push main or master without explicit user confirmation.
  • Warn if pushing to a protected branch.

Action: /git main push

Combined: merge into main, then push main.

PREVIOUS_BRANCH=$(git branch --show-current)
git checkout main
git pull origin main
git merge "$PREVIOUS_BRANCH"
git push origin main

Action: /git pr

Create a PR with an auto-generated description.

git push -u origin "$(git branch --show-current)"
BRANCH=$(git branch --show-current)
BASE="main"
git log "$BASE..$BRANCH" --oneline
git diff "$BASE...$BRANCH" --stat
gh pr create --title "<generated-title>" --body "<generated-body>"

Task state. If this worktree has an open task (dotbabel task list), record the pull request on it: dotbabel task update <slug> --phase pr --decision "PR #<N>". Under /pr-conductor, the conductor records the later phases. When there is no task, or dotbabel is not installed, skip this step.

Title rules:

  • Use conventional-commit style: <type>(<scope>): <subject>.
  • Derive from branch name or most significant commit.

Body template:

## Summary

<2-3 bullets describing what this PR does>

## Changes

<List of key files or areas modified>

## Testing

- [ ] Unit tests pass (<detected test command, e.g. `npm test`, `pytest`, `go test ./...`>)
- [ ] Manual verification completed
- [ ] No regressions introduced

## Related

- Closes #<issue> (if applicable)
- Part of: <milestone> (if applicable)

Action: /git suggest

Suggest a branch name for the next unit of work.

  1. Scan planning documents for next incomplete tasks. Common locations: docs/roadmap.md, docs/plans/*.md, TODO.md, or GitHub issues via gh issue list --state=open.

  2. Identify the next task by looking for:

    • Items marked [ ] following items marked [x]
    • Phase/milestone boundaries
    • Priority indicators
  3. Generate a branch name using:

<type>/<scope>-<short-description>
Type Usage
feat/ New features
fix/ Bug fixes
refactor/ Code restructuring
docs/ Documentation updates
test/ Test additions
chore/ Maintenance tasks
ci/ CI/workflow changes

Scope should match the area conventions used in this repo (detect from recent branch names or CLAUDE.md).


Hard Rules

  1. Never commit secrets. Check for .env, credentials, API keys, tokens in staged files before each commit.
  2. Never force push main or master without explicit confirmation.
  3. Conventional commits format, always.
  4. Atomic commits. One logical change per commit where possible.
  5. Imperative mood in subjects ("add" not "added").
  6. Respect project rules. If the repo's CLAUDE.md or equivalent forbids committing on main, or requires worktrees, or demands a PR, follow that over this command's default flow.

Quick Reference

/git              # stage + commit with crafted message
/git main         # merge current branch into main
/git push         # push current branch (with --force-with-lease when diverged)
/git main push    # merge into main AND push
/git pr           # create a PR with auto-generated description
/git suggest      # suggest next branch name from planning docs

Safety Checks (always run before committing)

# Potential secrets
git diff --cached | grep -iE "(api_key|secret|password|token|bearer|ghp_|sk-[A-Za-z0-9]{20,})" && echo "SECRETS SUSPECTED"

# Large additions
git diff --cached --stat | grep -E "\+[0-9]{4,}" && echo "Large addition detected"

# Binary blobs
git diff --cached --numstat | grep "^-" && echo "Binary file detected"

04 同仓库更多 Skills

kaiohenricunha
kaiohenricunha/dotbabel

yolo

Start temporary autonomy for the current task or an explicit scope with a required --for expiry. Codex permits scoped pushes, merges, deploys, and releases after strict testing and validation; Full access is a separate runtime setting. Claude Code uses a session permission hook with a protected-action denylist.

开发工程师
★ 0
kaiohenricunha
kaiohenricunha/dotbabel

veracity-audit

Audit a data pipeline for Veracity and Value. Dispatches data-scientist, compliance-auditor, and data-engineer agents with project context injected at dispatch time. All source paths are supplied via flags — no defaults, no project assumptions. Subcommands: audit (full pipeline walk), score-check (scoring math only), gate-check (gate coverage only), source-trace <label> (single source end-to-end). Invoke when: "audit pipeline", "veracity check", "scoring math correct?", "check gates", "trace source", "verify quality gates", "formula correct?".

律师与法务Skill与智能体开发
★ 0
kaiohenricunha
kaiohenricunha/dotbabel

validate-spec

Audit an already-implemented spec against the codebase. Walks each constraint (ARCH-N, PERF-N, KD-N, etc.) and acceptance criterion, grounds findings in file:line evidence, runs the spec.json acceptance_commands, and writes a single audit doc to docs/audits/. Use whenever the user asks to "validate a spec", "audit a spec", "check if spec is implemented", "verify the spec is done", "is this spec really done", or otherwise wants closure on spec-driven work. Read-only against the spec — produces an audit, never modifies the spec itself.

★ 0
kaiohenricunha
kaiohenricunha/dotbabel

terragrunt-specialist

Deep-dive Terragrunt hierarchy review, DRY pattern audits, and run-all orchestration analysis. Use for structured investigations of multi-environment Terragrunt layouts, dependency graphs, remote state config, and hook correctness. Triggers on: "Terragrunt audit", "run-all review", "dependency block", "DRY pattern review", "env hierarchy audit", "mock_outputs", "terragrunt hooks".

运维与部署
★ 0
kaiohenricunha
kaiohenricunha/dotbabel

terraform-specialist

Deep-dive Terraform architecture review, module design, state management, and migration. Use for structured investigations of Terraform workspaces, provider configuration, module coupling, import workflows, and test coverage. Triggers on: "Terraform audit", "module review", "state management", "Terraform import", "workspace design", "provider config review", "Terraform testing".

测试与质量运维与部署
★ 0
kaiohenricunha
kaiohenricunha/dotbabel

spec

Create structured engineering specs through interactive pairing. Use when the user wants to create a spec, design doc, technical specification, architecture document, RFC, or engineering plan. Triggers on "let's spec this out", "create a spec", "design doc", "write a technical plan", "plan the architecture". Works for greenfield and brownfield projects. Outputs to docs/specs/.

设计师视觉设计
★ 0