Skip to content

tmoody1973/claude-code-workflow

Repository files navigation

Claude Code Workflow

Three slash commands and a skill that give Claude Code a professional PR workflow — branch protection, AI code review, and automated pull requests. Works for solo builders, vibe coders, and AI-assisted dev teams.


The problem

You're building fast with Claude Code. Features are shipping, ideas are moving. But your GitHub is a graveyard of direct pushes to main, no PR history, no code review, and no record of what you built or why.

When something breaks — or when someone looks at your repo — there's no story.

This fixes that. In one setup command.


What's included

Command What it does
/project-init Scaffolds all config files for a new or existing project in one shot
/pr Creates a branch, commits your work, generates a PR description from your actual diff, and opens the PR
/protect Sets GitHub branch protection rules entirely from the terminal — no browser needed
pr-workflow skill Gives Claude context about your PR process across all conversations

All three commands are global — install once, use in every project.


Quickstart

# 1. Install GitHub CLI (required)
brew install gh
gh auth login

# 2. Install the commands globally
mkdir -p ~/.claude/commands
cp commands/pr.md ~/.claude/commands/pr.md
cp commands/project-init.md ~/.claude/commands/project-init.md
cp commands/protect.md ~/.claude/commands/protect.md

# 3. Install the skill
mkdir -p ~/.claude/skills/pr-workflow
cp skills/pr-workflow/SKILL.md ~/.claude/skills/pr-workflow/SKILL.md

Then go to coderabbit.ai → sign in with GitHub → connect your repos. That's the only browser step.


Using the commands

Setting up a project

Existing project:

# Inside a Claude Code session
/project-init existing

Brand new project:

/project-init new

Audit what's missing:

/project-init check

/project-init creates:

  • CLAUDE.md — Claude Code reads this automatically every session (your project context, stack, commands)
  • .coderabbit.yaml — AI code review config tailored to your project type
  • .pr-template.md — reusable PR description template
  • .env.example — documents all env vars by scanning your codebase
  • .gitignore — updated to never commit .env or Claude local settings
  • Branch protection — applied automatically via gh api, no browser needed

Opening a pull request

/pr

Claude Code will:

  1. Read your git status
  2. Create a properly named branch (feat/, fix/, chore/, etc.)
  3. Stage and commit your work
  4. Generate a PR description from your actual code diff
  5. Open the PR via gh pr create
  6. Print a checklist for CodeRabbit review

Other modes:

/pr branch    → just create and push a feature branch
/pr open      → open a PR for the current branch
/pr status    → check branch and open PRs
/pr cleanup   → delete merged branches

When to use /pr

Use it whenever you finish building something and want to get it into GitHub properly.

Use /pr when:

  • You finished a feature, bug fix, or any meaningful chunk of work
  • You've been building with Claude Code and want to review what it produced before merging
  • You're about to demo something or share your repo publicly
  • Anything touching auth, payments, or real user data — always

Skip /pr and push direct when:

  • Fixing a typo in a README
  • Updating a comment or a config value
  • A one-line change you're 100% certain about

If you're unsure — use /pr. It takes 30 seconds and gives you CodeRabbit's eyes on the code before it hits main.


Protecting your main branch

/protect                → standard (PR required, admin can override)
/protect --strict       → locked down (no bypass, good for production apps)
/protect --check        → audit current rules without changing anything
/protect --remove       → remove protection (confirms first)

The workflow loop

Claude Code builds the feature
        ↓
/pr  —  branch, commit, open PR
        ↓
CodeRabbit reviews the AI-generated code
        ↓
Fix issues, squash merge, ship

Why this matters for AI-assisted development: Claude Code is fast but not perfect. CodeRabbit catches what Claude misses — null checks, security issues, incorrect API usage, missing error handling. Running AI output through an AI reviewer before it hits main is the move.


CodeRabbit quick reference

Reply to any CodeRabbit comment in a PR:

@coderabbitai ignore          → dismiss a false positive
@coderabbitai explain         → get more detail on a suggestion
@coderabbitai generate tests  → generate unit tests for flagged code
@coderabbitai review          → re-run full review
@coderabbitai summary         → regenerate the PR summary

Branch naming

/pr uses these conventions automatically:

Type Prefix Example
New feature feat/ feat/stripe-webhooks
Bug fix fix/ fix/auth-redirect
Config/deps chore/ chore/update-env
Experiment spike/ spike/gemini-vs-claude
Urgent fix hotfix/ hotfix/cors-header

File map

~/.claude/
├── commands/
│   ├── pr.md               ← /pr command
│   ├── project-init.md     ← /project-init command
│   └── protect.md          ← /protect command
└── skills/
    └── pr-workflow/
        └── SKILL.md        ← PR + CodeRabbit skill

Per-project files (created by /project-init):

your-project/
├── CLAUDE.md
├── .coderabbit.yaml
├── .pr-template.md
├── .env.example
└── .gitignore

Requirements


Templates

Ready-to-use config files are in the /templates folder:

  • templates/.coderabbit.yaml — copy into any project manually
  • templates/.pr-template.md — copy into any project manually

Documentation

Full guide with step-by-step instructions for every command: docs/claude-code-workflow-guide.md


Contributing

Got a Claude Code command that improved your workflow? PRs welcome.

The most useful contributions:

  • New slash commands (issues, deploys, changelogs, release notes)
  • Stack-specific CLAUDE.md templates (Next.js, Python, CLI tools, mobile)
  • CodeRabbit config presets for different project types

See CONTRIBUTING.md for guidelines.


License

MIT — use it, fork it, build on it.


Built by Tarik Moody — Director of Strategy & Innovation, Radio Milwaukee. Building in public with Claude Code.

About

Three slash commands and a skill that give Claude Code a professional PR workflow — branch protection, AI code review, and automated pull requests.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors