agentleFS
pvalenapvalena/claude-skills/commit/SKILL.md

Project Commit

Skill2 starsChanged 59 days agoMITView on GitHub

Project-aware commits — discover conventions from CLAUDE.md, run pre-commit checks, format messages

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 15 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈15

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    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:

    Do NOT use when:

    line 26
  2. Distinctive:

    Discover, don't assume: Read project docs and history to find conventions.

    line 32
  3. Distinctive:

    Never carry conventions from one project to another.

    line 33
  4. Distinctive:

    Fail before committing, not after: All checks run before git commit.

    line 39
  5. Very specific:

    Look for .claude/repo-config.yml (see the repo-config skill).

    line 58
  6. Distinctive:

    Look for: prefix format, required checks, validation script paths, line width limits, version history conventions.

    line 71
  7. Distinctive:

    No consistent pattern — freeform

    line 84
  8. Distinctive:

    Check for version-tracked files to know what needs version bump checks:

    line 88
  9. Distinctive:

    Run all checks, report all findings.

    line 126
  10. Distinctive:

    If a validation script was discovered, run it on the relevant scope:

    line 130
  11. Distinctive:

    If a line width convention was discovered, check only staged files:

    line 140
  12. Distinctive:

    If staged changes include version-tracked files with substantive content changes (not just whitespace), check whether the version field …

    line 153
  13. Distinctive:

    If changes span unrelated directories or concerns, suggest splitting.

    line 171
  14. Distinctive:

    Always WARN, never FAIL — the user decides.

    line 172
  15. Distinctive:

    All PASS → proceed to Phase 3

    line 186
  16. Distinctive:

    None: follow built-in message rules

    line 203
  17. Very specific:

    Follow the built-in commit instructions: stage specific files (not git add -A), use HEREDOC format for the message, include Co-Authored-By …

    line 215

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

Project Commit Skill (Experimental)

Purpose: Augment Claude Code's built-in commit workflow with project-specific conventions — prefix format, pre-commit validation, and quality checks discovered from the project's own documentation and history.

Experimental: New skill, not yet validated across diverse projects. Convention discovery heuristics may need tuning for non-standard setups.

When to Use This Skill

Use when:

  • Committing in a project with documented commit conventions (prefix, message structure)
  • Project has validation scripts that should run before every commit
  • Want to catch forgotten version bumps, line width violations, or scope mixing
  • Want consistent commit formatting across sessions in the same project

Do NOT use when:

  • The project has no conventions and the built-in commit workflow is sufficient
  • The user explicitly asks for a quick commit without checks

Core Principles

Discover, don't assume. Read project docs and history to find conventions. Never carry conventions from one project to another.

Augment, don't replace. The built-in commit instructions handle staging, Co-Authored-By, and message drafting. This skill adds convention discovery and pre-commit checks on top.

Fail before committing, not after. All checks run before git commit. A check that runs after commit is a wasted check.

Generic checks, project-specific config. The check types (line width, version bump, validation) are generic. The parameters (120 chars, SKILL.md, validate_skills.sh) come from the project -- authoritatively from .claude/repo-config.yml when present (see the repo-config skill), with doc/git-history discovery as fallback.


Workflow

Phase 1: Discover Conventions

Goal: Build a convention profile from project documentation and git history.

1. Read repo-config (authoritative)

Look for .claude/repo-config.yml (see the repo-config skill). If present, it is the source of truth — keys: line_width, version_files, validation, disabled_checks, and a commit: block (prefix, body_style). Use those values verbatim and skip discovery for any key the file sets. Only fall through to the sources below for keys the config omits, or when no config file exists.

2. Read project documentation (fallback)

grep -i -A 5 'commit\|prefix\|message.*format' CLAUDE.md 2>/dev/null
grep -i -A 3 'commit\|version.*convention' MEMORY.md 2>/dev/null

Look for: prefix format, required checks, validation script paths, line width limits, version history conventions.

3. Infer from git history

git log --oneline -20

