hancrafted/markdown-harness / .agents/skills/commit
commit
UnverifiedAuthor a commit message and commit it — Conventional Commits header, Keep a Changelog body, Source trailer, enforced by a commit-time husky gate if setup (--setup-husky). Use before every `git commit`, whether a human or an agent initiates it, including a run split across commits.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.2 KB |
| assets/research.md | markdown | 13.1 KB |
| assets/setup-husky.md | markdown | 6.7 KB |
| scripts/commit-msgexecutable | script | 3.9 KB |
| scripts/lib/git.sh | script | 2.3 KB |
| scripts/lib/hook.sh | script | 1.9 KB |
| scripts/lib/report.sh | script | 2.6 KB |
| scripts/lib/rules.sh | script | 6.0 KB |
| scripts/setup-huskyexecutable | script | 5.0 KB |
scripts/commit-msg
View on GitHub#!/bin/sh
# The commit gate that ships with the `commit` skill.
#
# Reads the proposed commit message from the file named by $1 and exits 0 to
# allow the commit or 1 to reject it. Depends on nothing beyond POSIX shell and
# git, so it behaves identically on a laptop and in a container.
#
# Three blocking conditions — header, body shape, `Source:` trailer — and two
# exemptions. The contract is documented in ../SKILL.md; where the prose and this
# script differ, this script is the contract.
#
# This file is orchestration only. The predicates live in lib/rules.sh, the git
# probes in lib/git.sh, and the diagnostics in lib/report.sh.
set -u
script_dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
# The gate is this file plus lib/. An install that took only the entry file would
# otherwise fail with a bare "not found" from the first `.` below.
for lib in rules git report; do
if [ ! -f "$script_dir/lib/$lib.sh" ]; then
printf '✖ commit gate is incomplete: %s/lib/%s.sh is missing\n' "$script_dir" "$lib" >&2
printf ' The gate is the whole scripts/ directory, not just this file.\n' >&2
printf ' Reinstall the skill: npx skills add hancrafted/skills\n' >&2
exit 1
fi
done
. "$script_dir/lib/rules.sh"
. "$script_dir/lib/git.sh"
. "$script_dir/lib/report.sh"
if [ "$#" -lt 1 ]; then
gate_abort 'no commit message file given' 'usage: commit-msg <path-to-message-file>'
fi
message_file=$1
if [ ! -f "$message_file" ]; then
gate_abort "commit message file not found: $message_file"
fi
comment_string=$(git_comment_string)
raw=$(cat "$message_file")
# Judge what git will store, not the scratch file the editor left behind.
message=$(rules_checkable_message "$raw" "$comment_string")
header=$(rules_line "$message" 1)
# Exemption 1 — `fixup!` / `squash!`, so `--autosquash` keeps working.
if rules_is_autosquash "$header"; then
exit 0
fi
# Exemption 2 — a local merge commit being concluded. `git merge --no-ff` does
# fire this hook, and its generated message cannot pass the header check.
if git_merge_in_progress; then
exit 0
fi
# Condition 1 — the header.
if ! rules_header_ok "$message"; then
report_header_failure "$message"
fi
# Condition 2 — the body's shape.
body_problem=$(rules_body_problem "$message") || report_body_failure "$message" "$body_problem"
# Condition 3 — a `Source:` trailer git can actually parse. Every value found is
# checked; one usable value is enough, and repeats are fine.
source_values=$(git_source_values "$message_file")
if [ -z "$source_values" ]; then
report_source_failure "git's trailer parser found no Source: trailer at all"
else
source_ok=0
source_problem=''
while IFS= read -r source_value; do
value_problem=$(rules_source_problem "$source_value")
if [ -z "$value_problem" ]; then
source_ok=1
elif [ -z "$source_problem" ]; then
source_problem=$value_problem
fi
done <<SOURCES
$source_values
SOURCES
if [ "$source_ok" -eq 0 ]; then
report_source_failure "$source_problem"
fi
fi
if [ "$gate_rejected" -eq 1 ]; then
gate_footer
exit 1
fi
# Passed. One thing left to say: on the editor path git is about to run
# `cleanup=strip` and delete every line starting with the comment character —
# which is exactly what the body's `### <category>` headings start with under the
# default configuration. The commit would look compliant here and be stored
# without its headings, which is the failure this gate exists to prevent.
if rules_comment_string_eats_headings "$comment_string" &&
rules_has_git_comment_lines "$raw" "$comment_string" &&
printf '%s\n' "$message" | grep -q '^### '; then
gate_warn \
"core.commentChar is '$comment_string', so git will strip this message's '### ' headings after this hook." \
'The commit will be stored without them, and its body will not be mineable.' \
'Fix it once per repository: git config core.commentChar ";"' \
'Or run: /commit --setup-husky'
fi
exit 0
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 464k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 196k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |