| name | compose-pr |
| categories | ["github"] |
| description | Composition executor for pull requests. ALWAYS invoke this skill when instructed to compose a PR. Do not read prep files or create PRs directly — use this skill first to load the composition workflow. |
| hooks | {"PreToolUse":[{"matcher":"*","hooks":[{"type":"command","command":"echo '[SKILL: compose-pr] Composing and opening PR...'","once":true}]}]} |
Compose PR
Read the PR prep file from prepare-pr, validate arch-lens diagrams, compose the PR body,
and create the GitHub PR via gh pr create.
This skill Does NOT invoke any sub-skills or slash commands. It is Part 3 of 3 in the
decomposed PR flow (prepare → run_arch_lenses → compose).
Arguments
/autoskillit:compose-pr {prep_path} {all_diagram_paths} {work_dir} {base_branch} [closing_issue]
- prep_path — Absolute path to the PR prep file from
prepare-pr
- all_diagram_paths — Quoted comma-separated absolute paths to diagram
.md files
(may be empty string if no lenses succeeded)
- work_dir — Worktree root (for deriving
feature_branch via git rev-parse)
- base_branch — PR target branch
- closing_issue (optional) — GitHub issue number for
Closes #N
Critical Constraints
NEVER:
- Invoke any sub-skills or slash commands
- Fail the pipeline when
gh is not accessible — emit pr_url = (empty) and exit successfully
- Create files outside
{{AUTOSKILLIT_TEMP}}/compose-pr/
- Invent mermaid classDef colors — when embedding validated diagrams, include them verbatim.
Using ONLY classDef styles from the mermaid skill (no invented colors).
- Run subagents in the background (
run_in_background: true is prohibited)
ALWAYS:
- Check
gh auth status before attempting GitHub operations
- Emit
pr_url token (empty string when GitHub unavailable)
- Validate diagrams with ★ or ● markers before including them
- Degrade gracefully when
all_diagram_paths is empty or all diagrams fail validation
(omit Architecture Impact section; do not include a placeholder)
- Handle
no diagrams case: when all_diagram_paths is empty or every path fails
marker check, set validated_diagrams = [] and omit the Architecture Impact section
Context Limit Behavior
When context is exhausted mid-execution, temp files may be written but the PR may
not yet be created. The recipe routes to on_context_limit (typically
release_issue_failure), bypassing the normal completion protocol.
Before emitting structured output tokens:
- Emit
pr_url = (empty) if the PR was not successfully created
- Emit whatever was completed; the orchestrator will handle the context-limit route
Workflow
Step 0: Parse Arguments and Initialize
Parse positional arguments:
- arg[1] =
prep_path
- arg[2] =
all_diagram_paths (may be empty string)
- arg[3] =
work_dir
- arg[4] =
base_branch
- arg[5] =
closing_issue (optional — overrides value in prep file if set)
Derive feature_branch and set shell variables:
FEATURE_BRANCH=$(git -C $WORK_DIR rev-parse --abbrev-ref HEAD)
BASE_BRANCH=$4
Create temp dir (relative to the current working directory):
mkdir -p {{AUTOSKILLIT_TEMP}}/compose-pr/
ts=$(date +%Y-%m-%d_%H%M%S)
Timestamp ts is assigned in the bash block above.
Step 1: Read PR Prep File
Read the file at prep_path. Extract:
task_title (from ## Title section)
- Plan summaries (from
## Plan Summary — detect single vs multi-plan by presence of group headings)
requirements_section (from ## Requirements — empty if section is blank)
conflict_resolution_table (from ## Conflict Resolution Table — empty if section is blank)
new_files (from ## Changed Files > ### New (★):)
modified_files (from ## Changed Files > ### Modified (●):)
feature_branch from ## Metadata (use the git-derived value from Step 0 if set)
closing_issue from ## Metadata (overridden by arg[5] if arg[5] is non-empty)
Step 2: Read and Validate Diagrams
Split all_diagram_paths by comma; trim whitespace from each path.
For each path:
- Read the file
- Extract mermaid block(s)
- Check for
★ or ● character in the mermaid block
- If found → add to
validated_diagrams
- If not found → discard silently
If all_diagram_paths is empty or all diagrams fail → validated_diagrams = [].
Step 3: Compose PR Body
Write PR body to {{AUTOSKILLIT_TEMP}}/compose-pr/pr_body_$ts.md (using the ts variable from Step 0).
Single plan format:
## Summary
{First paragraph of the plan's ## Summary section, or first 5 lines after the heading}
{If requirements_section is non-empty:}
## Requirements
{requirements_section}
{If conflict_resolution_table is non-empty:}
## Conflict Resolution Decisions
The following files had merge conflicts that were automatically resolved.
{conflict_resolution_table}
{## Architecture Impact — include ONLY if validated_diagrams is non-empty:}
## Architecture Impact
### {Lens Name} Diagram
```mermaid
{diagram content}
{If closing_issue is non-empty:}
Closes #{closing_issue}
Implementation Plan
Plan file: {plan_path}
🤖 Generated with Claude Code via AutoSkillit
#### Multiple plans format:
```markdown
## Summary
{Synthesized overall summary — 2-3 sentences. Spawn a sonnet subagent if needed.}
<details>
<summary>Individual Group Plans</summary>
### Group 1: {heading from plan 1}
{Summary from plan 1}
### Group 2: {heading from plan 2}
{Summary from plan 2}
</details>
{If requirements_section is non-empty:}
## Requirements
{requirements_section}
{If conflict_resolution_table is non-empty:}
## Conflict Resolution Decisions
The following files had merge conflicts that were automatically resolved.
{conflict_resolution_table}
{## Architecture Impact — include ONLY if validated_diagrams is non-empty:}
## Architecture Impact
### {Lens Name} Diagram
```mermaid
{diagram content}
{If closing_issue is non-empty:}
Closes #{closing_issue}
Implementation Plan
Plan files:
{plan_path_1}
{plan_path_2}
🤖 Generated with Claude Code via AutoSkillit
### Step 4: Check GitHub Availability
Run:
```bash
gh auth status 2>/dev/null
If exit code is non-zero:
- Log: "GitHub CLI not available or not authenticated — skipping PR creation"
- Output:
pr_url = (empty)
- Exit successfully
Step 5: Create Pull Request
gh pr create \
--base $BASE_BRANCH \
--head $FEATURE_BRANCH \
--title "$TASK_TITLE" \
--body-file {{AUTOSKILLIT_TEMP}}/compose-pr/pr_body_$ts.md
Capture PR URL from stdout.
Output
Emit these structured output tokens (literal plain text, no markdown decoration):
On success:
pr_url = https://github.com/owner/repo/pull/N
When gh is not available or not authenticated:
pr_url =