Detect prefix pattern from recent commits:

  • scope: message — scope-prefix (e.g., review: trim v3.9)
  • type(scope): message — conventional commits
  • TICKET-123: message — ticket-prefix
  • No consistent pattern — freeform

4. Detect project type

Check for version-tracked files to know what needs version bump checks:

  • */SKILL.md — skills repo (check version: in frontmatter)
  • package.json — JS/TS (check "version":)
  • pyproject.toml / setup.py — Python
  • Cargo.toml — Rust
  • pom.xml — Java

5. Find validation commands

grep -oE '[a-zA-Z0-9/_.-]+\.(sh|py)' CLAUDE.md MEMORY.md 2>/dev/null \
  | sort -u

Also check: Makefile (make lint/test), package.json (npm run lint/test).

6. Output the discovered profile

Report what was found before proceeding — the user should see and confirm:

Discovered conventions:
  Prefix:      "skill-name: " (from repo-config)
  Validation:  create-skill/validate_skills.sh (from repo-config)
  Line width:  120 chars (from repo-config)
  Version:     */SKILL.md version: field (from repo-config)
  Body style:  verbose — detail in commit message (from repo-config)

Label each value with its real source (repo-config when the key came from .claude/repo-config.yml, otherwise the fallback it was discovered from).


Phase 2: Pre-Commit Checks

Goal: Catch project-specific issues before committing.

Run all checks, report all findings. Do not stop at the first failure.

Check 1: Project validation

If a validation script was discovered, run it on the relevant scope:

path/to/validate.sh; echo "Exit: $?"

Non-zero exit code → FAIL.

Check 2: Line width

If a line width convention was discovered, check only staged files:

for f in $(git diff --cached --name-only); do
  [ -f "$f" ] && awk -v f="$f" -v w=120 \
    'length > w {print f":"NR": "length" chars"}' "$f"
done

Any hits → WARN with file:line details.

Check 3: Version bump

If staged changes include version-tracked files with substantive content changes (not just whitespace), check whether the version field changed:

git diff --cached -- '*.md' | grep '^[+-]version:'

Content changed but no version diff → WARN. This is advisory — the user may intentionally skip a version bump for minor edits.

Check 4: Scope coherence

Review staged file list for unrelated changes:

git diff --cached --stat

If changes span unrelated directories or concerns, suggest splitting. Always WARN, never FAIL — the user decides.

Report findings

Pre-commit checks:
  [PASS] Validation: 0 errors
  [WARN] Line width: 2 lines over 120 chars in review/SKILL.md
  [WARN] Version: review/SKILL.md changed but version not bumped
  [PASS] Scope: all changes in review/
  • Any FAIL → stop and fix before committing
  • Any WARN → report to user, ask whether to proceed or fix
  • All PASS → proceed to Phase 3

Phase 3: Draft and Commit

Goal: Format the commit message per discovered conventions and execute.

1. Apply prefix format

Based on discovered pattern:

  • Scope-prefix (skill: message): determine scope from the primary directory of changed files
  • Conventional (type(scope): message): infer type from diff — feat for new files, fix for bug fixes, docs for docs only, refactor for restructuring
  • Ticket-prefix: extract from branch name or prompt user
  • None: follow built-in message rules

2. Structure the body

  • Verbose (e.g., this skills repo): summary line + blank line + bullet-point details of each change + blank line + Co-Authored-By. Verbose details go in the commit message because version history files are kept to one-liners.
  • Brief: summary line + Co-Authored-By trailer only.

3. Execute

Follow the built-in commit instructions: stage specific files (not git add -A), use HEREDOC format for the message, include Co-Authored-By trailer. Do not use --no-verify unless the user explicitly asks.

4. Post-commit verify

git log -1 --format='%s'

Confirm the prefix and format match the discovered conventions.


Version History

  • 1.0.0 (2026-07-18): Initial version

See Also

  • repo-config — Authoritative source for prefix, validation, line width, and version files
  • create-skill — Includes validate_skills.sh used as pre-commit validation example
  • refresh-docs — For updating project docs that contain commit conventions
  • auto-memory — For maintaining MEMORY.md where commit conventions may be documented

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.