agentleFS
jamal-gmljamal-gml/anthropica/skills/build-commits/SKILL.md

build-commits

Skill0 starsChanged 13 days agoMITView on GitHub

Stage and write Git commits to standard (Conventional Commits incl. breaking changes, atomic hunks, verified identity and signing, secret scanning, autosquash on unpushed work). Use when staging, committing, amending, splitting or rewording commits, cleaning history before a push, or after a secret was committed. Not for PRs (use `review-pull-request`).

  • Reads credentials
  • Deletes or force-pushes
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    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:

    Split heuristic: if the summary needs "and", split.

    line 53
  2. Very specific:

    Amend: only the newest unpushed commit: git commit --amend --no-edit (content) or --amend -F msg.txt (message).

    line 59
  3. Very specific:

    Own branch already pushed and not shared: after rewriting, git push --force-with-lease=<branch>:<expected-sha> only.

    line 60
  4. Very specific:

    Hooks and signing: never --no-verify or -c commit.gpgsign=false to get past a failure.

    line 61
  5. Very specific:

    Read references/history-editing.md when splitting, reordering, squashing or rewording several commits, or recovering from a bad rebase.

    line 65
  6. Very specific:

    Read references/signing.md when commits must be signed or a signature shows as unverified.

    line 66
  7. Very specific:

    Read references/secret-committed.md immediately when a secret has been committed or pushed.

    line 67
  8. Distinctive:

    Ask before: pushing, any force-push (even with lease), rewriting a commit that exists on a remote, deleting branches, git reset --hard, git …

    line 70
  9. Distinctive:

    If the repo or user wants review before commit, show files, branch and full message, then wait.

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “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 Commits

Produce small, revertable commits with the right identity, honest messages and no secrets.

