From ritual
Use after a PR is opened — reviews the PR, suggests changes or merges to main, then cleans up worktree and branches
npx claudepluginhub yanekyuk/arcana --plugin ritualThis skill is limited to using the following tools:
You are reviewing and completing a PR lifecycle. This skill runs from the **main session** (project root, not a worktree) after an orchestrator has opened a PR.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
You are reviewing and completing a PR lifecycle. This skill runs from the main session (project root, not a worktree) after an orchestrator has opened a PR.
Directives: If docs/ritual-config.json exists, read directives.delivery from the config. These are soft guidelines that influence review standards and merge preferences. Apply them during PR review and merge decisions. If the field is missing or empty, proceed without directives.
Confirm you are in the main repo (not a worktree):
test -f .git && echo "WORKTREE — wrong context" || echo "MAIN REPO — correct"
If in a worktree, tell the user: "This skill must run from the project root (main session), not from inside a worktree."
List open PRs on this repo:
gh pr list --state open --limit 20
Fetch the PR details:
gh pr view <number> --json number,title,headRefName,body,commits,files,additions,deletions
gh pr diff <number>
Evaluate the following:
Check every commit message in the PR. Valid types: feat, fix, refactor, docs, test, chore, ci, perf, style, build. Each message must follow <type>: <description> or <type>(<scope>): <description>.
console.log, debugger, print( used for debugging, TODO, FIXME, HACK)If the PR touches version files (e.g., marketplace.json, plugin.json), compare the base version in the PR diff against the current version on main:
git show main:marketplace.json 2>/dev/null | head -20
If the PR's base version (the - side of the diff) does not match main's current version, the branch needs a rebase before merging. Flag this as "needs rebase" and stop — do not approve or merge.
Read docs/ritual-config.json and check if integrations.coderabbit is true.
If enabled, check CodeRabbit's review status on this PR:
gh pr reviews <number> --json author,state
Look for a review from CodeRabbit (author containing "coderabbit"). Evaluate the result:
If integrations.coderabbit is false or the config file does not exist, skip this check.
Present a structured review using the template below. You MUST fill in the Suggested Fix Prompt section with a concrete, actionable prompt. Do not leave it blank, do not use a generic placeholder, and do not simply restate the issue list. The prompt must be a ready-to-paste instruction that tells the developer exactly what to change, in which files, and how.
## PR Review: <PR title>
### Issues Found
1. <issue description>
2. <issue description>
### Suggested Fix Prompt
Copy and paste the following into your orchestrator session (in the worktree):
> <GENERATE A CONCRETE PROMPT HERE — see rules below>
Prompt generation rules (mandatory):
src/api.ts, fix the error handler on line 35 to return a 401 instead of 500 when the token is expired, and remove the console.log on line 22.").Then tell the user:
Fix the issues above, then run
/run-finishagain to re-review.
Stop here. Do not merge or clean up.
Tell the user the PR passes review, then proceed to Step 5.
Read docs/ritual-config.json and check if integrations.linear is true.
If enabled, check the PR body and branch commits for a Linear issue reference. Linear issue IDs typically appear in the PR body under "Linear Issues" or in the handoff frontmatter (linear-issue field). Record the Linear issue ID if found — it will be used in Step 5b.
If integrations.linear is false or the config file does not exist, skip this check.
After the PR passes review, apply a version bump before merging. This centralizes version bumping that was previously done by each orchestrator.
Derive the default bump type from the PR branch name prefix:
| Branch prefix | Default bump |
|---|---|
feat/ | MINOR |
fix/ | PATCH |
refactor/ | PATCH |
docs/ | none |
To get the branch name:
gh pr view <number> --json headRefName --jq '.headRefName'
Extract the prefix (everything before the first /). If the prefix does not match any row above, default to PATCH.
Check if the PR has a milestone assigned:
gh pr view <number> --json milestone --jq '.milestone.title // empty'
If a milestone is present and its title is a valid semver string (e.g., 0.10.0, 1.0.0):
If the milestone title is not a valid semver string (e.g., "Q2 Release", "Sprint 5"), treat it as informational only and fall through to the standard bump logic.
If no milestone is assigned, proceed to the standard bump logic.
Read the PR body and commit messages for an explicit version-bump: directive (e.g., version-bump: major). If found, use that instead of the branch-derived default. Note: milestone target version (Step 5b) takes precedence over explicit overrides.
If the bump type is none and no milestone target version is set, skip this step.
Otherwise, check out the PR branch locally and apply the semver bump:
git fetch origin <branch>
git checkout <branch>
1. Read versioning rules
Read the versioning array from docs/ritual-config.json. Each entry is a natural-language rule string that specifies which version manifest to bump and under what conditions.
Example rules:
"Bump package.json version for all changes""Bump frontend/package.json version for changes under frontend/""Bump api/pyproject.toml version for changes under api/"If the versioning array is empty or absent, skip the version bump entirely.
2. Evaluate which rules apply
For each versioning rule:
git diff main...HEAD) against the condition:
If no rules match the current change, skip the version bump.
3. Determine bump type
Milestone-aware path (highest priority): If a milestone target version was found in Step 5b:
Standard bump path: If no milestone target version applies, determine the bump type for each matching rule using Semantic Versioning 2.0.0 rules:
version-bump: major|minor|patch|none, use that.0.x.y:
0.x.0 -> 0.(x+1).0)Bump categories:
X.0.0) -- incompatible API changesx.Y.0) -- backward-compatible new functionalityx.y.Z) -- backward-compatible bug fixes4. Apply the bump
A single rule may reference multiple manifest files that must be bumped in sync (joined by "and", e.g. "Bump X and Y in sync"). Parse the rule for all manifest paths mentioned and collect them as a list — each must be bumped to the same new version.
For each manifest file collected from matching rules:
package.json -- "version": "X.Y.Z"plugin.json -- "version": "X.Y.Z" (same JSON key as package.json)marketplace.json -- each plugin entry contains "version": "X.Y.Z" nested under its plugin key; update the entry whose path corresponds to the plugin being changedCargo.toml -- version = "X.Y.Z" under [package]pyproject.toml -- version = "X.Y.Z" under [project] or [tool.poetry]setup.cfg -- version = X.Y.Z under [metadata]build.gradle / build.gradle.kts -- version = "X.Y.Z"version.txt -- entire file content is the version string5. Commit
git add <all-bumped-manifest-files>
git commit -m "chore: bump version to <new-version>"
If multiple manifests were bumped, list all in the commit message:
git add <manifest-1> <manifest-2>
git commit -m "chore: bump versions — <manifest-1> to <v1>, <manifest-2> to <v2>"
Then push the bump commit to the PR branch:
git push origin <branch>
After pushing, switch back to the main branch:
git checkout main
If no version manifest is found or no versioning rules match, skip the bump silently and proceed to merge.
Ask the user for merge strategy preference (merge commit or squash). If the user has already expressed a preference, use it. Default to merge commit if not specified.
gh pr merge <number> --merge
Or with squash:
gh pr merge <number> --squash
Do not pass --delete-branch — the worktree still holds the branch at this point, so gh would exit with code 1. Remote and local branch cleanup is handled in Step 7.
If integrations.linear is true and a Linear issue ID was found in Step 4b, update the Linear issue after successful merge. All Linear MCP calls must be wrapped in error handling — log a warning on failure but never block the finish pipeline.
mcp__linear__updateIssue.mcp__linear__createComment. Example comment: "Merged in PR # — "Graceful degradation: if either MCP call fails, log "Warning: Linear MCP unavailable — skipping Linear issue completion." and continue to Step 7.
If integrations.linear is false or no Linear issue was found, skip this step.
After merge completes:
git pull origin main
Determine the worktree path from the branch name. The convention is .worktrees/<type>-<short-description> where the branch is <type>/<short-description>.
git worktree list
Find the worktree matching the merged branch and remove it:
git worktree remove .worktrees/<folder>
git push origin --delete <branch-name>
If the remote branch was already deleted, this may warn — that is fine.
git branch -d <branch-name>
If the branch was already deleted by the merge, this may warn — that is fine.
Tell the user:
PR # merged and cleaned up. Branch
<branch>deleted. Worktree.worktrees/<folder>removed. Lifecycle complete.