agentleFS
ulpi-ioulpi-io/browse/.agents/skills/commit/SKILL.md

commit

Skill15 starsChanged 8 months agoApache-2.0View on GitHub

Use when the user asks to commit changes. Analyzes diffs deeply to draft intelligent conventional commit messages, detects scope from branch names and file paths, runs pre-commit quality checks (TypeScript, ESLint, Prettier), scans for secrets and debug artifacts, splits unrelated changes into separate commits, and verifies success. Invoke via /commit or when user says "commit", "commit this", "make a commit".

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

189 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use validate-plan, act-on-feedback and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • shawn-dumasSkill

    validate-plan

    Validate an orchestration plan after pre-flight certification. Runs adversarial review, deep review (verify prompt data against codebase), and PoC gate for risky approaches. Auto-invoked by orchestrate-* skills at Step 8.

    Also in 5 projects that use this

  • MicrosoftSkill

    act-on-feedback

    Act on user feedback attached to the current session. Use when the user submits feedback on the session's changes via the Submit Feedback button.

    Also in 3 projects that use this

  • decocmsSkill

    add-mcp-tools

    Guide for adding new MCP tools with consistent patterns for schemas, tool definitions, registry updates, and Better Auth integration

    Also in 3 projects that use this

  • MicrosoftSkill

    generate-run-commands

    Generate or modify run commands for the current session. Use when the user wants to set up or update run commands that appear in the session's Run button.

    Also in 3 projects that use this

  • mitsuhikoSkill

    oebb-scotty

    Austrian rail travel planner (ÖBB Scotty). Use when planning train journeys in Austria, checking departures/arrivals at stations, or looking for service disruptions. Covers ÖBB trains, S-Bahn, regional trains, and connections to neighboring countries.

    Also in 3 projects that use this

  • mitsuhikoSkill

    pi-share

    Load and parse session transcripts from shittycodingagent.ai/buildwithpi.ai/buildwithpi.com/pi.dev (pi-share) URLs. Fetches gists, decodes embedded session data, and extracts conversation history.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

41 rules. 0 are common, 32 are distinctive, and 9 are very specific to this project.

  • 0

    Common

    Most of the 169 edited versions we read keep these.

  • 32

    Distinctive

    This author's own choices. Worth a look.

  • 9

    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:

    Before creating ANY commit, you ABSOLUTELY MUST:

    line 8
  2. Distinctive:

    Read the actual diff content (not just file names)

    line 10
  3. Distinctive:

    Check for conflict markers (<<<<<<<, =======, >>>>>>>)

    line 12
  4. Very specific:

    Run type checking (tsc --noEmit)

    line 13
  5. Distinctive:

    Before creating ANY commit, you MUST complete this checklist:

    line 25
  6. Distinctive:

    Never commit proactively: Only when explicitly requested.

    line 48
  7. Distinctive:

    Run these commands to understand the full picture:

    line 54
  8. Distinctive:

    Read the diff content and classify:

    line 81
  9. Distinctive:

    Follow this priority order:

    line 97
  10. Distinctive:

    If changes serve different purposes, split into multiple commits:

    line 106
  11. Very specific:

    Check git log for recent commits on the same branch.

    line 115
  12. Distinctive:

    Before staging, scan changed files for problems.

    line 121
  13. Distinctive:

    If found, warn the user and exclude from staging.

    line 131
  14. Distinctive:

    Search changed files for leftover debug code:

    line 135
  15. Distinctive:

    If found, warn the user. Suggest removing before commit.

    line 142
  16. Distinctive:

    If found, do NOT commit. These must be resolved first.

    line 150
  17. Very specific:

    Run on changed .ts files only (not the entire codebase) for speed.

    line 156
  18. Distinctive:

    If type errors exist in changed files, show them and do NOT commit until resolved.

    line 164
  19. Very specific:

    If no ESLint config exists, skip with a note: "ESLint skipped — no config found." If lint errors found, show them.

    line 176
  20. Very specific:

    If lint errors found, show them.

    line 177
  21. Distinctive:

    If formatting issues found:

    line 186
  22. Distinctive:

    After fixing, the files will show as modified — they'll be included in staging

    line 188
  23. Distinctive:

    Type errors: Must fix. Do NOT commit.

    line 192
  24. Very specific:

    Breaking changes: Add an exclamation mark after scope, e.g.

    line 214
  25. Distinctive:

    Add a body when:

    line 218
  26. Very specific:

    If the user provided arguments (e.g., /commit fix the payment bug), use them as guidance:

    line 236
  27. Distinctive:

    If it's a clear commit message, use it directly (respecting format rules)

    line 237
  28. Distinctive:

    If it's guidance ("fix the payment bug"), use it to inform type and description

    line 238
  29. Distinctive:

    Always stage files explicitly by name: Never use git add -A or git add ..

    line 244
  30. Distinctive:

    If unsure whether a file should be included, ask the user.

    line 257
  31. Distinctive:

    Use heredoc for proper message formatting:

    line 263
  32. Distinctive:

    If split commits were made, summarize all of them

    line 302
  33. Distinctive:

    After committing, verify complete workflow:

    line 341
  34. Distinctive:

    Gate: Do NOT mark commit complete until all 5 checks pass.

    line 364
  35. Distinctive:

    1 point: Read file names only (--stat)

    line 374
  36. Distinctive:

    2 points: Read full diff content, understood changes

    line 375
  37. Distinctive:

    2 points: All checks pass (or user explicitly approved proceeding)

    line 385
  38. Distinctive:

    Fix: If not pushed, use git commit --amend to correct message.

    line 436
  39. Very specific:

    Fix: Create new branch from HEAD, reset main: git branch feature && git reset --hard origin/main

    line 441
  40. Distinctive:

    When commit is complete, announce:

    line 508
  41. Very specific:

    When create-pr detects uncommitted changes, it automatically invokes commit first.

    line 559