Procedure

  1. Read local rules first: CONTRIBUTING.md, CLAUDE.md, commitlint.config.*, .husky/, .pre-commit-config.yaml, lefthook.yml. Repository rules override this skill.
  2. Check branch: git branch --show-current. On main, master, develop or a release branch, stop and branch first (naming in review-pull-request). Never commit to bot branches (dependabot/*, renovate/*, release-please--*, changeset-release/*).
  3. Check identity: git config user.name; git config user.email must be the user's. If unset or wrong, set per repo (git config user.email ...) or per command (git -c user.name=... -c user.email=... commit). Never invent one; ask.
  4. Inspect: git status --short, git diff, git diff --staged. Know every file before staging it.
  5. Stage by intent, not by directory:
    • Files: git add <path>. Never git add -A / git add . without reading git status first.
    • Hunks: git add -p <path>; with no interactive terminal, write the hunks to a patch and git apply --cached hunks.diff.
    • Unstage: git restore --staged <path>. Re-check with git diff --staged --stat.
  6. Scan staged content for secrets (patterns below). Run the repo hook, or gitleaks protect --staged / detect-secrets-hook if installed.
  7. Run the fast checks the hooks run (format, lint, unit tests for touched modules). Fix failures; never bypass.
  8. Write the message (format below). Use git commit -F msg.txt for multi-line bodies.
  9. Verify: git log -1 --format='%h %an <%ae> | %cn <%ce>%n%B'; if signing is required, git log -1 --show-signature.
  10. Before push: git log origin/<base>..HEAD --format='%h %an <%ae> %s' and git diff origin/<base>..HEAD for a final identity and secret check. Ask before pushing.

Message format (Conventional Commits 1.0)

<type>(<scope>)!: <imperative summary, <=72 chars, no trailing period>

<body: why, what it affects, alternatives rejected; wrap at 72>

BREAKING CHANGE: <what breaks and how to migrate>
Refs: #123
Fixes ABC-42
TypeUse forRelease effect
featnew user-visible capabilityminor
fixbug fixpatch
perffaster, same behaviourpatch
refactorrestructure, same behaviournone
docs, test, styledocs, tests, formatting onlynone
build, ci, chorebuild system and deps, pipelines, toolingnone (some tools patch on build(deps))
revertrevert: <original summary> + body This reverts commit <sha>.as original
  • Breaking: ! after type/scope and/or a BREAKING CHANGE: footer (exact uppercase spelling, colon, space). Either forces a major bump (minor while 0.y.z); the footer carries migration steps.
  • Scope: lowercase module/package (api, auth, deps). In monorepos use the package name release tooling maps. Omit rather than invent.
  • Footers: Token: value or Token #value, one blank line before the block. Issue keys go in a footer or as a summary suffix (ABC-42), per repo convention.
  • Body: explain why; the diff shows what. Note behaviour changes, risk and follow-ups.
  • Forbidden: "WIP", "fix stuff", "update file", "address review", ticket-only or emoji-only summaries, past tense ("added").

Rules

  • Atomic: each commit builds, passes tests and reverts cleanly alone. Separate formatting/renames, dependency bumps, refactors and features. Rename with git mv in its own commit so history follows the file.
  • Split heuristic: if the summary needs "and", split. Over ~400 hand-written changed lines in one commit needs a stated reason.
  • Generated files (lockfiles, codegen) go in the commit that caused them; regenerate with the tool, never hand-edit.
  • Never commit: .env* (except .env.example with placeholders), private keys (*.pem, id_rsa*, *.p12, *.pfx, *.key), cloud credential files, *.tfstate, secret *.tfvars, kubeconfigs, DB dumps, binaries over ~5 MB (LFS if the repo uses it), node_modules/, build output, IDE folders. Add the pattern to .gitignore in the same change.
  • Secret patterns to grep the staged diff for: AKIA[0-9A-Z]{16}, -----BEGIN [A-Z ]*PRIVATE KEY-----, ghp_|gho_|ghs_|github_pat_, glpat-, xox[baprs]-, sk_live_|rk_live_, AIza[0-9A-Za-z_-]{35}, JWTs eyJ[A-Za-z0-9_-]{10,}\., (password|secret|token|api_key)\s*[:=]\s*\S{8,}, URLs with ://user:pass@.
  • Rewrite only unpushed history. git branch -r --contains <sha> empty = unpushed. If a remote branch others use contains it, add a new commit or git revert <sha>; never rewrite.
  • Fixups: git commit --fixup=<sha>, then GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash <base> (runs without an editor). --fixup=reword:<sha> (git 2.32+) changes only the message.
  • Amend only the newest unpushed commit: git commit --amend --no-edit (content) or --amend -F msg.txt (message). Add --reset-author if the identity was wrong.
  • Own branch already pushed and not shared: after rewriting, git push --force-with-lease=<branch>:<expected-sha> only; never plain --force, never on shared branches.
  • Hooks and signing: never --no-verify or -c commit.gpgsign=false to get past a failure; fix the cause or ask.
  • Rebase conflicts: resolve, git add, git rebase --continue; if unsure, git rebase --abort and ask. Never leave "rebase in progress".
  • Safety net: git branch backup/<name> before any rewrite; git reflog recovers lost commits.

Read references/history-editing.md when splitting, reordering, squashing or rewording several commits, or recovering from a bad rebase. Read references/signing.md when commits must be signed or a signature shows as unverified. Read references/secret-committed.md immediately when a secret has been committed or pushed.

Safety gates

  • Ask before: pushing, any force-push (even with lease), rewriting a commit that exists on a remote, deleting branches, git reset --hard, git clean -fd, git stash drop.
  • Secret in a pushed commit: stop, tell the user, rotate first. Rewriting history alone does not fix it.
  • If the repo or user wants review before commit, show files, branch and full message, then wait.

Output

Branch: <branch>   Base: <base>
Commits:
  <sha7> <type(scope)!: summary>   (<n> files, +<a>/-<d>)
Identity: <name> <email>   Signed: yes | no | not required
Checks: <hooks/lint/tests> -> pass | fail (<detail>)
Secret scan: clean | <finding and action taken>
Pushed: no (awaiting approval) | yes -> <remote>/<branch>

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.