agentleFS
cosmefaecosmefae/claude-skills/skills/commit-guided/SKILL.md

commit-guided

Skill2 starsChanged 5 months agoMITView on GitHub

Universal guided git workflow to validate, commit, and open a PR. Generates a Conventional Commits message, checks branch, creates PR template. Includes admin override for emergencies.

  • Installs packages
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    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:

    Use this skill when:

    line 17
  2. Distinctive:

    After any edit that needs to be committed

    line 22
  3. Distinctive:

    If there are no changes, inform the user and end the skill.

    line 43
  4. Distinctive:

    If the result is main or master, sync and create a branch before continuing:

    line 51
  5. Distinctive:

    Ask for confirmation of the name before creating it.

    line 65
  6. Distinctive:

    Ask: "Are these the changes you want to publish?"

    line 75
  7. Distinctive:

    Do not use git add -A; stage files per group to preserve semantic separation.

    line 139
  8. Distinctive:

    After creating the PR, show the URL for the user to review and share with the team.

    line 164

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

Skill: commit-guided

Universal guided git workflow to validate, commit, and open a PR.

When to use

Use this skill when:

  • "publish the changes"
  • "commit and PR"
  • "I want to push my changes"
  • "how do I push changes?"
  • After any edit that needs to be committed

Prerequisites

  • git installed and repository configured
  • gh (GitHub CLI) installed to create PRs automatically
  • Branch different from main/master (create a branch if you are not on one yet)

How to run

Step 1: Check status

Execute and show the output:

git status
git diff --stat

If there are no changes, inform the user and end the skill.

Step 2: Check branch

git branch --show-current

If the result is main or master, sync and create a branch before continuing:

git checkout main
git pull origin main
git checkout -b feature/update

Suggest a branch name based on the domain being changed. Use the pattern <scope>/<description>:

  • feature/oauth-login
  • docs/update-readme
  • fix/api-timeout
  • refactor/user-service

Ask for confirmation of the name before creating it.

Step 3: Review the diff

Show the changes for the user to review:

git diff HEAD

Ask: "Are these the changes you want to publish?"

Step 4: Build the commit plan

Analyze the full diff and group files by semantic intent using Conventional Commits format:

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

Commit Grouping Rules

Classify each changed file into (type, scope), one commit per unique pair:

TypeWhen to use
featNew behavior, new feature, new endpoint
fixBug fix, incorrect logic, broken behavior
refactorSame behavior, cleaner code
docsMarkdown, handoff files, specs, comments
choreConfig, migrations, exports, lockfiles, gitignores, backups
testTest files
styleFormatting, lint only

Hierarchy for grouping decisions:

  1. Same type + same project/scope → 1 commit (even multiple files)
  2. Same type + different projects → separate commits
  3. Different types, same project → separate commits
  4. Global config files (AGENTS.md, CLAUDE.md, workspace-level) → chore(workspace)

Rule of thumb: Each commit must answer "What changed and why?" in one line. If the answer needs "and also," it's 2 commits.

Execution order: feat → fix → refactor → docs → chore

Present the grouped plan to the user before executing:

Commit plan (N groups):

1. feat(api): add rate limiting middleware + fix retry backoff calc
   → middleware/rateLimit.ts, lib/retry.ts

2. fix(dashboard): use PORT env var + fix context dir path
   → server.js

3. chore(workspace): sync config files
   → AGENTS.md, .gitignore

Confirm? (or adjust grouping)

Step 5: Commit and push

For each approved group, stage only its files and commit:

# Repeat for each group:
git add <files in group>
git commit -m "<group message>"

# After all groups:
git push -u origin HEAD

Do not use git add -A; stage files per group to preserve semantic separation.

Step 6: Open Pull Request

gh pr create \
  --base main \
  --title "<same title as the commit>" \
  --body "$(cat <<'EOF'
## What changed

<describe changes based on the diff>

## Why

<reason for the change; ask the user if unknown>

## Checklist

- [ ] Changes reviewed in the diff before commit
- [ ] No sensitive or incorrect information included
EOF
)"

After creating the PR, show the URL for the user to review and share with the team.


Common errors handling

ErrorWhat to do
Branch is mainCreate a branch. Never commit directly to main.
gh: command not foundInstruct to install: brew install gh && gh auth login
Push rejected (upstream diverged)Run git pull --rebase before pushing

Notes

  • This skill does not force push or amend published commits
  • PRs without another team member's approval should not be merged into main
  • Universal skill: can be used in any repository

Admin override

Attention: emergency use only (break-glass). Pushing directly to main/master violates Git Flow even for admins. Always prefer the standard flow (branch → PR → review); it protects history, is auditable, and keeps traceability.

This behavior can be overridden in specific projects through .cursor/rules/ or .claude/rules/ files.

Language: The default skill language is English. Projects may override language in their rules if needed. If no override is specified, use English.

When override is active:

  • Steps 2 (branch creation) and 6 (PR creation) are omitted
  • Push happens directly to main/master
  • Validation steps remain mandatory
  • The commit is unreviewed: risk of introducing errors without traceability

Use only if: the main branch is blocked by a critical failure that cannot be fixed via PR, or by explicit instruction from a senior maintainer with documented justification.

The standard flow (branch → PR → review) is the correct behavior for all contributors.

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.