agentleFS
Tsurai7Tsurai7/agentic-playbook/skills/git-safety/SKILL.md

git-safety

Skill0 starsChanged 4 months agoMITView on GitHub

Safe git commit workflow. Use when the user asks to create a commit, or before running git commit. Covers staging, message style, HEREDOC format, amend rules, and hook failures.

  • Reads credentials

11 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Only create commits when requested by the user.

    line 11
  2. Very specific:

    Do not commit secrets (.env, credentials, etc.)

    line 25
  3. Distinctive:

    NEVER: update git config

    line 41
  4. Distinctive:

    Commit has not been pushed

    line 48
  5. Distinctive:

    If commit failed or was rejected by hook — never amend.

    line 49
  6. Distinctive:

    If already pushed — never amend unless user explicitly requests (needs force push)

    line 50
  7. Distinctive:

    Commit with HEREDOC message

    line 56

“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Git commit safety

Only create commits when requested by the user. If unclear, ask first.

Before committing

Run in parallel:

  • git status — untracked files
  • git diff — staged and unstaged changes
  • git log — recent messages for style

Message

  • 1–2 sentences focused on why, not only what
  • Match the repo's message convention (from git log); default types if none: add / update / fix / refactor / test / docs
  • Do not commit secrets (.env, credentials, etc.)

Commit command

Pass message via HEREDOC:

git commit -m "$(cat <<'EOF'
Commit message here.

EOF
)"

Protocol

  • NEVER update git config
  • NEVER destructive commands (push --force, hard reset, etc.) unless explicitly requested
  • NEVER skip hooks (--no-verify, --no-gpg-sign) unless explicitly requested
  • NEVER force push to main/master — warn if requested
  • Avoid git commit --amend unless ALL:
    1. User requested amend, OR commit succeeded but pre-commit hook modified files
    2. HEAD commit was created in this session by you
    3. Commit has not been pushed
  • If commit failed or was rejected by hook — never amend; fix and new commit
  • If already pushed — never amend unless user explicitly requests (needs force push)
  • Do not push unless user asks

Sequence

  1. Stage relevant files
  2. Commit with HEREDOC message
  3. git status to verify

Hook failure

Fix the issue and create a new commit — do not amend a failed commit.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.