agentleFS
kaiohenricunhakaiohenricunha/dotbabel/skills/git/SKILL.md

git

Skill0 starsChanged 2 months agoMITView on GitHub

Project-aware git workflow: conventional commits, PR creation, safe pushes, PR merges, and branch naming suggestions. Triggers on: "conventional commit", "create PR", "push changes".

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

37 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use sql, api 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.
  • thechandanbhagatSkill

    sql

    Write SQL queries, optimize database performance, design schemas, and debug SQL issues. Use for database operations, query optimization, and schema design.

    Also in 3 projects that use this

  • xiaobei930Skill

    api

    RESTful API design patterns and best practices. Use when creating endpoints, designing APIs, or implementing routes.

    Also in 3 projects that use this

  • MicrosoftSkill

    scaffold

    Also in 4 projects that use this

  • MicrosoftSkill

    perf

    Speed and memory performance rules for Rust crates, the Node addon, webui-framework, and webui-router.

    Also in 3 projects that use this

  • mrgoonieSkill

    devops

    Deploy to Cloudflare (Workers, R2, D1), Docker, GCP (Cloud Run, GKE), Kubernetes (kubectl, Helm). Use for serverless, containers, CI/CD, GitOps, security audit.

    Also in 3 projects that use this

  • AnthropicSkill

    debug

    Structured debugging session — reproduce, isolate, diagnose, and fix. Trigger with an error message or stack trace, "this works in staging but not prod", "something broke after the deploy", or when behavior diverges from expected and the cause isn't obvious.

    Also in 7 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 11 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 29 edited versions we read keep these.

  • 11

    Distinctive

    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:

    When invoked without a subcommand, execute this workflow:

    line 39
  2. Distinctive:

    Read the diff to understand:

    line 51
  3. Distinctive:

    Prefer staging specific files by name rather than git add .

    line 59
  4. Distinctive:

    Use Conventional Commits format:

    line 63
  5. Distinctive:

    If git diff shows unrelated changes, warn:

    line 152
  6. Distinctive:

    If the user confirms, use a multi-line commit body that lists each concern.

    line 164
  7. Distinctive:

    If merge conflicts occur, report them and do NOT auto-resolve.

    line 181
  8. Distinctive:

    If the working directory is dirty, warn and abort.

    line 182
  9. Distinctive:

    If the repo has an explicit rule against committing on main directly (e.g., CLAUDE.md requiring worktrees or PRs), stop and escalate.

    line 183
  10. Distinctive:

    Create a PR with an auto-generated description.

    line 235
  11. Very specific:

    Use conventional-commit style: <type>(<scope>): <subject>.

    line 248
  12. Very specific:

    Never commit secrets: Check for .env, credentials, API keys, tokens in staged files before each commit.

    line 309
  13. Distinctive:

    Respect project rules: If the repo's CLAUDE.md or equivalent forbids committing on main, or requires worktrees, or demands a PR, follow …

    line 314

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

/git

A project-aware git workflow command: craft conventional commits, create PRs, push with the right safety rails, merge into main, and suggest branch names.

Your Domain

ComponentResponsibility
CommitsCraft precise, conventional commit messages
StagingSmart git add with awareness of what changed
PRsGenerate PR descriptions with /git pr
BranchesBranch suggestions with /git suggest
MergingMerge to main with /git main
PushingSmart push with /git push
HistoryLog analysis, blame, bisect

Primary Command: Auto-Commit

When invoked without a subcommand, execute this workflow:

Step 1: Analyze Changes

git status --porcelain
git diff --stat
git diff --cached --stat

Step 2: Understand the Changes

Read the diff to understand:

  • What files changed (which area: app code, docs, tests, infra)
  • Why they changed (feature, fix, refactor, docs, test, chore)
  • Scope of change (single file, single feature, multiple concerns)

Step 3: Stage

Prefer staging specific files by name rather than git add . or git add -A. Only stage what's part of this logical change. If there are unrelated pending changes, surface them and ask.

Step 4: Craft Commit Message

Use Conventional Commits format:

<type>(<scope>): <subject>

[optional body]

[optional footer]

Types

TypeWhen to Use
featNew feature or capability
fixBug fix
refactorCode change that neither fixes nor adds
docsDocumentation only
testAdding or updating tests
choreMaintenance, deps, config
styleFormatting, whitespace (no logic change)
perfPerformance improvement
ciCI / workflow changes

Scopes

Infer the scope from the top-level directory or domain concept touched (e.g., api, frontend, config, docs, deps). If the repo has a CLAUDE.md or CONTRIBUTING.md section listing allowed scopes, follow that. Otherwise, a short area tag is fine.

Subject Rules

  • Imperative mood: "add feature" not "added feature"
  • No period at the end
  • ≤72 characters for the subject line (50 preferred)
  • Lowercase first letter

Step 5: Execute Commit

git commit -m "<crafted message>"

Step 6: Confirm

Output:

Committed: <hash>
Message:   <type>(<scope>): <subject>
Files:     <count> changed

