Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions src/content/docs/skills/agent-git-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: Agent Git Workflow
description: A practical Git + PR workflow for OpenClaw agents working with clean history, fast reviews, and safe merges.
---

A practical [OpenClaw](https://openclaw.ai) skill for shipping code through GitHub pull requests with consistent branch naming, clean commits, and reliable review loops.

## Branch ownership naming

Use branch names that make ownership and intent obvious:

- Pattern: `<owner>/<scope>-<change>`
- Example: `obrera/skills-agent-git-workflow`

This helps reviewers immediately see who owns the branch and what the change is about.

> **Note on `obrera`:** `obrera` is an example GitHub handle prefix. Replace it with your own.

## One PR / one commit discipline

Default to one focused commit per pull request:

1. Keep scope tight (single feature/fix/docs unit)
2. Make one clean commit with a clear message
3. Open one PR for that commit

Why this works:

- Faster review and lower cognitive load
- Easier revert if needed
- Cleaner project history

## PR hygiene + self-review

Before requesting review:

1. **Rebase your branch onto `main`** and resolve conflicts locally
2. **Self-review** the full diff in GitHub (files changed + rendered docs/screenshots)
3. **Check PR metadata**:
- clear title
- concise description (what changed, why, risk)
- test/build notes
4. **Remove noise** (debug logs, unrelated formatting, accidental file changes)

## Review loop

Treat review as a tight operational loop:

1. Fetch review comments via API/CLI (review + inline threads)
2. Apply requested fixes in the same branch as **new commits** (consider `git commit --fixup` for easier squashing later; these can be squashed on merge; no amend/force-push required)
Comment thread
beeman marked this conversation as resolved.
3. Reply to each comment with what changed
4. Resolve completed threads
5. Request re-review

Repeat until all blocking feedback is cleared.

## CI gates, merge strategy, and cleanup

### CI gates

Merge only when required checks are green and branch protection rules are satisfied.

### Merge strategy

Prefer **squash merge** for this workflow to preserve one-PR/one-commit history in `main`.

### Post-merge cleanup

After merge:

1. Delete remote branch
2. Delete local branch
3. Pull latest `main`
4. Confirm follow-up tasks (if any) are tracked separately

## Source

Built by [colmena](https://github.com/colmena) for [OpenClaw](https://openclaw.ai) agents.
1 change: 1 addition & 0 deletions src/content/docs/skills/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ description: OpenClaw agent skills we've built and use daily.

## Available

- **[agent-git-workflow](/skills/agent-git-workflow/)** — Run clean, reviewable GitHub PR workflows with disciplined commits, review loops, and safe merges.
- **[deploy](/skills/deploy/)** — Detect, generate, and deploy projects to Dokploy — fully automated.
- **[gh-repo-setup](/skills/gh-repo-setup/)** — Standardize GitHub repository settings with branch protection, metadata, and best-practice defaults.
- **[static-deploy](/skills/static-deploy/)** — Deploy static sites to Dokploy with CI, domains, and auto-deploy webhooks.