AGENT SKILL

git-workflow

Creates branches, small Conventional Commits and pull request descriptions, safely. Use when committing, writing a commit message, creating a branch, pushing, opening or describing a pull request, or resolving a merge conflict.

License 许可
GPL-3.0
最近更新
2026-11-12
Stars
★ 0
Forks
0

01 前言 Front Matter

name
git-workflow
description
Creates branches, small Conventional Commits and pull request descriptions, safely. Use when committing, writing a commit message, creating a branch, pushing, opening or describing a pull request, or resolving a merge conflict.

02 资源文件 1

03 SKILL.md 正文

Git workflow

Goal: a history anyone can read and revert, one logical change at a time, without ever losing someone's work.

1. Before starting

  • Read the project's rules first (AGENTS.md, CLAUDE.md, CONTRIBUTING.md): they win over this skill.
  • Check where you are: git status and git branch --show-current.
  • Check the identity commits will carry: git config user.name and git config user.email. If either is empty, stop and ask the user; never invent or set one yourself.
  • Never work on main (or master, develop). Create a branch from an up-to-date base: <type>/<short-description>, such as feat/skill-files or fix/windows-mount.

2. Commit

  1. Review what changed: git diff. Stage only files that belong to this change, by name (git add <path>), not git add -A blindly.

  2. Review what is staged: git diff --staged. Look for secrets, debug code, generated files and unrelated edits; leave them out.

  3. Run the project's checks (format, lint, tests) before committing.

  4. Commit with --signoff (-s), always, and a Conventional Commit message. It adds Signed-off-by: <user.name> <user.email> from the configured identity:

    <type>(<optional scope>): <what changed, imperative, lowercase, no period>
    
    <why, optional: at most 3 lines>
    

    Keep the subject under 72 characters. Add a body only when the subject does not explain why; then at most 3 short lines on the reason, not on what the diff already shows. No lists of changed files, no long explanations.

    Types: feat, fix, docs, refactor, test, chore, perf, ci. Add ! after the type for a breaking change, and explain it in the body.

One commit is one logical change that builds and passes tests on its own. Split unrelated changes into separate commits; do not mix a refactor with a fix.

Count commits by logical change, never by plan step or by round of review. A fix to a commit that is not pushed yet belongs in that commit: commit it with git commit --signoff --fixup <commit>, then, before you finish, fold the fixups in with git rebase -i --autosquash <base>, where <base> is the commit the branch started from (git merge-base HEAD main). Set GIT_SEQUENCE_EDITOR=true when no editor can open. Folding keeps the order of the commits, so the branch's last commit stays last. Once a branch is pushed, add new commits instead.

3. Push and pull request

  • Push only when the user asked, or the project's rules allow it.
  • Code reaches the server only through git push. Never create commits or files through an API (such as the GitHub MCP tools that write files): they skip the signoff, the hooks and the protected branches.
  • If a push is rejected (protected branch, hook), do not work around it: push another branch, or tell the user.
  • Open the pull request with the tool you have for it (the GitHub MCP server, or gh). Fill assets/pull-request.md for the description, unless the repository has its own template (.github/pull_request_template.md): then use that.
  • Keep a pull request to one purpose. If it grows, propose splitting it.

4. Never, unless the user explicitly asks

  • Push to main or another protected branch.
  • Rewrite shared history: push --force, rebase or commit --amend on a branch someone else uses. On your own unpushed branch it is fine; prefer --force-with-lease if you must.
  • Destroy work: reset --hard, clean -fd, checkout -- <file>, branch -D. Check git status first and say what would be lost.
  • Commit secrets (.env, keys, tokens). If one was committed, stop and tell the user: removing it from history is not enough, it must be revoked.
  • Skip hooks or checks (--no-verify).
  • Commit without --signoff, or with someone else's identity.

5. Merge conflicts

Merge the base into the branch (git merge --signoff origin/main; on merge, -s means strategy, so write --signoff in full) rather than rebasing a shared branch. Resolve each conflict by understanding both sides; if both changed the same logic and keeping either loses behavior, ask the user. Regenerate lockfiles with the project's tool, never by hand. Run the checks again before committing the merge.

When done

Reply in a few lines: branch, commits made (one line each), whether it was pushed, and the pull request link if one was opened.

04 同仓库更多 Skills

gustavoSaboia97
gustavoSaboia97/casulo

{name=null}

Describe what {name} does and when the agent should use it

★ 0
gustavoSaboia97
gustavoSaboia97/casulo

tdd

Develops with TDD driven by BDD scenarios (Given/When/Then), writing only the functional, regression and unit tests that protect real behavior. Use when implementing a feature, fixing a bug, or when asked for tests, TDD, BDD, regression tests or coverage.

★ 0
gustavoSaboia97
gustavoSaboia97/casulo

security-audit

Audits code for exploitable security problems (injection, broken access control, leaked secrets, unsafe input handling, vulnerable dependencies) and reports only verified findings with severity and fix. Use when asked for a security review or audit, before a release, or when a change touches authentication, permissions, secrets, user input, file paths, commands or network calls.

★ 0
gustavoSaboia97
gustavoSaboia97/casulo

requirements

Turns a request or idea into clear, testable requirements, with scope, user stories and Given/When/Then acceptance criteria. Use when starting a new feature or project, when a request is vague, or when asked for requirements, user stories, acceptance criteria or a feature spec.

★ 0
gustavoSaboia97
gustavoSaboia97/casulo

refactoring

Restructures existing code without changing its behavior, in small steps with the tests green after each one. Use when asked to refactor, clean up, simplify, rename, extract, move or reorganize code, or to work on items recorded as "Refactor later".

★ 0
gustavoSaboia97
gustavoSaboia97/casulo

implementation-plan

Turns requirements into a short implementation plan of small, verifiable steps, each with the files it touches and the test scenarios it covers. Use after requirements are clear and before coding, or when asked to plan, break down or estimate a change.

★ 0