“Common” is measured: kept by at least 6 in 10 of the 169 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
<EXTREMELY-IMPORTANT> Before creating ANY commit, you **ABSOLUTELY MUST**:
  1. Read the actual diff content (not just file names)
  2. Scan for secrets, .env files, and credentials
  3. Check for conflict markers (<<<<<<<, =======, >>>>>>>)
  4. Run type checking (tsc --noEmit)
  5. Stage files explicitly by name (never git add -A or git add .)

Committing without verification = leaked secrets, broken builds, lost work

This is not optional. Every commit requires disciplined verification. </EXTREMELY-IMPORTANT>

Git Commit

MANDATORY FIRST RESPONSE PROTOCOL

Before creating ANY commit, you MUST complete this checklist:

  1. ☐ Run git status --short to see all changes
  2. ☐ Run git diff HEAD to read actual code changes
  3. ☐ Run git branch --show-current for scope inference
  4. ☐ Scan for secrets/credentials in changed files
  5. ☐ Scan for conflict markers
  6. ☐ Run npx tsc --noEmit for type checking
  7. ☐ Determine commit type from diff content
  8. ☐ Announce: "Committing type: [description]"

Creating commits WITHOUT completing this checklist = broken code in history.

Overview

Analyze all uncommitted changes, run quality checks, draft a Conventional Commits message with intelligent scope detection, stage files explicitly, and commit. No co-author trailers.

When to Use

  • User says "commit", "commit this", "make a commit", "/commit"
  • User asks to commit after completing work
  • $ARGUMENTS provided as commit guidance (e.g., /commit fix the auth bug)

Never commit proactively. Only when explicitly requested.

Step 1: Gather Context

Gate: Full diff read and understood before proceeding to Step 2.

Run these commands to understand the full picture:

# Current state (never use -uall flag)
git status --short

# Full diff content — read the actual code changes, not just file names
git diff HEAD

# Branch name — used for scope inference
git branch --show-current

# Recent commits on this branch — for convention and scope consistency
git log --oneline -15

# Check if branch is ahead/behind remote
git status -sb

Read the actual diff output. --stat only shows file names. You need the full diff to understand what changed (new functions vs bug fixes vs refactors).

Step 2: Analyze Changes

Gate: Type and scope determined before proceeding to Step 3.

Determine Commit Type

Read the diff content and classify:

TypeSignal
featNew functions, new files, new endpoints, new capabilities
fixBug fix, error handling correction, wrong logic fixed
docsOnly markdown, comments, or JSDoc changed
styleFormatting, semicolons, whitespace only
refactorRestructured code, renamed variables, moved files, no behavior change
perfCaching added, query optimized, algorithm improved
testTest files added or modified
buildpackage.json, tsconfig, Dockerfile, CI config
choreMaintenance, dependency bumps, config tweaks

