spec-commit
Skill0 starsChanged 3 months agoMITView on GitHub
Internal commit helper for public workflows that already hold explicit commit authorization; creates scoped, value-communicating commits without owning push or PR landing.
- Reads credentials
In this repository58 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- spec-app-consistency-auditSkill
- spec-brainstormSkill
- spec-code-reviewSkill
- spec-commit-push-prSkill
- spec-compound-refreshSkill
- spec-compoundSkill
- spec-debugSkill
- spec-doc-reviewSkill
- spec-dogfoodSkill
- spec-explainSkill
- spec-handoffSkill
- spec-ideateSkill
- spec-lfgSkill
- spec-optimizeSkill
- spec-planSkill
- spec-polishSkill
- spec-povSkill
- spec-prdSkill
- spec-product-pulseSkill
- spec-promoteSkill
- spec-resolve-pr-feedbackSkill
- spec-riffrec-feedback-analysisSkill
- spec-rule-minerSkill
- spec-runtime-setupSkill
- spec-simplify-codeSkill
- spec-strategySkill
- spec-sweepSkill
- spec-test-browserSkill
- spec-test-xcodeSkill
- spec-workSkill
- spec-worktreeSkill
- spec-write-skillSkill
- spec-write-tasksSkill
- using-spec-firstSkill
- spec-commit-push-prSkill
- spec-commitSkill
- spec-explainSkill
- spec-handoffSkill
- spec-lfgSkill
- spec-povSkill
- spec-product-pulseSkill
- spec-promoteSkill
- spec-resolve-pr-feedbackSkill
- spec-riffrec-feedback-analysisSkill
- spec-rule-minerSkill
- spec-simplify-codeSkill
- spec-strategySkill
- spec-sweepSkill
- spec-test-browserSkill
- spec-test-xcodeSkill
- spec-worktreeSkill
- using-spec-firstSkill
- creator-buddySkill
- evidence-first-writingSkill
- leo-ppt-generatorSkill
- software-article-en-zhSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 11 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
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
- Distinctive: line 11
Create a single, well-crafted git commit from the current working tree changes.
- Distinctive: line 43
Run every command in the Context section as a separate shell tool call.
- Distinctive: line 51
If both fail, fall back to main.
- Distinctive: line 53
If the git status from the context above shows a clean working tree (no staged, modified, or untracked files), report that there is nothing …
- Very specific: line 57
If the user chooses to create a branch, derive the name from the change content, create it with git checkout -b <branch-name>, then run git …
- Distinctive: line 58
If the user declines, continue with the detached HEAD commit.
- Distinctive: line 62
Follow this priority order:
- Distinctive: line 76
If the separation is obvious (different features, unrelated fixes), split.
- Distinctive: line 81
If the current branch from the context above is main, master, or the resolved default branch from Step 1, automatically create a feature …
- Distinctive: line 92
Use the confirmed branch name for the rest of the workflow.
- Distinctive: line 94
Write the commit message:
- Distinctive: line 114
Run git status after the commit to verify success.
≈ “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.
Files
Git Commit
Create a single, well-crafted git commit from the current working tree changes.
Invocation And Authorization Boundary
This is an internal-only helper. A public workflow may delegate here only after the current user or a visible upstream handoff has established commit_authorization: authorized for the intended run-owned paths. workflow invocation does not authorize commit; tool permission, a dirty tree, a branch name, or successful verification are execution facts, not authority. When commit authorization is missing, stop before branch mutation, staging, or commit and return commit_authorization_missing.
This helper owns commit composition and the authorized commit checkpoint only. It does not own push, PR creation/update, plan lifecycle, or unrelated dirty paths. If branch creation would be required, obtain explicit approval for that concrete branch mutation before creating it.
Context
Gather Git context by running each command as its own argv-style shell tool call. Do not join commands with shell separators, pipes, substitutions, or redirects; those forms are host-shell-specific and can hide the real exit status.
| Command | Purpose | Non-zero or empty result |
git status | Working-tree state | Not a Git repository: stop |
git diff HEAD | Uncommitted changes | An unborn repo may have no HEAD; inspect tracked changes directly |
git branch --show-current | Current branch | Empty output means detached HEAD |
git log --oneline -10 | Commit-message convention | An unborn repo has no history |
git rev-parse --abbrev-ref origin/HEAD | Remote default branch | Resolve it using the fallback in Step 1 |
These facts are a snapshot. Re-read the branch and staged paths immediately before committing because the working tree may change after intake.
Workflow
Step 1: Gather context
Run every command in the Context section as a separate shell tool call.
The remote default branch value returns something like origin/main. Strip the origin/ prefix to get the branch name. If the command exited non-zero or returned a bare HEAD, try:
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'If both fail, fall back to main.
If the git status from the context above shows a clean working tree (no staged, modified, or untracked files), report that there is nothing to commit and stop.
If the current branch from the context above is empty, the repository is in detached HEAD state. Explain that a branch is required before committing if the user wants this work attached to a branch. Ask whether to create a feature branch now. Use the platform's blocking question tool: AskUserQuestion in Claude Code (call ToolSearch with select:AskUserQuestion first if its schema isn't loaded) or request_user_input in Codex. Fall back to presenting options in chat only when no blocking tool exists in the harness or the call errors (e.g., Codex edit modes) — not because a schema load is required. Never silently skip the question.
- If the user chooses to create a branch, derive the name from the change content, create it with
git checkout -b <branch-name>, then rungit branch --show-currentagain and use that result as the current branch name for the rest of the workflow. - If the user declines, continue with the detached HEAD commit.
Step 2: Determine commit message convention
Follow this priority order:
- Repo conventions already in context -- If project instructions (AGENTS.md, CLAUDE.md, or similar) are already loaded and specify commit message conventions, follow those. Do not re-read these files; they are loaded at session start.
- Recent commit history -- If no explicit convention is documented, examine the 10 most recent commits from Step 1. If a clear pattern emerges (e.g., conventional commits, ticket prefixes, emoji prefixes), match that pattern.
- Default: conventional commits -- If neither source provides a pattern, use conventional commit format:
type(scope): descriptionwhere type is one offeat,fix,docs,refactor,test,chore,perf,ci,style,build.
When using conventional commits, choose the type that most precisely describes the change (the type list above). Where fix: and feat: both seem to fit, default to fix:: a change that remedies broken or missing behavior is fix: even when implemented by adding code. Reserve feat: for capabilities the user could not previously accomplish. Other types remain primary when they fit better. The user may override for a specific change.
Step 3: Consider logical commits
Before staging everything together, scan the changed files for naturally distinct concerns. If modified files clearly group into separate logical changes (e.g., a refactor in one directory and a new feature in another, or test files for a different change than source files), create separate commits for each group.
Keep this lightweight:
- Group at the file level only -- do not use
git add -por try to split hunks within a file. - If the separation is obvious (different features, unrelated fixes), split. If it's ambiguous, one commit is fine.
- Two or three logical commits is the sweet spot. Do not over-slice into many tiny commits.
Step 4: Stage and commit
If the current branch from the context above is main, master, or the resolved default branch from Step 1, automatically create a feature branch before staging or committing. Committing directly on the default branch is not an option in this workflow.
Derive the branch name from the change content, validate it, and create it from the current HEAD so uncommitted work and any local-only commits stay attached to the new branch:
BRANCH_NAME="<branch-name>"
git check-ref-format --branch "$BRANCH_NAME"
git checkout -b "$BRANCH_NAME"
git branch --show-currentUse the confirmed branch name for the rest of the workflow. If the branch already exists, derive a safe unique name and retry once. If branch creation still fails, stop before staging and report the failure; do not commit on the default branch.
Write the commit message:
- Subject line: Concise, imperative mood, focused on why not what. Follow the convention determined in Step 2.
- Body (when needed): Add a body separated by a blank line for non-trivial changes. Explain motivation, trade-offs, or anything a future reader would need. Omit the body for obvious single-purpose changes.
For each commit group, stage specific files by name over git add -A or git add . to avoid accidentally including sensitive files (.env, credentials) or unrelated changes. Write the message to a temp file and commit with -F so multi-line bodies are preserved without shell interpolation:
COMMIT_MSG=$(mktemp "${TMPDIR:-/tmp}/spec-commit-message.XXXXXX")
cat > "$COMMIT_MSG" <<'EOF'
type(scope): subject line here
Optional body explaining why this change was made,
not just what changed.
EOF
git add file1 file2 file3
git commit -F "$COMMIT_MSG"Step 5: Confirm
Run git status after the commit to verify success. Report the commit hash(es) and subject line(s).
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
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.