Message Crafting Examples

Single File Change

git commit -m "feat(config): add staging environment configuration"

Multiple Related Files

git commit -m "feat(api): implement user profile endpoint"

Bug Fix

git commit -m "fix(storage): ensure timestamps use timezone-aware UTC"

Documentation

git commit -m "docs: mark Phase 2 as complete"

Refactor

git commit -m "refactor(config): extract resolver helper function"

Multi-Concern Detection

If git diff shows unrelated changes, warn:

Detected multiple unrelated changes:
   - <file-a> (bug fix)
   - <file-b> (docs update)

Recommendation: commit separately for clean history.

Proceed with combined commit? [y/N]

If the user confirms, use a multi-line commit body that lists each concern.


Action: /git main

Checkout main and merge the previous branch into it.

PREVIOUS_BRANCH=$(git branch --show-current)
git checkout main
git pull origin main
git merge "$PREVIOUS_BRANCH"

Error handling:

  • If merge conflicts occur, report them and do NOT auto-resolve.
  • If the working directory is dirty, warn and abort.
  • If the repo has an explicit rule against committing on main directly (e.g., CLAUDE.md requiring worktrees or PRs), stop and escalate.

Action: /git push

Push the current branch, using --force-with-lease when history has diverged (post-rebase or post-amend).

BRANCH=$(git branch --show-current)
git fetch origin

LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u} 2>/dev/null || echo "none")
BASE=$(git merge-base @ @{u} 2>/dev/null || echo "none")

if [ "$REMOTE" = "none" ]; then
    git push -u origin "$BRANCH"
elif [ "$LOCAL" = "$REMOTE" ]; then
    echo "Already up to date with remote"
elif [ "$BASE" = "$REMOTE" ]; then
    git push origin "$BRANCH"
else
    echo "Branch has diverged from remote, using --force-with-lease"
    git push --force-with-lease origin "$BRANCH"
fi

Safety rules:

  • Never --force without --with-lease.
  • Never force push main or master without explicit user confirmation.
  • Warn if pushing to a protected branch.

Action: /git main push

Combined: merge into main, then push main.

PREVIOUS_BRANCH=$(git branch --show-current)
git checkout main
git pull origin main
git merge "$PREVIOUS_BRANCH"
git push origin main

Action: /git pr

Create a PR with an auto-generated description.

git push -u origin "$(git branch --show-current)"
BRANCH=$(git branch --show-current)
BASE="main"
git log "$BASE..$BRANCH" --oneline
git diff "$BASE...$BRANCH" --stat
gh pr create --title "<generated-title>" --body "<generated-body>"

Title rules:

  • Use conventional-commit style: <type>(<scope>): <subject>.
  • Derive from branch name or most significant commit.

Body template:

## Summary

<2-3 bullets describing what this PR does>

## Changes

<List of key files or areas modified>

## Testing

- [ ] Unit tests pass (<detected test command, e.g. `npm test`, `pytest`, `go test ./...`>)
- [ ] Manual verification completed
- [ ] No regressions introduced

## Related

- Closes #<issue> (if applicable)
- Part of: <milestone> (if applicable)

Action: /git suggest

Suggest a branch name for the next unit of work.

  1. Scan planning documents for next incomplete tasks. Common locations: docs/roadmap.md, docs/plans/*.md, TODO.md, or GitHub issues via gh issue list --state=open.
  2. Identify the next task by looking for:
    • Items marked [ ] following items marked [x]
    • Phase/milestone boundaries
    • Priority indicators
  3. Generate a branch name using:
<type>/<scope>-<short-description>
TypeUsage
feat/New features
fix/Bug fixes
refactor/Code restructuring
docs/Documentation updates
test/Test additions
chore/Maintenance tasks
ci/CI/workflow changes

Scope should match the area conventions used in this repo (detect from recent branch names or CLAUDE.md).


Hard Rules

  1. Never commit secrets. Check for .env, credentials, API keys, tokens in staged files before each commit.
  2. Never force push main or master without explicit confirmation.
  3. Conventional commits format, always.
  4. Atomic commits. One logical change per commit where possible.
  5. Imperative mood in subjects ("add" not "added").
  6. Respect project rules. If the repo's CLAUDE.md or equivalent forbids committing on main, or requires worktrees, or demands a PR, follow that over this command's default flow.

Quick Reference

/git              # stage + commit with crafted message
/git main         # merge current branch into main
/git push         # push current branch (with --force-with-lease when diverged)
/git main push    # merge into main AND push
/git pr           # create a PR with auto-generated description
/git suggest      # suggest next branch name from planning docs

Safety Checks (always run before committing)

# Potential secrets
git diff --cached | grep -iE "(api_key|secret|password|token|bearer|ghp_|sk-[A-Za-z0-9]{20,})" && echo "SECRETS SUSPECTED"

# Large additions
git diff --cached --stat | grep -E "\+[0-9]{4,}" && echo "Large addition detected"

# Binary blobs
git diff --cached --numstat | grep "^-" && echo "Binary file detected"

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.