Detect Scope

Follow this priority order:

  1. Branch name — If branch is feat/auth-system or fix/cart-totals, extract auth or cart as scope
  2. File paths — If all changes are in src/mastra/tools/search/, scope is search. If in src/services/product/, scope is product
  3. Recent commits — Match scope conventions from git log. If recent commits use feat(agents):, use the same vocabulary
  4. Omit scope — If changes span too many areas or no clear scope exists, omit it: feat: description

Check for Splits

If changes serve different purposes, split into multiple commits:

  • Changes in src/services/product/ fixing a bug + changes in src/mastra/agents/ adding a feature → two commits
  • Changes all related to the same feature across multiple files → one commit

To split: identify the file groups, then execute Step 4-7 for each group sequentially.

Commit Chain Consistency

Check git log for recent commits on the same branch. If previous commits use feat(search):, maintain the same scope spelling. Don't switch between search/product-search/typesense inconsistently.

Step 3: Pre-Commit Safety Scan

Gate: No secrets or conflict markers before proceeding to Step 4.

Before staging, scan changed files for problems.

Secrets and Sensitive Files

Block these from being committed:

  • .env, .env.* files
  • Files containing API_KEY=, SECRET=, PASSWORD=, TOKEN= with actual values
  • *.pem, *.key, credentials.json, serviceAccount.json
  • Files over 1MB (likely binary or data)

If found, warn the user and exclude from staging.

Debug Artifacts

Search changed files for leftover debug code:

# Check changed files for debug statements
git diff HEAD --name-only | xargs grep -n 'console\.log\|debugger\|TODO.*REMOVE\|FIXME.*REMOVE' 2>/dev/null

If found, warn the user. Suggest removing before commit. Do not block — the user decides.

Conflict Markers

git diff HEAD --name-only | xargs grep -n '<<<<<<<\|=======\|>>>>>>>' 2>/dev/null

If found, do NOT commit. These must be resolved first.

Step 4: Run Quality Checks

Gate: Type errors resolved before proceeding to Step 5.

Run on changed .ts files only (not the entire codebase) for speed.

TypeScript Type Check

npx tsc --noEmit

If type errors exist in changed files, show them and do NOT commit until resolved.

ESLint (if configured)

# Check if ESLint config exists
ls .eslintrc* eslint.config.* 2>/dev/null

# If config exists, lint changed files only
git diff HEAD --name-only --diff-filter=d -- '*.ts' | xargs npx eslint

If no ESLint config exists, skip with a note: "ESLint skipped — no config found." If lint errors found, show them. Auto-fixable errors: offer npx eslint --fix <files>.

Prettier (always runs — works without config)

# Check formatting on changed files
git diff HEAD --name-only --diff-filter=d -- '*.ts' '*.json' '*.md' | xargs npx prettier --check

If formatting issues found:

  1. Offer to auto-fix: npx prettier --write <files>
  2. After fixing, the files will show as modified — they'll be included in staging

If Checks Fail

  • Type errors: Must fix. Do NOT commit.
  • Lint errors (auto-fixable): Fix with --fix, then continue.
  • Lint errors (manual): Show to user, ask whether to proceed or fix first.
  • Formatting issues: Auto-fix with prettier --write, then continue.
  • After any auto-fixes: Re-check to confirm clean.

Step 5: Draft Commit Message

Gate: Message follows conventions before proceeding to Step 6.

Format

<type>(<scope>): <description>

[body — when 5+ files changed or multiple logical areas]

Rules

  • Imperative mood: "add feature" not "added feature"
  • Subject line: Under 72 characters, no period
  • Breaking changes: Add an exclamation mark after scope, e.g. feat(api)!: remove legacy endpoint

Body Generation

Add a body when:

  • 5+ files changed
  • Changes span multiple logical areas
  • The "why" isn't obvious from the subject

Body format — bullet points, each starting with imperative verb:

feat(search): add vector similarity scoring

- Add cosine similarity function to search service
- Update product schema with embedding field
- Add migration for new vector column
- Update search tool to use new scoring

$ARGUMENTS

