agentleFS
MicrosoftKnown publishermicrosoft/Agent365-python/.claude/skills/commit/SKILL.md

commit

Skill41 starsChanged 9 months agoMITView on GitHub

Use this skill when the user wants to commit staged changes. This skill checks linting, then formatting (matching CI order), runs tests, generates a commit message, and commits the changes. Invoke when the user says things like "commit my changes", "commit this", "create a commit", or "/commit".

193 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use create-branch, review-r 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.
  • SentrySkill

    create-branch

    Create a git branch following Sentry naming conventions. Use when asked to "create a branch", "new branch", "start a branch", "make a branch", "switch to a new branch", or when starting new work on the default branch.

    Also in 4 projects that use this

  • luischanciSkill

    review-r

    Run the R code review protocol on R scripts. Checks code quality, reproducibility, domain correctness, and professional standards. Produces a report without editing files.

    Also in 3 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

  • 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

  • AWSSkill

    issue

    Implement a GitHub issue end-to-end — branch, code, test, docs, and commit.

    Also in 9 projects that use this

  • luischanciSkill

    validate-bib

    Validate bibliography entries against citations in all manuscript files. Find missing entries and unused references.

    Also in 3 projects that use this

  • +2 more from luischanci

The file

Show its rules and text

We split this skill into the rules it gives an agent

32 rules. 0 are common, 29 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 174 edited versions we read keep these.

  • 29

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If there are no staged changes, inform the user and stop.

    line 19
  2. Very specific:

    Run the linting check first (matches CI order in .github/workflows/ci.yml):

    line 23
  3. Distinctive:

    Ask if they want you to auto-fix what can be auto-fixed

    line 32
  4. Very specific:

    If yes, run: uv run --frozen ruff check .

    line 33
  5. Distinctive:

    If there are remaining errors that cannot be auto-fixed:

    line 34
  6. Distinctive:

    STOP the commit process

    line 36
  7. Distinctive:

    If all errors were auto-fixed:

    line 38
  8. Distinctive:

    Run the formatting check (after linting, matches CI order):

    line 47
  9. Distinctive:

    Ask if they want you to auto-fix the formatting issues

    line 56
  10. Distinctive:

    IMPORTANT: If any auto-fixes were applied in Steps 2 or 3, re-run both checks to ensure consistency:

    line 67
  11. Distinctive:

    If no auto-fixes were applied, skip this step.

    line 76
  12. Distinctive:

    Run the unit tests (excluding integration tests):

    line 80
  13. Distinctive:

    STOP the commit process immediately

    line 88
  14. Distinctive:

    Do NOT proceed with the commit

    line 95
  15. Distinctive:

    Run git diff --cached to see the actual code changes

    line 104
  16. Distinctive:

    Run git diff --cached --stat to see which files changed

    line 105
  17. Distinctive:

    Check recent commit history for style: git log --oneline -10

    line 106
  18. Distinctive:

    Use imperative mood ("Add feature" not "Added feature")

    line 111
  19. Distinctive:

    No period at the end

    line 113
  20. Distinctive:

    Footer: Always include the co-author line

    line 117
  21. Distinctive:

    Ask if they want to proceed with this message or modify it

    line 132
  22. Distinctive:

    If they want to modify, let them provide changes

    line 133
  23. Distinctive:

    Create the commit using a HEREDOC for proper formatting:

    line 134
  24. Distinctive:

    After committing, run git status to confirm success

    line 147
  25. Distinctive:

    NEVER skip any of the quality checks (format, lint, test)

    line 152
  26. Very specific:

    NEVER use --no-verify or similar flags to bypass hooks

    line 153
  27. Distinctive:

    NEVER commit if tests are failing

    line 154
  28. Distinctive:

    ALWAYS include the Co-Authored-By footer

    line 155
  29. Distinctive:

    If the user wants to commit despite failures, politely decline and explain why quality gates matter

    line 156
  30. Distinctive:

    If tests are slow, inform the user they're running but don't skip them

    line 157
  31. Distinctive:

    If any step fails unexpectedly (not due to code quality issues):

    line 161
  32. Distinctive:

    Do not attempt to work around the error by skipping checks

    line 164

“Common” is measured: kept by at least 6 in 10 of the 174 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

