Git flow

From ahmadulhoq/agentskel · View interactive version

Git flow is an AI agent skill from the GitHub repository ahmadulhoq/agentskel. Git branching, commit, and PR procedures. Use when creating branches, making commits, or opening pull requests. Enforces branch naming, commit message format, and PR rules.

How to use this skill

Skill file

Git Flow Procedure

All development follows the project's Git Workflow.

Full spec: see GIT_WORKFLOW.md in the project's standards (.agents/ or skeleton).

Branch Creation

Before writing any code, create a branch.

Direct-Commit Mode check (first): Read .memory/CONFIG.md. If Direct-Commit Mode | on, OR the user's current request is prefixed with direct:, verify the change qualifies (see refusal list in docs/AUTONOMY-MODES.md):

Otherwise (mode off, or user did not prefix direct:) — proceed with branch creation:

```

git checkout [DEFAULT_BRANCH] && git pull

```

```

git checkout -b <branch-name>

```

Commit Messages

Commit Granularity

Opening a PR

When implementation is complete.

Direct-Commit Mode check (first): If Direct-Commit Mode was active for this task (verified in Branch Creation), skip this entire section. The commit was made directly to [DEFAULT_BRANCH]; there is no feature branch to push and no PR to open. Push directly:

git push origin [DEFAULT_BRANCH]

Then jump to the end-of-turn summary. Task-completion still runs in full.

Otherwise — proceed with the PR flow:

```

git push -u origin <branch-name>

```

```

PR #42 (memory): https://github.com/.../pull/42

PR #43 (main): https://github.com/.../pull/43

```

Rules

(branch → implement → commit → PR) without pausing for additional approval.

Autonomy Modes (Direct-Commit, Autopilot)

agentskel has two modes that reduce friction during agent work, toggled in .memory/CONFIG.md:

Both modes are independent and composable. See CODE0 for the full procedure, boundary definitions, refusal cases, and how the two modes interact.

When Direct-Commit Mode is active for the current task, the agent MUST surface a banner BEFORE any commit:

DIRECT-COMMIT MODE ACTIVE — committing directly to [DEFAULT_BRANCH] (no PR).

Surfacing is non-optional — ceremony-skipping must be visible.

Post-Merge Cleanup

When the user confirms a PR has been merged (says "merged", "done", or equivalent), the agent must execute cleanup BEFORE starting any next task. This is non-optional — leaving stale local/remote branches around accumulates and breaks the next branch creation.

output — never guess).

```bash

git checkout [DEFAULT_BRANCH]

git pull origin [DEFAULT_BRANCH]

```

```bash

git branch -d <branch-name>

```

If -d fails, report it to the user — do not force-delete with -D without

explicit instruction.

```bash

git remote prune origin

```

Status to IDLE (or pull next P0 from BACKLOG.md if present).

Gate: do not begin the next task until the cleanup completes and git branch -a is clean.

Git Worktrees (for long or parallel runs)

For long feature runs or parallel branch work, use an isolated worktree instead of

working directly in the main repo. See using-git-worktrees skill for full procedure.

Quick reference:

# Create (branch must already exist)
git worktree add "../$(basename $(git rev-parse --show-toplevel))-<branch-name>" <branch-name>

# Cleanup after merge
git worktree remove "../<repo>-<branch-name>"
git branch -d <branch-name>

Gate: Do not write any application code until a branch has been created.

Do not consider a task shipped until a PR is open.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.