OC · Git Ops
Branch, commit, PR, sync workflows. v1.2 is PM-aware — `/oc-git-sync TICKET-1234` reads ticket; transitions on merge.
/oc-git/oc-commit/oc-pr/oc-push/oc-git-sync build
Drop the bundle into .claude/skills/ and Claude Code auto-discovers it on the next session — or point Codex / any MCP agent at the hosted opchain.dev/mcp endpoint.
How you'll use it
Git workflow: branch, commit, PR, sync. Use for /oc-git, /oc-commit, /oc-pr, /oc-push, "commit this", "push to git", "create a PR", "sync to repo", or any git operation. Trigger liberally.
Trigger with natural language or a slash command:
/oc-git/oc-commit/oc-pr/oc-push/oc-git-sync On this page
Git Ops
On first invocation, read references/orchestrator.md and follow its welcome protocol.
Move code from Claude’s workspace to a git repository with proper branch management, commit structure, and PR descriptions. This is the bridge between “Claude built it” and “it’s in version control.”
/oc-git-ops — Command Reference
When the user types /oc-git-ops, display this menu:
GIT OPS COMMANDS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WORKFLOW
/oc-git-init Clone repo + set up workspace for a project
/git-branch Create a feature branch from convention
/oc-git-commit Stage + commit with structured message
/oc-git-pr Generate PR description from commits/checkpoint
/git-push Push branch to remote
/oc-git-sync Full workflow: branch → commit → push → PR
UTILITIES
/oc-git-status Show current branch, staged changes, remote state
/git-diff Show what's changed since last commit
/oc-git-convention Show/set naming conventions for this project
/checkpoint Show checkpoint status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Type any command to begin. /oc-git-ops to see this again.
How This Skill Works
CLAUDE WORKSPACE GIT REPO
/home/claude/project/ github.com/user/project
Built files ──────► Feature branch
+ checkpoint data ──────► Structured commits
+ audit report ──────► PR description
The typical flow:
- Clone the user’s repo (or confirm it’s already cloned)
- Create a feature branch following project conventions
- Copy/move built files into the repo working tree
- Make structured commits (one per logical unit)
- Push the branch
- Generate a PR description from the checkpoint + commit log
Phase 0: Repository Setup (/oc-git-init)
First Time
# Clone the repo
git clone <repo-url> /home/claude/<project-name>
cd /home/claude/<project-name>
# Verify remote
git remote -v
# Check default branch
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
Returning (repo already cloned)
cd /home/claude/<project-name>
git fetch origin
git checkout main && git pull origin main
Authentication
Git operations require auth. Check in this order:
- SSH key —
ls ~/.ssh/id_*(preferred for push) - Git credential helper —
git config credential.helper - GitHub token — check env
GITHUB_TOKENorGH_TOKEN - Ask the user — “I need git push access. Can you provide a GitHub token or set up SSH?”
Store auth method in the checkpoint so future sessions don’t re-ask.
Branch Naming Convention
Default Convention
<type>/<short-description>
Types:
feat/ New feature
fix/ Bug fix
refactor/ Code restructure (no behavior change)
chore/ Dependencies, config, tooling
docs/ Documentation only
test/ Test additions or fixes
deploy/ Deployment-related changes
Examples:
feat/pintrack-substance-modulefix/auth-session-expirychore/update-wrangler-configdeploy/add-staging-workflow
Convention from Checkpoint
If an oc-app-architect checkpoint exists, derive the branch name from it:
- Sprint 1 build →
feat/sprint-1-auth-flow - Code audit fix →
fix/audit-f001-rate-limiting - Deploy setup →
deploy/ci-cd-pipeline
/oc-git-convention
Set or view the project’s naming conventions:
# Store in project config
cat > .git-ops-config.json << 'EOF'
{
"branch_prefix": "feat|fix|refactor|chore|docs|test|deploy",
"commit_format": "conventional",
"default_base": "main",
"pr_template": true,
"auto_lint_before_commit": true
}
EOF
Commit Structure (/oc-git-commit)
Conventional Commits
<type>(<scope>): <description>
[optional body]
[optional footer]
| Type | When |
|---|---|
feat | New feature for the user |
fix | Bug fix |
refactor | Code change that doesn’t fix a bug or add a feature |
chore | Tooling, deps, config |
docs | Documentation |
test | Adding or fixing tests |
ci | CI/CD changes |
style | Formatting (no logic change) |
Commit Granularity
One commit per logical unit of work. Rules of thumb:
| Change Size | Commit Strategy |
|---|---|
| Single file fix | 1 commit |
| New component (file + test + styles) | 1 commit |
| New feature (multiple files) | 1 commit per layer: schema → API → frontend → tests |
| Full sprint | 3-6 commits following the build order |
| Config/tooling changes | 1 commit, separate from feature work |
Auto-Commit from oc-app-architect Phase 6 Sprints
When oc-app-architect completes a Phase 6 sprint, oc-git-ops can auto-structure commits:
# Read the sprint contract for commit scoping
# Each contract deliverable becomes one commit
# Example for Sprint 1: Auth
git add src/db/migrations/ src/db/schema.ts
git commit -m "feat(db): add users and sessions tables"
git add src/auth/ src/middleware/session.ts
git commit -m "feat(auth): implement WebAuthn passkey flow"
git add src/auth/__tests__/ tests/
git commit -m "test(auth): add unit + integration tests for passkey auth"
Pre-Commit Gate (auto-invokes oc-bug-check)
Before staging files or running git commit, invoke the oc-bug-check skill.
This is the canonical pre-commit gate — oc-git-ops does NOT run its own
ad-hoc lint/type/test checks. Bug-check owns the seven-check suite
(types, lint, tests, anti-patterns, secrets, build, deps) and decides
PASS or FAIL.
Skill(skill="oc-bug-check", args="/oc-bugcheck run")
Then read .checkpoints/oc-bug-check.checkpoint.json for the verdict.
| Verdict | Action |
|---|---|
| PASS | Proceed to git add + git commit |
| FAIL | ABORT. Surface the failing checks and offer the user /oc-bugcheck fix (auto-fix lint/format) or /oc-bugcheck bypass (logged override). Do NOT call git commit until verdict flips to PASS or the user explicitly bypasses. |
| (no checkpoint) | Bug-check hasn’t run — invoke it first. |
The runtime also has a PreToolUse(Bash) hook at
.claude/hooks/pre-commit-bugcheck.sh that blocks git commit when the
oc-bug-check checkpoint is missing or stale (>10min) or has a non-PASS
verdict. The hook is the safety net; this section is the contract that
keeps the assistant from tripping it.
PR Description (/oc-git-pr)
Auto-Generated from Context
Pull from all available sources to build a comprehensive PR description:
- Commit log —
git log main..HEAD --oneline - Tri-dev checkpoint — sprint contract, evaluator scores
- Code-auditor checkpoint — findings addressed, remaining issues
- App-architect checkpoint — which roadmap tasks this covers
PR Template
## Summary
[2-3 sentences: what this PR does and why]
**Linked ticket:** [TICKET-1234](ticket-url)
## Changes
[Auto-generated from commit messages, grouped by type]
### Features
- [feat commits]
### Fixes
- [fix commits]
### Other
- [remaining commits]
## Testing
- [ ] Unit tests pass (`npm test`)
- [ ] Type check passes (`tsc --noEmit`)
- [ ] Manual testing completed
[If oc-app-architect Phase 6: "Evaluated by oc-app-architect evaluator: X.X/10 (sprint N)"]
## Audit Status
[If oc-code-auditor ran: "Pre-deploy audit: Grade [X], [N] findings ([M] addressed in this PR)"]
[If not: "No code audit run — consider `/oc-audit pre-deploy` before merging"]
## Deployment Notes
[Any migration steps, env var additions, or config changes needed]
[Auto-detected from: new migration files, .env.example changes, wrangler.toml changes]
Refs: TICKET-1234
Creating the PR
# If gh CLI is available
gh pr create --title "[type]: [description]" --body-file /tmp/pr-description.md
# If not, output the description for the user to paste
echo "PR description saved to: /mnt/user-data/outputs/pr-description.md"
echo "Create the PR manually and paste this description."
Full Sync Workflow (/oc-git-sync)
One command that runs the entire flow:
/oc-git-sync [description]
- Detect context — read checkpoints for project, skill, and current state
- Determine branch name — from checkpoint or description
- Create branch —
git checkout -b <branch> - Stage changes — intelligently stage (skip build artifacts, node_modules)
- Structure commits — group by logical unit
- Run oc-bug-check gate — invoke
Skill(skill="oc-bug-check", args="/oc-bugcheck run"). FAIL aborts the sync — surface the failing checks and stop. The user can/oc-bugcheck fix,/oc-bugcheck bypass, or address the failures and re-run/oc-git-sync. - Push —
git push -u origin <branch> - Generate PR description — from all available context
- Create PR — via gh CLI or output for manual creation
At each step, show progress. If any step needs user input, ask once and continue.
Post-Sync Handoff
After /oc-git-sync completes successfully:
- If a oc-deploy-ops config exists for this project, suggest:
“Changes pushed. Run
/oc-deploy stagingto deploy to staging?” - If no oc-deploy-ops config exists, suggest:
“Changes pushed. Run
/oc-deploy initto set up deployment, or/oc-audit pre-deployfor a quality check.”
Project Governance Awareness
If a GOVERNANCE.md file exists in the project root (generated by oc-app-architect or
the project-governance skill), read it before committing. Respect:
- Naming conventions — file naming, branch naming overrides
- Directory structure — where new files should be placed
- Version tracking — which documents are master copies vs. working drafts
- Git strategy — branching model (if different from oc-git-ops defaults)
If governance conventions conflict with oc-git-ops defaults, governance wins — it’s project-specific, oc-git-ops defaults are generic.
Checkpoint Integration
Checkpoint Location
{project-dir}/.checkpoints/oc-git-ops.checkpoint.json
When to Write
| Event | What to Save |
|---|---|
| Repo cloned/verified | Repo URL, default branch, auth method |
| Branch created | Branch name, base branch, purpose |
| Commits made | Commit SHAs, messages, file counts |
| Push completed | Remote URL, branch pushed, timestamp |
| PR created | PR URL, PR number |
| PR merged | Append { number, title, merge_method, merge_sha, merged_at } to skill_state.merged_prs. Re-stamp updated_at. |
Post-Merge Update
Restamp merged_prs at sensible inflection points — after a review wave, when a
release ships, or when a session ends — not once per merge. The single update is:
node scripts/checkpoint.mjs update oc-git-ops \
"--skill_state.merged_prs+:json={...}" \
"--step=last-merge-#${PR_NUM}" \
"--status=complete"
Do not automate this per-merge. opchain.dev once ran a
.github/workflows/checkpoint-after-merge.ymlthat opened abot/checkpoint-stamp-<PR>PR on every merge tomain. It was removed 2026-06-22: under branch protection the bot’s auto-merge could never satisfy required review, so each merge left a permanent open PR, and because every PR appended to the samemerged_prsarray they mutually conflicted. The data is reconstructable fromgit log, so a CI-gated PR per merge is pure cost. See Anti-pattern: don’t auto-stampmerged_prsper merge in the checkpoint protocol. Other skills’ checkpoints (oc-orchestrator, oc-app-architect, oc-ux-engineer, etc.) stay assistant-driven because their content is contextual.
context_primer Template
{
"key_decisions": [
"Repo: github.com/user/aidops-core",
"Auth: SSH key",
"Convention: conventional commits, feat/fix/chore prefixes",
"Last push: feat/pintrack-module → origin, 6 commits"
],
"generated_files": [
"pr-description.md"
]
}
Cross-Skill Reads
| Reads from | Why |
|---|---|
| oc-app-architect | Roadmap tasks → PR description, phase → branch naming; Phase 6 sprint contract → commit scoping, eval scores → PR description |
| oc-code-auditor | Audit grade → PR description, findings → commit grouping |
| oc-deploy-ops | Deploy status → PR deployment notes |
.gitignore Enforcement
When committing, always verify these are gitignored:
node_modules/
.env
.env.local
dist/
build/
.wrangler/
.checkpoints/ # Checkpoint protocol files
*.checkpoint.json.bak # Archived checkpoints
.git-ops-config.json # Local oc-git-ops config
If .gitignore is missing entries, add them in a separate chore: update .gitignore
commit before the feature commits.
PM-Tool MCP Integration (v1.3+)
When the user invokes any verb with a ticket id —
/oc-git-sync TICKET-1234, /oc-commit --ticket PLAT-12, or pastes a
Linear / Jira / GitHub Issues URL — oc-git-ops reads the ticket via
the configured PM-MCP and uses it for branch, commit, and PR shape.
The runtime contract — concrete tool names, retry policy, idempotency
markers, and the pm_deferred_actions[] schema — lives in
oc-integrations-engineer/references/pm-mcp-protocol.md.
All MCP calls below honour that contract; this section says only how
oc-git-ops shapes branch / commit / PR / state from the ticket.
/oc-git-sync TICKET-1234 flow
- Resolve provider from
.opchain/pm.yaml(or detect from id pattern / URL). Applytool_overridesfrompm.yamlbefore falling through to the registry in protocol §1. - Call the registry-resolved
get_issuetool (Linear:mcp__claude_ai_Linear__get_issue; GitHub:mcp__mcp-server-github__issue_read; Jira:mcp__atlassian__jira_get_issue) to fetch title, description, labels, priority, status, assignee. Apply the retry policy from protocol §2. - Branch name — slug
{type}/{id}-{title-kebab-truncated-50}, wheretypeis derived from the ticket type / labels:feat,fix,chore,docs,refactor. Defaultfeatif ambiguous. The ticket id is mandatory and must preserve the PM tool’s canonical casing in the branch name (for example,feat/TICKET-1234-runtime-pm-mcp-made-realorfix/PROJ-57-auth-session-expiry). Do not drop or rewrite the id: Linear / Jira / GitHub integrations auto-link PRs by detecting the ticket id in branch / PR metadata. - Commit message — first line:
{type}({scope}): {title}. Body: short paragraph summarising the change; trailerRefs: TICKET-1234(orCloses:if the ticket is in a “ready-to-close” state). - PR title + body — title begins with
[TICKET-1234]followed by the concise change summary. Body is generated from the ticket description, the diff summary, and the auditor / oc-bug-check report (if present). It includes a top-line**Linked ticket:** [TICKET-1234](url)and a plain-textRefs: TICKET-1234footer so Linear can auto-link even if branch detection fails. - PR open — pre-write check via the
list_commentstool (Linear) orissue_read(GitHub, comments inline) for marker<!-- opchain:oc-git-ops:pr-opened:#<pr-number> -->. If absent, call the registry-resolvedadd_commenttool (Linear:mcp__claude_ai_Linear__save_comment; GitHub:mcp__mcp-server-github__add_issue_comment) with body<!-- opchain:oc-git-ops:pr-opened:#<pr-number> -->\nPR opened: <url>. Then resolve thein_reviewstate string frompm.yaml.statesand call thetransitiontool (Linear / GitHub:save_issue/issue_writewith state field; Jira:mcp__atlassian__jira_transition_issue). - PR merge (when oc-git-ops observes the merge or is invoked with
/oc-git-sync --closed) — same pre-write check pattern with marker<!-- opchain:oc-git-ops:pr-merged:#<pr-number> -->; comment carries the merge SHA + commit subject; transition todone(resolved frompm.yaml.states).
/oc-commit enrichment
If a ticket id appears in the user’s prompt but no /oc-git-sync,
just enrich the commit body with Refs: TICKET-1234 and stop —
the comment + transition is /oc-git-sync territory. No MCP call is
made by /oc-commit alone.
Multi-ticket commits
If the staged diff spans multiple tickets (e.g. user says
“this closes PLAT-1 and PLAT-2”), use the first as the branch /
PR primary and add a Refs: line per additional ticket. Comment
on each via add_comment, each carrying its own ticket-scoped
marker <!-- opchain:oc-git-ops:pr-opened:#<pr-number>:<ticket-id> -->
so re-runs are idempotent per ticket.
/oc-git-sync --retry-pm flush
Invokes the protocol §4 flush against
oc-git-ops.checkpoint.json pm_deferred_actions[]. Filter to
skill: "oc-git-ops" and retriable: true. Surfaces
flushed N / failed M.
Failure modes
- MCP unavailable / unconfigured → fall back to slug from the user’s prompt and generic commit message; never block the commit on PM-MCP. The PR still opens.
- Ticket id format unrecognised → treat as plain text in the user prompt; do not call MCP.
add_commentretry-budget exhausted (transient) → defer per protocol §4 withretriable: true; user can/oc-git-sync --retry-pmlater. The PR is unaffected.- 403 (cross-team scope) → defer with
retriable: false; surface the permission error; never auto-flush. The PR is unaffected.
Principles
- One logical change per commit. Not one file per commit. Not one sprint per commit. The unit is “one thing a reviewer can understand in isolation.”
- Branch names tell a story.
feat/sprint-2-crud-apibeatsupdate-stuff. - PR descriptions are for future-you. Six months from now, this PR title + description should explain why this change exists without reading the code.
- Never force-push main. Feature branches can be force-pushed (rebased). Main cannot.
- Commits are cheap, reverts are cheaper. Small, atomic commits make rollbacks surgical.
- Auth setup happens once. Store the method in checkpoint, never re-ask.
Use OC · Git Ops in your project
Drop the SKILL.md into .claude/skills/ or
.codex/skills/, download the bundle, or reach
it over the hosted MCP endpoint.