If the user provided arguments (e.g., /commit fix the payment bug), use them as guidance:

  • If it's a clear commit message, use it directly (respecting format rules)
  • If it's guidance ("fix the payment bug"), use it to inform type and description

Step 6: Stage Files

Gate: Only intended files staged before proceeding to Step 7.

Always stage files explicitly by name. Never use git add -A or git add ..

git add src/path/to/file1.ts src/path/to/file2.ts

Never stage:

  • .env, .env.*
  • node_modules/
  • *.pem, *.key, credentials
  • .DS_Store, Thumbs.db
  • Files the user didn't intend to commit

If unsure whether a file should be included, ask the user.

Step 7: Create Commit

Gate: Commit created successfully before proceeding to Step 8.

Use heredoc for proper message formatting:

git commit -m "$(cat <<'EOF'
type(scope): description

Optional body with bullet points
EOF
)"

No co-author trailers. The commit appears as solely the user's work.

Never:

  • --amend unless user explicitly requests it
  • --no-verify (never skip hooks)
  • --allow-empty

Step 8: Verify and Report

Gate: Commit verified in log before proceeding to Step 9.

After committing:

# Confirm commit was created
git log --oneline -1

# Check remaining state
git status --short

# Check if ahead of remote
git status -sb

Report to the user:

  • The commit hash and message
  • Whether the branch is ahead of remote (suggest git push if so)
  • Whether there are remaining uncommitted changes
  • If split commits were made, summarize all of them

Safety Rules

RuleReason
Never commit proactivelyOnly when explicitly asked
Never use git add -A or git add .Risks staging secrets, binaries
Never use --amend unpromptedDestroys previous commit
Never use --no-verifyNever skip pre-commit hooks
Never force pushData loss risk
Never commit with type errorsBroken code should not be committed
Never commit conflict markersIndicates unresolved merge
Never commit .env filesContains secrets
Never add co-author trailersUser's explicit preference

Quick Reference: Scope Detection

1. Branch name?  feat/cart-totals → scope: cart
2. File paths?   src/mastra/tools/search/* → scope: search
3. Git log?      Recent commits use feat(agents): → scope: agents
4. None clear?   Omit scope: feat: description

Quick Reference: Quality Check Order

1. Scan for conflict markers     → BLOCK if found
2. Scan for secrets/sensitive    → BLOCK those files
3. Scan for debug artifacts      → WARN (user decides)
4. Run tsc --noEmit              → BLOCK if type errors
5. Run eslint (if config exists) → FIX or WARN
6. Run prettier --check          → AUTO-FIX
7. All clear → proceed to stage and commit

Step 9: Verification (MANDATORY)

After committing, verify complete workflow:

Check 1: Commit Exists

  • git log --oneline -1 shows the new commit
  • Commit hash and message match expectations

Check 2: No Unintended Changes

  • git status --short shows expected remaining state
  • No secrets or sensitive files were staged

Check 3: Message Quality

  • Type is correct (feat/fix/refactor/etc.)
  • Scope matches affected area
  • Description is imperative mood, under 72 chars

Check 4: Branch State

  • Branch is ahead of remote (if pushing needed)
  • No accidental commits to wrong branch

Check 5: Clean Working State

  • All intended changes are committed
  • Remaining uncommitted files are expected

Gate: Do NOT mark commit complete until all 5 checks pass.


Quality Checklist (Must Score 8/10)

Score yourself honestly before marking commit complete:

Context Gathering (0-2 points)

  • 0 points: Committed without reading diff
  • 1 point: Read file names only (--stat)
  • 2 points: Read full diff content, understood changes

Safety Scanning (0-2 points)

  • 0 points: Skipped security scan
  • 1 point: Partial scan (checked some patterns)
  • 2 points: Full scan: secrets, conflict markers, debug artifacts

Quality Checks (0-2 points)

  • 0 points: Skipped type checking / linting
  • 1 point: Ran checks but proceeded with errors
  • 2 points: All checks pass (or user explicitly approved proceeding)

Staging Discipline (0-2 points)

  • 0 points: Used git add -A or git add .
  • 1 point: Staged files but didn't verify list
  • 2 points: Staged files explicitly by name, verified before commit

Message Quality (0-2 points)

  • 0 points: Generic message ("fix bug", "update")
  • 1 point: Has type but vague description
  • 2 points: Proper conventional commit with type, scope, imperative description

Minimum passing score: 8/10


Common Rationalizations (All Wrong)

These are excuses. Don't fall for them:

  • "It's just a small change" → STILL read the full diff
  • "I know what files changed" → STILL run git status and diff
  • "The type check is slow" → STILL run tsc --noEmit before committing
  • "git add . is faster" → STILL stage files explicitly by name
  • ".env is in .gitignore" → STILL verify it wasn't staged
  • "I'll fix the commit message later" → Get it right NOW, amending is risky
  • "There are no secrets" → STILL scan for API_KEY, SECRET, TOKEN patterns
  • "Pre-commit hooks will catch it" → YOU are responsible, not just hooks

Failure Modes

Failure Mode 1: Leaked Secrets

Symptom: .env file or API key committed to repository Fix: Immediately rotate the secret. Use git filter-branch or BFG to remove from history.

Failure Mode 2: Conflict Markers Committed

Symptom: Code has <<<<<<<, =======, >>>>>>> in committed files Fix: Resolve conflicts properly, amend the commit with --amend.

Failure Mode 3: Type Errors in Committed Code

Symptom: Build fails after commit, tsc shows errors Fix: Fix type errors, create new commit (or --amend if not pushed).

Failure Mode 4: Wrong Commit Type

Symptom: Feature labeled as fix, or vice versa Fix: If not pushed, use git commit --amend to correct message.

Failure Mode 5: Committed to Wrong Branch

Symptom: Changes on main/master instead of feature branch Fix: Create new branch from HEAD, reset main: git branch feature && git reset --hard origin/main


Quick Workflow Summary

STEP 1: GATHER CONTEXT
├── git status --short
├── git diff HEAD (read actual changes!)
├── git branch --show-current
└── Gate: Full diff understood

STEP 2: ANALYZE CHANGES
├── Determine type (feat/fix/refactor/etc.)
├── Detect scope from branch/files/log
├── Check if split needed
└── Gate: Type and scope determined

STEP 3: PRE-COMMIT SAFETY SCAN
├── Scan for secrets (.env, API_KEY, etc.)
├── Scan for conflict markers
├── Scan for debug artifacts
└── Gate: No blocking issues

STEP 4: RUN QUALITY CHECKS
├── tsc --noEmit (type check)
├── eslint (if configured)
├── prettier --check
└── Gate: Checks pass or user approves

STEP 5: DRAFT COMMIT MESSAGE
├── type(scope): description
├── Imperative mood, <72 chars
├── Body if 5+ files
└── Gate: Message ready

STEP 6: STAGE FILES
├── git add <files explicitly>
├── Never git add -A or git add .
├── Verify staged files
└── Gate: Correct files staged

STEP 7: CREATE COMMIT
├── git commit with heredoc
├── No --amend unless requested
├── No --no-verify ever
└── Gate: Commit created

STEP 8: VERIFY AND REPORT
├── git log --oneline -1
├── git status --short
└── Gate: Commit verified

STEP 9: VERIFICATION
├── Check 1: Commit exists
├── Check 2: No unintended changes
├── Check 3: Message quality
├── Check 4: Branch state
├── Check 5: Clean working state
└── Gate: All 5 checks pass

Completion Announcement

When commit is complete, announce:

Commit complete.

**Quality Score: X/10**
- Context Gathering: X/2
- Safety Scanning: X/2
- Quality Checks: X/2
- Staging Discipline: X/2
- Message Quality: X/2

**Commit:**
- Hash: [short hash]
- Message: [full message]
- Files: [count] files changed

**Verification:**
- Commit exists: ✅
- No secrets staged: ✅
- Type errors: None
- Branch: [branch name] (ahead by [N] commits)

**Next steps:**
[Push, create PR, or continue work]

Integration with Other Skills

The commit skill integrates with:

  • start — Use start to identify if commit is needed after work
  • create-pr — After committing, invoke create-pr to submit for review
  • git-merge-expert-worktree — Commit within worktrees follows same workflow

Workflow Chain:

Work completed
       │
       ▼
commit skill (this skill)
       │
       ▼
create-pr skill (if submitting for review)

Auto-Invoke Pattern:

When create-pr detects uncommitted changes, it automatically invokes commit first. You don't need to manually sequence them.

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.