agentleFS
jmlrtjmlrt/skills/git/SKILL.md

git

Skill0 starsChanged 4 months agoMITView on GitHub

Git workflow conventions: worktrees, commits, rebase, pre-commit hooks, and pushing branches. Use before starting code changes in a repo, and whenever committing, rebasing, or pushing.

  • Deletes or force-pushes
  • Commits and pushes

57 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use sql, databases and 8 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 4 projects that use this

  • mrgoonieSkill

    databases

    Work with MongoDB (document database, BSON documents, aggregation pipelines, Atlas cloud) and PostgreSQL (relational database, SQL queries, psql CLI, pgAdmin). Use when designing database schemas, writing queries and aggregations, optimizing indexes for performance, performing database migrations, configuring replication and sharding, implementing backup and restore strategies, managing database users and permissions, analyzing query performance, or administering production databases.

    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 4 projects that use this

  • MicrosoftSkill

    typescript

    TypeScript best practices for this monorepo. Use this skill when: (1) writing new TypeScript code, (2) reviewing TypeScript code, (3) working with API responses, fetch calls, or JSON parsing, (4) adding or modifying types and interfaces.

    Also in 4 projects that use this

  • VercelSkill

    react

    React renderer for json-render that turns JSON specs into React components. Use when working with @json-render/react, building React UIs from JSON, creating component catalogs, or rendering AI-generated specs.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    test

    Also in 8 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 51 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Not required for doc-only repos (listed in your user-level CLAUDE.md).

    line 10
  2. Very specific:

    Run git worktree list at session start, after a summary, and before creating one.

    line 12
  3. Very specific:

    Create BEFORE any edit, at .worktrees/<name> (name = branch with / → -.

    line 14
  4. Very specific:

    Run git worktree add from the repo root after an absolute cd, never with -C.

    line 15
  5. Distinctive:

    If edits already landed in the main checkout: git stash, create the worktree, git stash pop inside it.

    line 16
  6. Very specific:

    Always Read/Edit/Write through the worktree's absolute path — main-checkout paths edit main silently.

    line 23
  7. Very specific:

    After merge: git worktree remove .worktrees/<name> && git branch -d <branch>.

    line 25
  8. Distinctive:

    After resolving conflicts, audit for orphaned files, stale TODOs about merged PRs, and dead imports.

    line 41

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

Worktrees (all code changes)

Not required for doc-only repos (listed in your user-level CLAUDE.md).

  • Run git worktree list at session start, after a summary, and before creating one; reuse what exists. A .worktrees/<name>/.git pointing nowhere is a dead leftover, safe to rm -rf.
  • Create BEFORE any edit, at .worktrees/<name> (name = branch with / → -; .worktrees/ is globally ignored). Run git worktree add from the repo root after an absolute cd, never with -C.
  • If edits already landed in the main checkout: git stash, create the worktree, git stash pop inside it.
  • Start point:
    • New branch: local main (git worktree add .worktrees/fix-foo -b fix/foo main), since it may hold unpushed commits. If git log main..origin/main --oneline shows it's stale, git fetch origin main and use origin/main.
    • Existing remote branch: same local name, e.g. git worktree add .worktrees/bootstrap-foo -b bootstrap/foo origin/bootstrap/foo.
  • Always Read/Edit/Write through the worktree's absolute path — main-checkout paths edit main silently. Use git -C <abs path> across Bash calls (CWD persists between calls).
  • After merge: git worktree remove .worktrees/<name> && git branch -d <branch>. For repos outside the primary CWD this fails in the sandbox: give the user one ! <command> per repo/branch instead of a cleanup script.

Commits

  • Imperative, present tense (add X, fix Y), subject ≤72 chars; body explains WHY if non-obvious.
  • Branch names: kebab-case, scoped to the change (fix-release-tag-parsing).
  • Amending prior work: fixup! / squash! commits (autosquash = true).
  • pre-commit must pass; run pre-commit run if hooks aren't installed.
  • Formatter hooks (shfmt, black, end-of-file-fixer) fix files in place when they fail the commit: git add the reformatted files and retry.

Rebase

  • Rebase, never merge commits on feature branches (pull.rebase = true).
  • Non-interactive only: GIT_EDITOR=true git rebase ... (-i hangs, --no-edit is invalid for rebase).
  • After resolving conflicts, audit for orphaned files, stale TODOs about merged PRs, and dead imports.

Pushing

  • New branches: explicit refspec git push -u origin <name>:<name>. push.default=upstream otherwise targets the start-point branch. Verify with gh api repos/<o>/<r>/branches/<name>, not the push output.
  • "Bypassed rule violations for refs/heads/<branch>" in push output means the push landed on a protected branch without review: stop and verify immediately.

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.