Commit Skill

You are a commit assistant that ensures code quality before committing changes. Follow these steps in order, stopping if any step fails.

Step 1: Check for Staged Changes

First, verify there are staged changes to commit:

git diff --cached --stat

If there are no staged changes, inform the user and stop. Suggest they stage changes with git add.

Step 2: Check Linting

Run the linting check first (matches CI order in .github/workflows/ci.yml):

uv run --frozen ruff check .

If linting check fails:

  1. Inform the user about the linting errors
  2. Ask if they want you to auto-fix what can be auto-fixed
  3. If yes, run: uv run --frozen ruff check . --fix
  4. If there are remaining errors that cannot be auto-fixed:
    • Show the errors clearly to the user
    • STOP the commit process
    • Explain what needs to be manually fixed
  5. If all errors were auto-fixed:
    • Stage the fixes by running git add only on the files that were fixed
    • Continue to the next step

If linting check passes:

Continue to the next step.

Step 3: Check Code Formatting

Run the formatting check (after linting, matches CI order):

uv run --frozen ruff format --check .

If formatting check fails:

  1. Inform the user that formatting issues were found
  2. Ask if they want you to auto-fix the formatting issues
  3. If yes, run: uv run --frozen ruff format .
  4. Show the user what files were reformatted
  5. Stage the formatting fixes by running git add only on the files that were reformatted
  6. Continue to the next step

If formatting check passes:

Continue to the next step.

Step 4: Re-verify After Auto-fixes

IMPORTANT: If any auto-fixes were applied in Steps 2 or 3, re-run both checks to ensure consistency:

uv run --frozen ruff check .
uv run --frozen ruff format --check .

This prevents commits that pass locally but fail CI (e.g., lint fixes that introduce formatting issues). If either check fails after auto-fixes, STOP and inform the user that manual intervention is needed.

If no auto-fixes were applied, skip this step.

Step 5: Run Tests

Run the unit tests (excluding integration tests):

uv run --frozen pytest tests/ -v --tb=short -m "not integration" 2>&1

If tests fail:

  1. STOP the commit process immediately
  2. Show the test failures clearly to the user
  3. Point out:
    • Which test file(s) failed
    • The specific test function(s) that failed
    • The error message and traceback
  4. Suggest what might need to be fixed
  5. Do NOT proceed with the commit

If tests pass:

Continue to the next step.

Step 6: Generate Commit Message

Analyze the staged changes to generate an appropriate commit message:

  1. Run git diff --cached to see the actual code changes
  2. Run git diff --cached --stat to see which files changed
  3. Check recent commit history for style: git log --oneline -10

Generate a commit message following these guidelines:

  • First line: Concise summary (50 chars or less if possible, max 72)
    • Use imperative mood ("Add feature" not "Added feature")
    • Capitalize the first letter
    • No period at the end
  • Body (if needed): Explain the "why" not the "what"
    • Wrap at 72 characters
    • Separate from subject with a blank line
  • Footer: Always include the co-author line

Types of changes to identify:

  • Add - New feature or file
  • Fix - Bug fix
  • Update - Enhancement to existing feature
  • Refactor - Code restructuring without behavior change
  • Remove - Deleting code or features
  • Docs - Documentation only
  • Test - Adding or updating tests
  • Chore - Maintenance tasks

Step 7: Confirm and Commit

  1. Show the user the proposed commit message
  2. Ask if they want to proceed with this message or modify it
  3. If they want to modify, let them provide changes
  4. Create the commit using a HEREDOC for proper formatting:
git commit -m "$(cat <<'EOF'
<commit subject line>

<optional body>

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
  1. After committing, run git status to confirm success
  2. Show the user the commit hash and summary

Important Notes

  • NEVER skip any of the quality checks (format, lint, test)
  • NEVER use --no-verify or similar flags to bypass hooks
  • NEVER commit if tests are failing
  • ALWAYS include the Co-Authored-By footer
  • If the user wants to commit despite failures, politely decline and explain why quality gates matter
  • If tests are slow, inform the user they're running but don't skip them

Error Recovery

If any step fails unexpectedly (not due to code quality issues):

  1. Show the error to the user
  2. Suggest potential fixes
  3. Do not attempt to work around the error by skipping checks

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.