بنقرة واحدة
pm-pr-workflow
Branch protection and PR creation workflow
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Branch protection and PR creation workflow
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
MCP (Model Context Protocol) - Build AI-native servers with tools, resources, and prompts. TypeScript/Python SDKs for Claude Desktop integration.
Model Context Protocol (MCP) server build and evaluation guide, including local conventions for tool surfaces, config, and testing
Control monitoring server and dashboard
Pause session and save current work state for later resume
Load context from paused session
Access Claude MPM functionality and manage multi-agent orchestration
| name | pm-pr-workflow |
| version | 1.0.0 |
| description | Branch protection and PR creation workflow |
| when_to_use | PR creation, branch operations, git push to main |
| category | pm-workflow |
| tags | ["git","pr","branch-protection","pm-required"] |
CRITICAL: PM must enforce branch protection for main branch.
git config user.email
bobmatnyc@users.noreply.github.com → Can push directly to main (if explicitly requested)When non-privileged users request main branch operations:
| User Request | PM Action |
|---|---|
| "commit to main" | "Creating feature branch workflow instead" |
| "push to main" | "Branch protection requires PR workflow" |
| "merge to main" | "Creating PR for review" |
Error Prevention: PM proactively guides non-privileged users to correct workflow (don't wait for git errors).
Check workflow.worktree.enabled (default: true) before starting any issue branch.
Replace the plain branch checkout with a git worktree:
# Create the worktree and branch in one step
git worktree add .claude/worktrees/issue-N-<slug> -b feat/N-<slug>
# All engineering work happens inside the worktree
cd .claude/worktrees/issue-N-<slug>
The source directory (repo/) stays on main throughout; only the worktree
directory advances on the feature branch.
Post-merge cleanup (after squash-merge lands on main):
# Remove the worktree
git worktree remove .claude/worktrees/issue-N-<slug>
git branch -d feat/N-<slug> # delete the local tracking branch
# Pull latest main in the source dir
git pull
git -C .claude/worktrees/issue-N-<slug> status first.git worktree remove; or use --force only if you are certain the files are disposable.Set workflow.worktree.enabled: false in .claude-mpm/config.yaml to fall back
to the standard branch checkout approach below:
git checkout -b feat/N-<slug>
Default: Main-based PRs (unless user explicitly requests stacked)
Always delegate to version-control agent with strategy parameters.
Always append the canonical MPM footer to PR bodies and commit messages:
🤖👥 Generated with [Claude MPM](https://github.com/bobmatnyc/claude-mpm)
Never use Claude Code's default 🤖 Generated with [Claude Code] footer. MPM
only overrides the commit trailer (Co-Authored-By), so the "Generated with"
footer must be set explicitly to the canonical MPM string — otherwise the Claude
Code default leaks into GitHub PRs and issues. The Co-Authored-By: Claude MPM <https://github.com/bobmatnyc/claude-mpm> trailer is separate and stays as-is.
When creating PRs, delegate to version-control agent with:
Task:
agent: "version-control"
task: "Create PR for {feature}"
context: |
Work completed: {summary}
Files changed: {file_list}
Tests: {test_status}
QA verification: {qa_evidence}
acceptance_criteria:
- Create feature branch from main
- Push all commits to feature branch
- Create PR with proper description
- Link ticket if applicable
- Request reviews if needed
After the PR is created and CI passes, the PM checks whether trusty-review is available before proceeding to squash-merge.
Call mcp__trusty-review__review_health. Treat trusty-review as available if and only if:
status == "ok" ANDreviewer_model is set (non-empty string)If the health call throws an exception, returns a non-ok status, or returns an empty reviewer_model, skip the review step entirely — never block or warn the user about trusty-review being unavailable.
Note: Once the upstream health endpoint exposes an
inferencefield, also requireinference == "ok"as part of the availability check.
The PM calls mcp__trusty-review__review_pr(owner, repo, pr_number) directly (PM has MCP tool access). Route the verdict as follows:
| Verdict | Action |
|---|---|
APPROVE or APPROVE* | Proceed to squash-merge |
REQUEST_CHANGES | Delegate findings to Engineer for remediation; re-run CI before merge |
BLOCK | Do not merge; escalate immediately to the user |
UNKNOWN or tool error | Fail open — proceed to squash-merge with a note that review was inconclusive |
Skip silently. Do not surface any message to the user about trusty-review being down. The PR workflow continues to squash-merge as normal.
# Feature branch → PR → Main
feature/user-auth → PR #123 → main
# Stacked feature development
feature/auth-base → PR #123 → main
feature/oauth (based on auth-base) → PR #124 → feature/auth-base
feature/session (based on oauth) → PR #125 → feature/oauth
# Hotfix branch → PR → Main
fix/login-error → PR #126 → main
Before any main branch operation:
All file tracking should happen on feature branches before PR creation:
This ensures all work is tracked before entering PR workflow.