AGENT SKILL

git-workflow-and-versioning

Use when changing code with git, isolating work in a worktree, preparing atomic commits or versions, or deciding whether a branch is ready to merge, deploy, release, or hand off.

License 许可
MIT
最近更新
2026-08-20
Stars
★ 0
Forks
0

01 前言 Front Matter

name
git-workflow-and-versioning
description
Use when changing code with git, isolating work in a worktree, preparing atomic commits or versions, or deciding whether a branch is ready to merge, deploy, release, or hand off.

03 SKILL.md 正文

Git Workflow and Delivery

<HARD-GATE> Protect the user's work. Inspect status before editing, never stage unrelated files, and do not push, merge, deploy, release, or perform another irreversible action without explicit user approval. </HARD-GATE>

Safe Change Workflow

  1. Run git status --short; identify intended and unrelated changes.
  2. Keep each change and commit atomic: one reviewable intent per diff. Prefer short-lived branches and frequent trunk integration.
  3. Stage named files only; never use git add . in a mixed worktree.
  4. Treat commits as verified save points. Do not amend, rewrite, force-push, or discard user work without authorization.
  5. For versioning, update only required package versions, changelog, migration notes, tags, and user-facing docs.
  6. Before handoff, inspect status and diff summary and record verification plus remaining risks.

Worktrees for Isolation

Use a worktree for multi-agent work, a long-running feature, parallel tests, or detached PR review—not a one-line fix.

Preflight:

  • git worktree list: the same branch cannot be checked out twice.
  • Confirm the current worktree's dirty changes are safe and untouched.
  • Use an empty target directory in a sibling location, not nested inside the repository.
  • Prefer an absolute path and verify the intended base branch.
# New branch
 git worktree add -b feature/X /absolute/sibling/repo-X main
# Existing branch
 git worktree add /absolute/sibling/repo-X feature/X
# Detached review
 git worktree add --detach /absolute/sibling/pr-123 origin/pr/123
# Cleanup after confirming work is preserved
 git worktree remove /absolute/sibling/repo-X
 git worktree prune

Worktrees share repository history but have separate working directories and checked-out branches. Recheck pwd, branch, and status before committing or pushing.

Ship Gate

A branch is not complete merely because code exists. Before presenting PR, merge, deploy, or hold options:

  • Check acceptance criteria line by line.
  • Use fresh verification for changed state: relevant tests, typecheck, lint, and build.
  • Run a phantom completion scan for stubs, placeholders, skipped tests, and disconnected wiring.
  • Resolve high-severity review findings.
  • Inspect the diff for secrets, local-only paths, unsafe configuration, and undocumented API/user behavior.
  • Update changelog, docs, ADRs, and migration guidance where behavior requires it.
  • Define rollback beyond git revert when migrations, flags, queues, caches, or external state are involved.

If verification cannot run, report the work as partial or blocked unless the user explicitly accepts the risk. Approval to write code is not approval for an irreversible shipping action.

Completion Evidence

Report branch/worktree, intended changed files, verification output, review status, version/changelog action, rollback plan, and the approved final action—or explain why no commit or release action was taken.

04 同仓库更多 Skills

MinhDuyDEV
MinhDuyDEV/md-pikit

writing-skills

Use when creating new skills, editing existing skills, or verifying skills work before deployment - applies TDD to process documentation by testing with subagents before writing, iterating until bulletproof against rationalization. Includes complete pressure testing methodology.

★ 0
MinhDuyDEV
MinhDuyDEV/md-pikit

verification-before-completion

Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

★ 0
MinhDuyDEV
MinhDuyDEV/md-pikit

typescript-coding-standards

Use when writing, refactoring, or reviewing TypeScript code that needs strong domain modeling, typed errors, schema parsing, safe adapters, test seams, or maintainable module boundaries.

★ 0
MinhDuyDEV
MinhDuyDEV/md-pikit

test-driven-development

Use when implementing a feature, bugfix, or behavior-changing refactor — require a failing behavior test before production code, then make the smallest change that passes.

★ 0
MinhDuyDEV
MinhDuyDEV/md-pikit

source-driven-development

Use when unfamiliar libraries, dependency internals, external APIs, framework behavior, migrations, or current ecosystem guidance require official documentation, version-matched source, read the tests, and cited evidence.

★ 0
MinhDuyDEV
MinhDuyDEV/md-pikit

security-and-hardening

Use when auditing security, implementing authentication or authorization, handling secrets, or validating data across external trust boundaries.

★ 0