agentleFS
pabloirracionalpabloirracional/claude-skills/skills/automating-git-workflows/SKILL.md

automating-git-workflows

Skill0 starsChanged 4 months agoMITView on GitHub

Automates the commit-push-PR loop with a branch-protection guard, and diagnoses failing CI checks from actual log output. Use whenever the user wants to commit and push changes, open a pull request, or debug why a GitHub Actions check is failing.

  • Deletes or force-pushes
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    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
  1. Distinctive:

    Review the diff before staging anything: - run git status and git diff, summarize what changed, and confirm it matches intent.

    line 12
  2. Very specific:

    If origin isn't configured or push fails: the script reports the git error directly rather than silently swallowing it - confirmed in …

    line 27
  3. Very specific:

    If gh isn't installed: pushes successfully and tells the user to open the PR manually, instead of failing the whole operation.

    line 28
  4. Distinctive:

    If a CI failure looks environment-related (passes locally, fails in CI only), say so explicitly rather than making speculative code changes …

    line 32

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

Automating git workflows

Runs the commit → push → PR loop safely (with a guard against committing straight to main/master), and diagnoses CI failures from real log content instead of guessing.

Workflow

  1. Review the diff before staging anything - run git status and git diff, summarize what changed, and confirm it matches intent. Don't commit unrelated changes that happened to be in the working directory.
  2. Run scripts/commit-and-pr.sh (tested below) to stage, commit, push, and open the PR in one step. It refuses to run on main/master - the user needs to be on a feature branch first.
  3. Write the commit message to explain why, not just what - pass it as the second argument (commit body), separate from the one-line subject.
  4. For a failing CI check: pull the actual failure log (gh run view <run-id> --log-failed or the Actions UI), not just the pass/fail badge. Identify whether it's the code change itself, a flaky test, or an environment/dependency mismatch before proposing a fix.
  5. Never force-push to a shared branch without explicit confirmation from the user - this script never force-pushes, and any fix involving git push --force needs to be flagged and confirmed separately.

Using the script

scripts/commit-and-pr.sh "commit subject" "commit body" "PR title" "PR body"

Tested behavior (verified in a real throwaway repo, not just read):

  • On main/master: exits immediately with a clear message, makes no changes. Confirmed: exit code 1, no commit created.
  • On a feature branch with changes staged: commits with subject + body, then pushes. Confirmed: commit created correctly (git log shows it).
  • If origin isn't configured or push fails: the script reports the git error directly rather than silently swallowing it - confirmed in testing (clean fatal error surfaced, script didn't crash uninformatively).
  • If gh isn't installed: pushes successfully and tells the user to open the PR manually, instead of failing the whole operation.

Notes

  • If a CI failure looks environment-related (passes locally, fails in CI only), say so explicitly rather than making speculative code changes to "fix" what might be a flaky pipeline or a CI-only env var.
  • The script uses set -euo pipefail - any unexpected failure stops execution instead of continuing in a broken state.

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.