[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M751TCW8P79WY4B4CCRAY0R7":3,"skill-same:01M751TCW8P79WY4B4CCRAY0R7":61},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":6,"ownerHtmlUrl":34,"ownerBlogUrl":35,"ownerDescription":36,"updatedAt":37,"install":38,"resources":50},"01M751TCW8P79WY4B4CCRAY0R7","x-create-pr",null,"Task-level PR creation with formatted title, automatic labels, structured body, and target branch logic. Creates standardized PRs for individual tasks with Task ID traceability.","review-bench\u002Federcnj_ia-dev-environment","review-bench","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F286778065?v=4","01M7517F9NTEPDZDAXJBR30FWT","ReviewBench","01M7517FAC9F4P7TGWCNJ8VYVW",0,"MIT","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Fmain\u002Fresources\u002Ftargets\u002Fclaude\u002Fskills\u002Fcore\u002Fpr\u002Fx-create-pr\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: x-create-pr\ndescription: \"Task-level PR creation with formatted title, automatic labels, structured body, and target branch logic. Creates standardized PRs for individual tasks with Task ID traceability.\"\nuser-invocable: true\nallowed-tools: Bash, Read, Grep, Glob, Skill\nargument-hint: \"TASK-XXXX-YYYY-NNN [--auto-approve-pr] [--draft] [--description \\\"short desc\\\"] [--target-branch \u003Cbranch>] [--auto-merge \u003Cmerge|squash|rebase|none>] [--epic-id \u003CXXXX>]\"\ncontext-budget: medium\nrequires-capabilities: []\n---\n\n## Global Output Policy\n\n- **Language**: English ONLY.\n- **Tone**: Technical, Direct, and Concise.\n- **Efficiency**: Remove all conversational fillers and greetings to save tokens.\n\n# Skill: Task PR Creation\n\n## Purpose\n\nCreates standardized Pull Requests for individual tasks in {{PROJECT_NAME}} with Task ID in the title, automatic labels (`task`, `story-XXXX-YYYY`, `epic-XXXX`), structured body with review checklist, and correct target branch. Ensures every task delivery is traceable and independently reviewable.\n\n## Triggers\n\n- `\u002Fx-create-pr TASK-0029-0001-001` -- create PR for the specified task\n- `\u002Fx-create-pr TASK-0029-0001-001 --draft` -- create as draft PR\n- `\u002Fx-create-pr TASK-0029-0001-001 --auto-approve-pr` -- target parent story branch instead of develop\n- `\u002Fx-create-pr TASK-0029-0001-001 --description \"add user validation\"` -- override PR title description\n- `\u002Fx-create-pr TASK-0029-0001-001 --target-branch epic\u002F0049 --auto-merge merge --epic-id 0049` -- orchestrator-propagated PR targeting an epic branch with auto-merge enabled and epic label applied\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `task-id` | String | Yes | Task ID in format `TASK-XXXX-YYYY-NNN` |\n| `--auto-approve-pr` | Flag | No | Target parent story branch instead of `develop` |\n| `--draft` | Flag | No | Create PR as draft |\n| `--description` | String | No | Short description for PR title (overrides branch-derived description) |\n| `--target-branch` | String | No | Explicit base branch for the PR (overrides `--auto-approve-pr` and default `develop`). Typical orchestrator value: `epic\u002FXXXX` |\n| `--auto-merge` | Enum | No | Post-create auto-merge strategy. One of `merge`, `squash`, `rebase`, `none` (default `none`). Requires `--target-branch` |\n| `--epic-id` | String(4) | No | Four-digit epic identifier (regex `^\\d{4}$`). When set, adds label `epic-XXXX` and epic metadata to the PR body |\n| `--no-story-evidence` | Flag | No | Omit `## Orchestrator Evidence` section. Use ONLY for chore\u002Fdocs PRs without story context. Allowed by `audit-pr-evidence.sh`. |\n\n## Workflow\n\n```\nPhase 0   VALIDATE        -> Parse task ID, validate branch naming, parse extension flags\nPhase 1   PRE-CHECK       -> Run {{TEST_COMMAND}} to verify tests pass\nPhase 2   TITLE           -> Format PR title (\u003C=70 chars, Conventional Commits)\nPhase 3   BODY            -> Generate structured PR body\nPhase 3.5 EVIDENCE        -> Inject ## Orchestrator Evidence (unless --no-story-evidence)\nPhase 4   LABELS          -> Create labels if missing, collect label list\nPhase 5   CREATE          -> Create PR via gh pr create\nPhase 6   AUTO-MERGE      -> If --auto-merge != none, delegate to x-merge-pr\n```\n\n### Phase 0 -- Validate Branch and Arguments\n\n1. Parse task ID from arguments: extract `TASK-XXXX-YYYY-NNN` format\n2. Validate task ID matches pattern: `TASK-\\d{4}-\\d{4}-\\d{3}`\n3. Verify current branch follows naming convention:\n\n```bash\nCURRENT_BRANCH=$(git branch --show-current)\n# Must match: feat\u002Ftask-XXXX-YYYY-NNN-*\nPATTERN=\"^feat\u002Ftask-[0-9]{4}-[0-9]{4}-[0-9]{3}-\"\nif [[ ! \"$CURRENT_BRANCH\" =~ $PATTERN ]]; then\n  echo \"ABORT: Current branch does not match task naming convention: feat\u002Ftask-XXXX-YYYY-NNN-*\"\n  echo \"Current branch: $CURRENT_BRANCH\"\n  exit 1\nfi\n```\n\n4. Extract epic ID (`XXXX`), story ID (`XXXX-YYYY`), and task number (`NNN`) from the task ID\n5. If `--auto-approve-pr` is set, verify parent branch exists:\n\n```bash\nSTORY_ID=\"story-XXXX-YYYY\"\nPARENT_BRANCH=$(git branch -a | grep \"feat\u002F${STORY_ID}\" | head -1 | tr -d ' ')\nif [[ -z \"$PARENT_BRANCH\" ]]; then\n  echo \"ABORT: Parent branch not found for ${STORY_ID}\"\n  exit 1\nfi\n```\n\n6. Parse extension flags (`--target-branch`, `--auto-merge`, `--epic-id`) and run the validation matrix:\n\n```bash\n# Defaults (backward compatible: absent flags produce legacy behavior)\nTARGET_BRANCH_OVERRIDE=\"\"     # empty -> legacy target (parent or develop)\nAUTO_MERGE_STRATEGY=\"none\"    # none | merge | squash | rebase\nEPIC_ID_OVERRIDE=\"\"            # empty -> no epic-XXXX label injection\n\n# Validate --epic-id regex (4 digits) -- exit 5 \u002F INVALID_EPIC_ID\nif [[ -n \"$EPIC_ID_OVERRIDE\" && ! \"$EPIC_ID_OVERRIDE\" =~ ^[0-9]{4}$ ]]; then\n  echo \"ABORT [INVALID_EPIC_ID]: Epic ID must be 4 digits\"\n  exit 5\nfi\n\n# Validate --auto-merge value set\ncase \"$AUTO_MERGE_STRATEGY\" in\n  none|merge|squash|rebase) ;;\n  *) echo \"ABORT: --auto-merge must be one of merge|squash|rebase|none\"; exit 1 ;;\nesac\n\n# Mutex: --auto-merge requires --target-branch -- exit 6 \u002F AUTO_MERGE_REQUIRES_TARGET\nif [[ \"$AUTO_MERGE_STRATEGY\" != \"none\" && -z \"$TARGET_BRANCH_OVERRIDE\" ]]; then\n  echo \"ABORT [AUTO_MERGE_REQUIRES_TARGET]: --auto-merge requires --target-branch\"\n  exit 6\nfi\n\n# Soft warning: auto-merge directly to develop is unusual\nif [[ \"$TARGET_BRANCH_OVERRIDE\" == \"develop\" && \"$AUTO_MERGE_STRATEGY\" != \"none\" ]]; then\n  echo \"WARN: Auto-merge directly to develop is unusual; consider using an epic branch\"\nfi\n```\n\n### Phase 1 -- Pre-Check (Tests)\n\nRun the project test command before creating the PR:\n\n```bash\n{{TEST_COMMAND}}\nif [[ $? -ne 0 ]]; then\n  echo \"ABORT: Tests failed. Fix tests before creating PR.\"\n  exit 1\nfi\n```\n\nIf tests fail, abort with message: `\"Tests failed. Fix tests before creating PR.\"`\n\n### Phase 2 -- Format PR Title\n\nFormat the PR title following Conventional Commits:\n\n1. Determine the commit type from the task type or default to `feat`\n2. Build title: `\u003Ctype>(TASK-XXXX-YYYY-NNN): \u003Cdescription>`\n3. If `--description` is provided, use it; otherwise derive from branch name:\n\n```bash\n# Extract description from branch name\n# feat\u002Ftask-0029-0001-001-add-validation -> add validation\nDESC=$(echo \"$CURRENT_BRANCH\" | sed 's\u002Ffeat\\\u002Ftask-[0-9]*-[0-9]*-[0-9]*-\u002F\u002F' | tr '-' ' ')\n```\n\n4. Truncate title to 70 characters maximum:\n\n```bash\nTITLE=\"feat(TASK-XXXX-YYYY-NNN): ${DESC}\"\nif [[ ${#TITLE} -gt 70 ]]; then\n  TITLE=\"${TITLE:0:67}...\"\nfi\n```\n\n### Phase 3 -- Generate PR Body (via render skill)\n\n**MANDATORY TOOL CALL — Rule 24 §Camada-1 \u002F Rule 13 Pattern 1 (INLINE-SKILL):**\n\nDelegate body generation to `x-internal-render-pr-body` (story-0066-0003). The render skill produces a body Markdown that includes the `\u003C!-- template-version: 1.0 -->` marker required by `audit-pr-template.sh` (story-0066-0007).\n\n```bash\n# Derive story-id from task-id: TASK-XXXX-YYYY-NNN -> story-XXXX-YYYY\nSTORY_ID_FOR_RENDER=\"story-${TASK_EPIC_ID}-${TASK_STORY_NUM}\"\n\n# Create temp file for render output (Rule 06 §Temp files — chmod 600 implicit via mktemp)\nTMP_BODY_PATH=$(mktemp -t pr-body-XXXXXX.md)\nchmod 600 \"$TMP_BODY_PATH\"\ntrap 'rm -f \"$TMP_BODY_PATH\"' EXIT\n\necho \"INFO: Invoking x-internal-render-pr-body --kind=implementation --story-id=$STORY_ID_FOR_RENDER\"\n```\n\nInvoke the `x-internal-render-pr-body` skill via the Skill tool:\n\n    Skill(skill: \"x-internal-render-pr-body\", model: \"haiku\", args: \"--kind=implementation --story-id=$STORY_ID_FOR_RENDER --out=$TMP_BODY_PATH\")\n\n```bash\nRENDER_EXIT=$?\n\nif [[ $RENDER_EXIT -eq 0 ]]; then\n  # Happy path: render skill produced body with template-version marker\n  BODY=$(cat \"$TMP_BODY_PATH\")\nelse\n  # Fallback path — see ## Recovery section\n  echo \"WARN [render-fallback]: PR body gerado via fallback inline (sem template-version marker).\" >&2\n  echo \"     audit-pr-template.sh reportará PR_TEMPLATE_VIOLATION para este PR.\" >&2\n  echo \"     Investigar: x-internal-render-pr-body exit code = $RENDER_EXIT.\" >&2\n\n  # Generate legacy inline body (see ## Recovery for full template)\n  BODY=\"\u003Cinline body — see ## Recovery section>\"\nfi\n```\n\nIf `--draft` is set, prepend to the body:\n\n```markdown\n> [DRAFT] This PR is not ready for review\n```\n\n#### Phase 3.5 -- Inject Orchestrator Evidence (EPIC-0059, story-0059-0007 + EPIC-0066, story-0066-0005 dedup)\n\nUnless `--no-story-evidence` is set, ensure the body contains exactly one `## Orchestrator Evidence` section. The render skill (Phase 3 happy path) already includes the section via `_TEMPLATE-PR-IMPLEMENTATION.md`; the fallback inline body (Phase 3 ## Recovery path) does NOT — it must be injected manually here.\n\n**Deduplication rule (story-0066-0005):**\n\n```bash\n# Skip if explicitly opted out (chore\u002Fdocs PRs without a story context)\nif [[ \"${NO_STORY_EVIDENCE:-false}\" != \"true\" ]]; then\n  # Dedup: if render skill already produced ## Orchestrator Evidence, skip injection\n  if echo \"$BODY\" | grep -q \"^## Orchestrator Evidence\"; then\n    echo \"INFO: ## Orchestrator Evidence already present in rendered template — skipping injection\"\n  else\n  # Extract story ID from task ID: TASK-0059-0007-001 -> story-0059-0007\n  STORY_ID_FOR_EVIDENCE=\"story-${TASK_EPIC_ID}-${TASK_STORY_NUM}\"\n\n  # Orchestrator commit SHA: last commit matching x-implement-story in log\n  ORCH_SHA=$(git log --grep=\"x-implement-story\" -1 --format=\"%H\" 2>\u002Fdev\u002Fnull)\n  if [[ -z \"$ORCH_SHA\" ]]; then\n    # Fallback: use current HEAD SHA\n    ORCH_SHA=$(git rev-parse HEAD)\n  fi\n\n  # Phase 1 artifacts (6 planning artifacts that exist on disk)\n  EPIC_PLANS_DIR=\"ai\u002Fepics\u002Fepic-${TASK_EPIC_ID}\u002Fplans\"\n  P1_ARTIFACTS=\"\"\n  for artifact in \\\n    \"arch-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"plan-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"tests-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"tasks-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"security-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"compliance-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\"; do\n    full_path=\"${EPIC_PLANS_DIR}\u002F${artifact}\"\n    if [[ -f \"$full_path\" ]]; then\n      P1_ARTIFACTS=\"${P1_ARTIFACTS:+${P1_ARTIFACTS}, }${full_path}\"\n    fi\n  done\n  [[ -z \"$P1_ARTIFACTS\" ]] && P1_ARTIFACTS=\"(none found)\"\n\n  # Phase 3 artifacts (4 verification\u002Freview artifacts that exist on disk)\n  EPIC_REPORTS_DIR=\"ai\u002Fepics\u002Fepic-${TASK_EPIC_ID}\u002Freports\"\n  P3_ARTIFACTS=\"\"\n  for artifact in \\\n    \"verify-envelope-${TASK_EPIC_ID}-${TASK_STORY_NUM}.json\" \\\n    \"story-completion-report-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\"; do\n    full_path=\"${EPIC_REPORTS_DIR}\u002F${artifact}\"\n    if [[ -f \"$full_path\" ]]; then\n      P3_ARTIFACTS=\"${P3_ARTIFACTS:+${P3_ARTIFACTS}, }${full_path}\"\n    fi\n  done\n  for artifact in \\\n    \"review-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"techlead-review-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\"; do\n    full_path=\"${EPIC_PLANS_DIR}\u002F${artifact}\"\n    if [[ -f \"$full_path\" ]]; then\n      P3_ARTIFACTS=\"${P3_ARTIFACTS:+${P3_ARTIFACTS}, }${full_path}\"\n    fi\n  done\n  [[ -z \"$P3_ARTIFACTS\" ]] && P3_ARTIFACTS=\"(none found)\"\n\n  ORCHESTRATOR_EVIDENCE_SECTION=\"\n## Orchestrator Evidence\n\n\u003C!-- Filled automatically by x-create-pr. Do not edit manually. -->\n\n| Campo | Valor |\n| :--- | :--- |\n| Story IDs | ${STORY_ID_FOR_EVIDENCE} |\n| Orchestrator Commit SHA | ${ORCH_SHA} |\n| Invocation Skill | x-implement-story |\n| Phase 1 Artifacts | ${P1_ARTIFACTS} |\n| Phase 3 Artifacts | ${P3_ARTIFACTS} |\n\"\n\n    BODY=\"${BODY}${ORCHESTRATOR_EVIDENCE_SECTION}\"\n  fi\nfi\n```\n\n**Invariant (story-0066-0005):** the final PR body always contains exactly one `## Orchestrator Evidence` occurrence, regardless of whether it came from the render skill (template) or the fallback inline body.\n\n**`--no-story-evidence` flag:** when set, the `## Orchestrator Evidence` section is omitted and `audit-pr-evidence.sh` will accept the PR. Use ONLY for chore\u002Fdocs PRs that genuinely have no story context (e.g., CHANGELOG-only commits, dependency bumps). When set, `audit-pr-evidence.sh` logs `\"no evidence required (--no-story-evidence)\"` and exits 0.\n\n### Phase 4 -- Label Auto-Creation\n\nEnsure labels exist in the repository, creating them if missing:\n\n```bash\n# Label definitions (base set derived from task ID)\nLABELS=(\n  \"task|#0075ca|Individual task PR\"\n  \"story-XXXX-YYYY|#e4e669|Parent story reference\"\n  \"epic-XXXX|#d73a4a|Parent epic reference\"\n)\n\n# Orchestrator-supplied --epic-id adds\u002Foverrides an explicit epic-XXXX label\nif [[ -n \"$EPIC_ID_OVERRIDE\" ]]; then\n  LABELS+=(\"epic-${EPIC_ID_OVERRIDE}|#d73a4a|Parent epic reference (orchestrator override)\")\nfi\n\nfor LABEL_DEF in \"${LABELS[@]}\"; do\n  IFS='|' read -r NAME COLOR DESC \u003C\u003C\u003C \"$LABEL_DEF\"\n  # Check if label exists; create if not\n  gh label list --search \"$NAME\" --json name -q '.[].name' | grep -qx \"$NAME\" || \\\n    gh label create \"$NAME\" --color \"${COLOR#\\#}\" --description \"$DESC\"\ndone\n```\n\n### Phase 5 -- Create PR\n\nDetermine target branch and create the PR:\n\n```bash\n# Target branch logic (precedence: --target-branch > --auto-approve-pr > develop)\nif [[ -n \"$TARGET_BRANCH_OVERRIDE\" ]]; then\n  TARGET_BRANCH=\"$TARGET_BRANCH_OVERRIDE\"\nelif [[ \"$AUTO_APPROVE\" == \"true\" ]]; then\n  TARGET_BRANCH=\"$PARENT_BRANCH\"\nelse\n  TARGET_BRANCH=\"develop\"\nfi\n\n# Push branch if needed\ngit push -u origin \"$CURRENT_BRANCH\"\n\n# Build gh pr create command\nDRAFT_FLAG=\"\"\nif [[ \"$DRAFT\" == \"true\" ]]; then\n  DRAFT_FLAG=\"--draft\"\nfi\n\n# Assemble label list (epic-ID override appended when present)\nLABEL_LIST=\"task,story-XXXX-YYYY,epic-XXXX\"\nif [[ -n \"$EPIC_ID_OVERRIDE\" ]]; then\n  LABEL_LIST=\"${LABEL_LIST},epic-${EPIC_ID_OVERRIDE}\"\nfi\n\ngh pr create \\\n  --base \"$TARGET_BRANCH\" \\\n  --title \"$TITLE\" \\\n  --body \"$BODY\" \\\n  --label \"$LABEL_LIST\" \\\n  $DRAFT_FLAG\n```\n\nAfter creation, report the result (extended response includes `targetBranch` and `autoMergeEnabled`):\n\n```\nPR #42 created: https:\u002F\u002Fgithub.com\u002Fowner\u002Frepo\u002Fpull\u002F42\n  Title:        feat(TASK-0029-0001-001): add validation\n  Target:       develop\n  Labels:       task, story-0029-0001, epic-0029\n  Draft:        false\n  AutoMerge:    false\n```\n\n### Phase 6 -- Post-Create Auto-Merge (Optional)\n\nWhen `--auto-merge` is set to a strategy other than `none`, delegate to `x-merge-pr` so the PR is queued for automatic merge once checks pass. Uses Pattern 1 (INLINE-SKILL) per Rule 13.\n\n```\nSkill(skill: \"x-merge-pr\", args: \"--pr \u003CPR_NUMBER> --strategy \u003CAUTO_MERGE_STRATEGY> --auto\")\n```\n\nSet `autoMergeEnabled=true` in the skill response when the delegated call succeeds; otherwise fall through with `autoMergeEnabled=false` and a WARN line so the orchestrator can decide whether to retry.\n\nBackward compatibility: when `--auto-merge` is absent (default `none`), Phase 6 is a no-op and the response reports `autoMergeEnabled=false`.\n\n## Recovery (Render Skill Fallback — EPIC-0066, story-0066-0005)\n\nWhen `x-internal-render-pr-body` returns exit ≠ 0 in Phase 3, this skill falls back to the legacy inline body generator to ensure PR creation never aborts (RULE-004 fail-open). The fallback body lacks the `\u003C!-- template-version: 1.0 -->` marker — `audit-pr-template.sh` (story-0066-0007) will block the merge with `PR_TEMPLATE_VIOLATION`. This is intentional: the preventive render path produces the marker; the detective audit gate enforces it.\n\nThe WARN message includes `RENDER_EXIT` (the render skill exit code) so the operator can diagnose the cause:\n\n| Render exit | Cause | Action |\n| :--- | :--- | :--- |\n| 1 \u002F 2 \u002F 3 | Bug, template missing, story-id derivation failed | Investigate via `RENDER_EXIT`; rerun `mvn process-resources` if template missing |\n\nFull fallback body template, dedup interaction, and RULE-004 contract detail in [`references\u002Frecovery.md`](references\u002Frecovery.md) per ADR-0007.\n\n## Error Handling\n\n| Scenario | Action |\n|----------|--------|\n| Invalid task ID format | ABORT with format explanation |\n| Branch naming mismatch | ABORT: \"Current branch does not match task naming convention: feat\u002Ftask-XXXX-YYYY-NNN-*\" |\n| Tests fail | ABORT: \"Tests failed. Fix tests before creating PR.\" |\n| Parent branch not found (auto-approve mode) | ABORT: \"Parent branch not found for story-XXXX-YYYY\" |\n| Label creation fails | WARN and continue (PR can be created without labels) |\n| gh CLI not available | ABORT: \"gh CLI is required. Install from https:\u002F\u002Fcli.github.com\" |\n| PR already exists for branch | ABORT: \"PR already exists for this branch. Use gh pr view to check.\" |\n| `--epic-id` fails regex `^\\d{4}$` | ABORT exit 5 `INVALID_EPIC_ID`: \"Epic ID must be 4 digits\" |\n| `--auto-merge` != none without `--target-branch` | ABORT exit 6 `AUTO_MERGE_REQUIRES_TARGET`: \"--auto-merge requires --target-branch\" |\n| `--target-branch develop` combined with `--auto-merge` != none | WARN and continue: \"Auto-merge directly to develop is unusual; consider using an epic branch\" |\n| `x-merge-pr` delegation fails in Phase 6 | WARN and continue: PR is created, `autoMergeEnabled=false`, orchestrator retries |\n| `git log --grep` returns empty SHA | Fall back to `git rev-parse HEAD` for `Orchestrator Commit SHA` field |\n| No Phase 1\u002F3 artifacts found on disk | Use `(none found)` as value; PR is still created (audit validates at CI time) |\n\n## Integration Notes\n\n| Skill | Relationship | Context |\n|-------|-------------|---------|\n| `x-commit-changes` | predecessor | Commits are created before PR |\n| `x-push-branch` | alternative | x-push-branch handles general git workflow; x-create-pr is task-specific |\n| `x-implement-story` | called-by | Phase 5 (PR creation) delegates to this skill for task-level PRs |\n| `x-execute-tests` | called-by | Phase 1 pre-check runs the test command |\n| `x-merge-pr` | called (Phase 6) | Invoked when `--auto-merge` != `none` to enable GitHub auto-merge with the chosen strategy |\n| `x-implement-epic` | caller | Propagates `--target-branch epic\u002FXXXX --auto-merge merge --epic-id XXXX` OO-style (RULE-009) |\n\n## Examples\n\n### Basic Task PR\n\n```\n\u002Fx-create-pr TASK-0029-0001-001\n```\n\nCreates PR:\n- Title: `feat(TASK-0029-0001-001): add validation`\n- Target: `develop`\n- Labels: `task`, `story-0029-0001`, `epic-0029`\n\n### Draft PR\n\n```\n\u002Fx-create-pr TASK-0029-0001-001 --draft\n```\n\nCreates draft PR with `[DRAFT] This PR is not ready for review` banner.\n\n### Auto-Approve Mode\n\n```\n\u002Fx-create-pr TASK-0029-0001-001 --auto-approve-pr\n```\n\nCreates PR targeting parent story branch (`feat\u002Fstory-0029-0001-*`) instead of `develop`.\n\n### Custom Description\n\n```\n\u002Fx-create-pr TASK-0029-0001-001 --description \"implement user input validation\"\n```\n\nCreates PR with title: `feat(TASK-0029-0001-001): implement user input validation`\n\n### Target an Epic Branch (orchestrator propagation)\n\n```\n\u002Fx-create-pr TASK-0049-0016-001 --target-branch epic\u002F0049\n```\n\nCreates PR with `--base epic\u002F0049`. Legacy label set is preserved; no auto-merge is enabled.\n\n### Full Orchestrator Chain (target + auto-merge + epic-id)\n\n```\n\u002Fx-create-pr TASK-0049-0016-001 --target-branch epic\u002F0049 --auto-merge merge --epic-id 0049\n```\n\nCreates PR with `--base epic\u002F0049`, label `epic-0049` injected, and delegates Phase 6 to `x-merge-pr --pr \u003CN> --strategy merge --auto`. Response includes `autoMergeEnabled=true`.\n\n### Error -- auto-merge without target-branch\n\n```\n\u002Fx-create-pr TASK-0049-0016-001 --auto-merge merge\n```\n\nExits with code `6` (`AUTO_MERGE_REQUIRES_TARGET`): \"--auto-merge requires --target-branch\".\n\n### Error -- invalid epic-id\n\n```\n\u002Fx-create-pr TASK-0049-0016-001 --target-branch epic\u002F0049 --epic-id 49\n```\n\nExits with code `5` (`INVALID_EPIC_ID`): \"Epic ID must be 4 digits\".\n","## Global Output Policy\n\n- **Language**: English ONLY.\n- **Tone**: Technical, Direct, and Concise.\n- **Efficiency**: Remove all conversational fillers and greetings to save tokens.\n\n# Skill: Task PR Creation\n\n## Purpose\n\nCreates standardized Pull Requests for individual tasks in {{PROJECT_NAME}} with Task ID in the title, automatic labels (`task`, `story-XXXX-YYYY`, `epic-XXXX`), structured body with review checklist, and correct target branch. Ensures every task delivery is traceable and independently reviewable.\n\n## Triggers\n\n- `\u002Fx-create-pr TASK-0029-0001-001` -- create PR for the specified task\n- `\u002Fx-create-pr TASK-0029-0001-001 --draft` -- create as draft PR\n- `\u002Fx-create-pr TASK-0029-0001-001 --auto-approve-pr` -- target parent story branch instead of develop\n- `\u002Fx-create-pr TASK-0029-0001-001 --description \"add user validation\"` -- override PR title description\n- `\u002Fx-create-pr TASK-0029-0001-001 --target-branch epic\u002F0049 --auto-merge merge --epic-id 0049` -- orchestrator-propagated PR targeting an epic branch with auto-merge enabled and epic label applied\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `task-id` | String | Yes | Task ID in format `TASK-XXXX-YYYY-NNN` |\n| `--auto-approve-pr` | Flag | No | Target parent story branch instead of `develop` |\n| `--draft` | Flag | No | Create PR as draft |\n| `--description` | String | No | Short description for PR title (overrides branch-derived description) |\n| `--target-branch` | String | No | Explicit base branch for the PR (overrides `--auto-approve-pr` and default `develop`). Typical orchestrator value: `epic\u002FXXXX` |\n| `--auto-merge` | Enum | No | Post-create auto-merge strategy. One of `merge`, `squash`, `rebase`, `none` (default `none`). Requires `--target-branch` |\n| `--epic-id` | String(4) | No | Four-digit epic identifier (regex `^\\d{4}$`). When set, adds label `epic-XXXX` and epic metadata to the PR body |\n| `--no-story-evidence` | Flag | No | Omit `## Orchestrator Evidence` section. Use ONLY for chore\u002Fdocs PRs without story context. Allowed by `audit-pr-evidence.sh`. |\n\n## Workflow\n\n```\nPhase 0   VALIDATE        -> Parse task ID, validate branch naming, parse extension flags\nPhase 1   PRE-CHECK       -> Run {{TEST_COMMAND}} to verify tests pass\nPhase 2   TITLE           -> Format PR title (\u003C=70 chars, Conventional Commits)\nPhase 3   BODY            -> Generate structured PR body\nPhase 3.5 EVIDENCE        -> Inject ## Orchestrator Evidence (unless --no-story-evidence)\nPhase 4   LABELS          -> Create labels if missing, collect label list\nPhase 5   CREATE          -> Create PR via gh pr create\nPhase 6   AUTO-MERGE      -> If --auto-merge != none, delegate to x-merge-pr\n```\n\n### Phase 0 -- Validate Branch and Arguments\n\n1. Parse task ID from arguments: extract `TASK-XXXX-YYYY-NNN` format\n2. Validate task ID matches pattern: `TASK-\\d{4}-\\d{4}-\\d{3}`\n3. Verify current branch follows naming convention:\n\n```bash\nCURRENT_BRANCH=$(git branch --show-current)\n# Must match: feat\u002Ftask-XXXX-YYYY-NNN-*\nPATTERN=\"^feat\u002Ftask-[0-9]{4}-[0-9]{4}-[0-9]{3}-\"\nif [[ ! \"$CURRENT_BRANCH\" =~ $PATTERN ]]; then\n  echo \"ABORT: Current branch does not match task naming convention: feat\u002Ftask-XXXX-YYYY-NNN-*\"\n  echo \"Current branch: $CURRENT_BRANCH\"\n  exit 1\nfi\n```\n\n4. Extract epic ID (`XXXX`), story ID (`XXXX-YYYY`), and task number (`NNN`) from the task ID\n5. If `--auto-approve-pr` is set, verify parent branch exists:\n\n```bash\nSTORY_ID=\"story-XXXX-YYYY\"\nPARENT_BRANCH=$(git branch -a | grep \"feat\u002F${STORY_ID}\" | head -1 | tr -d ' ')\nif [[ -z \"$PARENT_BRANCH\" ]]; then\n  echo \"ABORT: Parent branch not found for ${STORY_ID}\"\n  exit 1\nfi\n```\n\n6. Parse extension flags (`--target-branch`, `--auto-merge`, `--epic-id`) and run the validation matrix:\n\n```bash\n# Defaults (backward compatible: absent flags produce legacy behavior)\nTARGET_BRANCH_OVERRIDE=\"\"     # empty -> legacy target (parent or develop)\nAUTO_MERGE_STRATEGY=\"none\"    # none | merge | squash | rebase\nEPIC_ID_OVERRIDE=\"\"            # empty -> no epic-XXXX label injection\n\n# Validate --epic-id regex (4 digits) -- exit 5 \u002F INVALID_EPIC_ID\nif [[ -n \"$EPIC_ID_OVERRIDE\" && ! \"$EPIC_ID_OVERRIDE\" =~ ^[0-9]{4}$ ]]; then\n  echo \"ABORT [INVALID_EPIC_ID]: Epic ID must be 4 digits\"\n  exit 5\nfi\n\n# Validate --auto-merge value set\ncase \"$AUTO_MERGE_STRATEGY\" in\n  none|merge|squash|rebase) ;;\n  *) echo \"ABORT: --auto-merge must be one of merge|squash|rebase|none\"; exit 1 ;;\nesac\n\n# Mutex: --auto-merge requires --target-branch -- exit 6 \u002F AUTO_MERGE_REQUIRES_TARGET\nif [[ \"$AUTO_MERGE_STRATEGY\" != \"none\" && -z \"$TARGET_BRANCH_OVERRIDE\" ]]; then\n  echo \"ABORT [AUTO_MERGE_REQUIRES_TARGET]: --auto-merge requires --target-branch\"\n  exit 6\nfi\n\n# Soft warning: auto-merge directly to develop is unusual\nif [[ \"$TARGET_BRANCH_OVERRIDE\" == \"develop\" && \"$AUTO_MERGE_STRATEGY\" != \"none\" ]]; then\n  echo \"WARN: Auto-merge directly to develop is unusual; consider using an epic branch\"\nfi\n```\n\n### Phase 1 -- Pre-Check (Tests)\n\nRun the project test command before creating the PR:\n\n```bash\n{{TEST_COMMAND}}\nif [[ $? -ne 0 ]]; then\n  echo \"ABORT: Tests failed. Fix tests before creating PR.\"\n  exit 1\nfi\n```\n\nIf tests fail, abort with message: `\"Tests failed. Fix tests before creating PR.\"`\n\n### Phase 2 -- Format PR Title\n\nFormat the PR title following Conventional Commits:\n\n1. Determine the commit type from the task type or default to `feat`\n2. Build title: `\u003Ctype>(TASK-XXXX-YYYY-NNN): \u003Cdescription>`\n3. If `--description` is provided, use it; otherwise derive from branch name:\n\n```bash\n# Extract description from branch name\n# feat\u002Ftask-0029-0001-001-add-validation -> add validation\nDESC=$(echo \"$CURRENT_BRANCH\" | sed 's\u002Ffeat\\\u002Ftask-[0-9]*-[0-9]*-[0-9]*-\u002F\u002F' | tr '-' ' ')\n```\n\n4. Truncate title to 70 characters maximum:\n\n```bash\nTITLE=\"feat(TASK-XXXX-YYYY-NNN): ${DESC}\"\nif [[ ${#TITLE} -gt 70 ]]; then\n  TITLE=\"${TITLE:0:67}...\"\nfi\n```\n\n### Phase 3 -- Generate PR Body (via render skill)\n\n**MANDATORY TOOL CALL — Rule 24 §Camada-1 \u002F Rule 13 Pattern 1 (INLINE-SKILL):**\n\nDelegate body generation to `x-internal-render-pr-body` (story-0066-0003). The render skill produces a body Markdown that includes the `\u003C!-- template-version: 1.0 -->` marker required by `audit-pr-template.sh` (story-0066-0007).\n\n```bash\n# Derive story-id from task-id: TASK-XXXX-YYYY-NNN -> story-XXXX-YYYY\nSTORY_ID_FOR_RENDER=\"story-${TASK_EPIC_ID}-${TASK_STORY_NUM}\"\n\n# Create temp file for render output (Rule 06 §Temp files — chmod 600 implicit via mktemp)\nTMP_BODY_PATH=$(mktemp -t pr-body-XXXXXX.md)\nchmod 600 \"$TMP_BODY_PATH\"\ntrap 'rm -f \"$TMP_BODY_PATH\"' EXIT\n\necho \"INFO: Invoking x-internal-render-pr-body --kind=implementation --story-id=$STORY_ID_FOR_RENDER\"\n```\n\nInvoke the `x-internal-render-pr-body` skill via the Skill tool:\n\n    Skill(skill: \"x-internal-render-pr-body\", model: \"haiku\", args: \"--kind=implementation --story-id=$STORY_ID_FOR_RENDER --out=$TMP_BODY_PATH\")\n\n```bash\nRENDER_EXIT=$?\n\nif [[ $RENDER_EXIT -eq 0 ]]; then\n  # Happy path: render skill produced body with template-version marker\n  BODY=$(cat \"$TMP_BODY_PATH\")\nelse\n  # Fallback path — see ## Recovery section\n  echo \"WARN [render-fallback]: PR body gerado via fallback inline (sem template-version marker).\" >&2\n  echo \"     audit-pr-template.sh reportará PR_TEMPLATE_VIOLATION para este PR.\" >&2\n  echo \"     Investigar: x-internal-render-pr-body exit code = $RENDER_EXIT.\" >&2\n\n  # Generate legacy inline body (see ## Recovery for full template)\n  BODY=\"\u003Cinline body — see ## Recovery section>\"\nfi\n```\n\nIf `--draft` is set, prepend to the body:\n\n```markdown\n> [DRAFT] This PR is not ready for review\n```\n\n#### Phase 3.5 -- Inject Orchestrator Evidence (EPIC-0059, story-0059-0007 + EPIC-0066, story-0066-0005 dedup)\n\nUnless `--no-story-evidence` is set, ensure the body contains exactly one `## Orchestrator Evidence` section. The render skill (Phase 3 happy path) already includes the section via `_TEMPLATE-PR-IMPLEMENTATION.md`; the fallback inline body (Phase 3 ## Recovery path) does NOT — it must be injected manually here.\n\n**Deduplication rule (story-0066-0005):**\n\n```bash\n# Skip if explicitly opted out (chore\u002Fdocs PRs without a story context)\nif [[ \"${NO_STORY_EVIDENCE:-false}\" != \"true\" ]]; then\n  # Dedup: if render skill already produced ## Orchestrator Evidence, skip injection\n  if echo \"$BODY\" | grep -q \"^## Orchestrator Evidence\"; then\n    echo \"INFO: ## Orchestrator Evidence already present in rendered template — skipping injection\"\n  else\n  # Extract story ID from task ID: TASK-0059-0007-001 -> story-0059-0007\n  STORY_ID_FOR_EVIDENCE=\"story-${TASK_EPIC_ID}-${TASK_STORY_NUM}\"\n\n  # Orchestrator commit SHA: last commit matching x-implement-story in log\n  ORCH_SHA=$(git log --grep=\"x-implement-story\" -1 --format=\"%H\" 2>\u002Fdev\u002Fnull)\n  if [[ -z \"$ORCH_SHA\" ]]; then\n    # Fallback: use current HEAD SHA\n    ORCH_SHA=$(git rev-parse HEAD)\n  fi\n\n  # Phase 1 artifacts (6 planning artifacts that exist on disk)\n  EPIC_PLANS_DIR=\"ai\u002Fepics\u002Fepic-${TASK_EPIC_ID}\u002Fplans\"\n  P1_ARTIFACTS=\"\"\n  for artifact in \\\n    \"arch-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"plan-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"tests-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"tasks-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"security-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"compliance-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\"; do\n    full_path=\"${EPIC_PLANS_DIR}\u002F${artifact}\"\n    if [[ -f \"$full_path\" ]]; then\n      P1_ARTIFACTS=\"${P1_ARTIFACTS:+${P1_ARTIFACTS}, }${full_path}\"\n    fi\n  done\n  [[ -z \"$P1_ARTIFACTS\" ]] && P1_ARTIFACTS=\"(none found)\"\n\n  # Phase 3 artifacts (4 verification\u002Freview artifacts that exist on disk)\n  EPIC_REPORTS_DIR=\"ai\u002Fepics\u002Fepic-${TASK_EPIC_ID}\u002Freports\"\n  P3_ARTIFACTS=\"\"\n  for artifact in \\\n    \"verify-envelope-${TASK_EPIC_ID}-${TASK_STORY_NUM}.json\" \\\n    \"story-completion-report-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\"; do\n    full_path=\"${EPIC_REPORTS_DIR}\u002F${artifact}\"\n    if [[ -f \"$full_path\" ]]; then\n      P3_ARTIFACTS=\"${P3_ARTIFACTS:+${P3_ARTIFACTS}, }${full_path}\"\n    fi\n  done\n  for artifact in \\\n    \"review-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\" \\\n    \"techlead-review-story-${TASK_EPIC_ID}-${TASK_STORY_NUM}.md\"; do\n    full_path=\"${EPIC_PLANS_DIR}\u002F${artifact}\"\n    if [[ -f \"$full_path\" ]]; then\n      P3_ARTIFACTS=\"${P3_ARTIFACTS:+${P3_ARTIFACTS}, }${full_path}\"\n    fi\n  done\n  [[ -z \"$P3_ARTIFACTS\" ]] && P3_ARTIFACTS=\"(none found)\"\n\n  ORCHESTRATOR_EVIDENCE_SECTION=\"\n## Orchestrator Evidence\n\n\u003C!-- Filled automatically by x-create-pr. Do not edit manually. -->\n\n| Campo | Valor |\n| :--- | :--- |\n| Story IDs | ${STORY_ID_FOR_EVIDENCE} |\n| Orchestrator Commit SHA | ${ORCH_SHA} |\n| Invocation Skill | x-implement-story |\n| Phase 1 Artifacts | ${P1_ARTIFACTS} |\n| Phase 3 Artifacts | ${P3_ARTIFACTS} |\n\"\n\n    BODY=\"${BODY}${ORCHESTRATOR_EVIDENCE_SECTION}\"\n  fi\nfi\n```\n\n**Invariant (story-0066-0005):** the final PR body always contains exactly one `## Orchestrator Evidence` occurrence, regardless of whether it came from the render skill (template) or the fallback inline body.\n\n**`--no-story-evidence` flag:** when set, the `## Orchestrator Evidence` section is omitted and `audit-pr-evidence.sh` will accept the PR. Use ONLY for chore\u002Fdocs PRs that genuinely have no story context (e.g., CHANGELOG-only commits, dependency bumps). When set, `audit-pr-evidence.sh` logs `\"no evidence required (--no-story-evidence)\"` and exits 0.\n\n### Phase 4 -- Label Auto-Creation\n\nEnsure labels exist in the repository, creating them if missing:\n\n```bash\n# Label definitions (base set derived from task ID)\nLABELS=(\n  \"task|#0075ca|Individual task PR\"\n  \"story-XXXX-YYYY|#e4e669|Parent story reference\"\n  \"epic-XXXX|#d73a4a|Parent epic reference\"\n)\n\n# Orchestrator-supplied --epic-id adds\u002Foverrides an explicit epic-XXXX label\nif [[ -n \"$EPIC_ID_OVERRIDE\" ]]; then\n  LABELS+=(\"epic-${EPIC_ID_OVERRIDE}|#d73a4a|Parent epic reference (orchestrator override)\")\nfi\n\nfor LABEL_DEF in \"${LABELS[@]}\"; do\n  IFS='|' read -r NAME COLOR DESC \u003C\u003C\u003C \"$LABEL_DEF\"\n  # Check if label exists; create if not\n  gh label list --search \"$NAME\" --json name -q '.[].name' | grep -qx \"$NAME\" || \\\n    gh label create \"$NAME\" --color \"${COLOR#\\#}\" --description \"$DESC\"\ndone\n```\n\n### Phase 5 -- Create PR\n\nDetermine target branch and create the PR:\n\n```bash\n# Target branch logic (precedence: --target-branch > --auto-approve-pr > develop)\nif [[ -n \"$TARGET_BRANCH_OVERRIDE\" ]]; then\n  TARGET_BRANCH=\"$TARGET_BRANCH_OVERRIDE\"\nelif [[ \"$AUTO_APPROVE\" == \"true\" ]]; then\n  TARGET_BRANCH=\"$PARENT_BRANCH\"\nelse\n  TARGET_BRANCH=\"develop\"\nfi\n\n# Push branch if needed\ngit push -u origin \"$CURRENT_BRANCH\"\n\n# Build gh pr create command\nDRAFT_FLAG=\"\"\nif [[ \"$DRAFT\" == \"true\" ]]; then\n  DRAFT_FLAG=\"--draft\"\nfi\n\n# Assemble label list (epic-ID override appended when present)\nLABEL_LIST=\"task,story-XXXX-YYYY,epic-XXXX\"\nif [[ -n \"$EPIC_ID_OVERRIDE\" ]]; then\n  LABEL_LIST=\"${LABEL_LIST},epic-${EPIC_ID_OVERRIDE}\"\nfi\n\ngh pr create \\\n  --base \"$TARGET_BRANCH\" \\\n  --title \"$TITLE\" \\\n  --body \"$BODY\" \\\n  --label \"$LABEL_LIST\" \\\n  $DRAFT_FLAG\n```\n\nAfter creation, report the result (extended response includes `targetBranch` and `autoMergeEnabled`):\n\n```\nPR #42 created: https:\u002F\u002Fgithub.com\u002Fowner\u002Frepo\u002Fpull\u002F42\n  Title:        feat(TASK-0029-0001-001): add validation\n  Target:       develop\n  Labels:       task, story-0029-0001, epic-0029\n  Draft:        false\n  AutoMerge:    false\n```\n\n### Phase 6 -- Post-Create Auto-Merge (Optional)\n\nWhen `--auto-merge` is set to a strategy other than `none`, delegate to `x-merge-pr` so the PR is queued for automatic merge once checks pass. Uses Pattern 1 (INLINE-SKILL) per Rule 13.\n\n```\nSkill(skill: \"x-merge-pr\", args: \"--pr \u003CPR_NUMBER> --strategy \u003CAUTO_MERGE_STRATEGY> --auto\")\n```\n\nSet `autoMergeEnabled=true` in the skill response when the delegated call succeeds; otherwise fall through with `autoMergeEnabled=false` and a WARN line so the orchestrator can decide whether to retry.\n\nBackward compatibility: when `--auto-merge` is absent (default `none`), Phase 6 is a no-op and the response reports `autoMergeEnabled=false`.\n\n## Recovery (Render Skill Fallback — EPIC-0066, story-0066-0005)\n\nWhen `x-internal-render-pr-body` returns exit ≠ 0 in Phase 3, this skill falls back to the legacy inline body generator to ensure PR creation never aborts (RULE-004 fail-open). The fallback body lacks the `\u003C!-- template-version: 1.0 -->` marker — `audit-pr-template.sh` (story-0066-0007) will block the merge with `PR_TEMPLATE_VIOLATION`. This is intentional: the preventive render path produces the marker; the detective audit gate enforces it.\n\nThe WARN message includes `RENDER_EXIT` (the render skill exit code) so the operator can diagnose the cause:\n\n| Render exit | Cause | Action |\n| :--- | :--- | :--- |\n| 1 \u002F 2 \u002F 3 | Bug, template missing, story-id derivation failed | Investigate via `RENDER_EXIT`; rerun `mvn process-resources` if template missing |\n\nFull fallback body template, dedup interaction, and RULE-004 contract detail in [`references\u002Frecovery.md`](references\u002Frecovery.md) per ADR-0007.\n\n## Error Handling\n\n| Scenario | Action |\n|----------|--------|\n| Invalid task ID format | ABORT with format explanation |\n| Branch naming mismatch | ABORT: \"Current branch does not match task naming convention: feat\u002Ftask-XXXX-YYYY-NNN-*\" |\n| Tests fail | ABORT: \"Tests failed. Fix tests before creating PR.\" |\n| Parent branch not found (auto-approve mode) | ABORT: \"Parent branch not found for story-XXXX-YYYY\" |\n| Label creation fails | WARN and continue (PR can be created without labels) |\n| gh CLI not available | ABORT: \"gh CLI is required. Install from https:\u002F\u002Fcli.github.com\" |\n| PR already exists for branch | ABORT: \"PR already exists for this branch. Use gh pr view to check.\" |\n| `--epic-id` fails regex `^\\d{4}$` | ABORT exit 5 `INVALID_EPIC_ID`: \"Epic ID must be 4 digits\" |\n| `--auto-merge` != none without `--target-branch` | ABORT exit 6 `AUTO_MERGE_REQUIRES_TARGET`: \"--auto-merge requires --target-branch\" |\n| `--target-branch develop` combined with `--auto-merge` != none | WARN and continue: \"Auto-merge directly to develop is unusual; consider using an epic branch\" |\n| `x-merge-pr` delegation fails in Phase 6 | WARN and continue: PR is created, `autoMergeEnabled=false`, orchestrator retries |\n| `git log --grep` returns empty SHA | Fall back to `git rev-parse HEAD` for `Orchestrator Commit SHA` field |\n| No Phase 1\u002F3 artifacts found on disk | Use `(none found)` as value; PR is still created (audit validates at CI time) |\n\n## Integration Notes\n\n| Skill | Relationship | Context |\n|-------|-------------|---------|\n| `x-commit-changes` | predecessor | Commits are created before PR |\n| `x-push-branch` | alternative | x-push-branch handles general git workflow; x-create-pr is task-specific |\n| `x-implement-story` | called-by | Phase 5 (PR creation) delegates to this skill for task-level PRs |\n| `x-execute-tests` | called-by | Phase 1 pre-check runs the test command |\n| `x-merge-pr` | called (Phase 6) | Invoked when `--auto-merge` != `none` to enable GitHub auto-merge with the chosen strategy |\n| `x-implement-epic` | caller | Propagates `--target-branch epic\u002FXXXX --auto-merge merge --epic-id XXXX` OO-style (RULE-009) |\n\n## Examples\n\n### Basic Task PR\n\n```\n\u002Fx-create-pr TASK-0029-0001-001\n```\n\nCreates PR:\n- Title: `feat(TASK-0029-0001-001): add validation`\n- Target: `develop`\n- Labels: `task`, `story-0029-0001`, `epic-0029`\n\n### Draft PR\n\n```\n\u002Fx-create-pr TASK-0029-0001-001 --draft\n```\n\nCreates draft PR with `[DRAFT] This PR is not ready for review` banner.\n\n### Auto-Approve Mode\n\n```\n\u002Fx-create-pr TASK-0029-0001-001 --auto-approve-pr\n```\n\nCreates PR targeting parent story branch (`feat\u002Fstory-0029-0001-*`) instead of `develop`.\n\n### Custom Description\n\n```\n\u002Fx-create-pr TASK-0029-0001-001 --description \"implement user input validation\"\n```\n\nCreates PR with title: `feat(TASK-0029-0001-001): implement user input validation`\n\n### Target an Epic Branch (orchestrator propagation)\n\n```\n\u002Fx-create-pr TASK-0049-0016-001 --target-branch epic\u002F0049\n```\n\nCreates PR with `--base epic\u002F0049`. Legacy label set is preserved; no auto-merge is enabled.\n\n### Full Orchestrator Chain (target + auto-merge + epic-id)\n\n```\n\u002Fx-create-pr TASK-0049-0016-001 --target-branch epic\u002F0049 --auto-merge merge --epic-id 0049\n```\n\nCreates PR with `--base epic\u002F0049`, label `epic-0049` injected, and delegates Phase 6 to `x-merge-pr --pr \u003CN> --strategy merge --auto`. Response includes `autoMergeEnabled=true`.\n\n### Error -- auto-merge without target-branch\n\n```\n\u002Fx-create-pr TASK-0049-0016-001 --auto-merge merge\n```\n\nExits with code `6` (`AUTO_MERGE_REQUIRES_TARGET`): \"--auto-merge requires --target-branch\".\n\n### Error -- invalid epic-id\n\n```\n\u002Fx-create-pr TASK-0049-0016-001 --target-branch epic\u002F0049 --epic-id 49\n```\n\nExits with code `5` (`INVALID_EPIC_ID`): \"Epic ID must be 4 digits\".\n",{"name":5,"description":7,"allowed-tools":24,"argument-hint":25,"context-budget":26,"user-invocable":27,"requires-capabilities":28},"Bash, Read, Grep, Glob, Skill","TASK-XXXX-YYYY-NNN [--auto-approve-pr] [--draft] [--description \"short desc\"] [--target-branch \u003Cbranch>] [--auto-merge \u003Cmerge|squash|rebase|none>] [--epic-id \u003CXXXX>]","medium",true,[],"main","952a630c6f38d193a349d86fa18db1de8843e837","src\u002Fmain\u002Fresources\u002Ftargets\u002Fclaude\u002Fskills\u002Fcore\u002Fpr\u002Fx-create-pr",1,"https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment","https:\u002F\u002Fgithub.com\u002Freview-bench","https:\u002F\u002Freview-bench.ai","An open benchmark for AI code review.","2026-10-27 06:56:37",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":27},[40,43,46],{"tool":41,"command":42},"npx","npx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-create-pr",{"tool":44,"command":45},"bunx","bunx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-create-pr",{"tool":47,"command":48},"pnpm","pnpm dlx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-create-pr","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Fmain\u002Fresources\u002Ftargets\u002Fclaude\u002Fskills\u002Fcore\u002Fpr\u002Fx-create-pr\u002FSKILL.md",[51,57],{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"README.md","REFERENCE","参考文档",2655,"https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Fmain\u002Fresources\u002Ftargets\u002Fclaude\u002Fskills\u002Fcore\u002Fpr\u002Fx-create-pr\u002FREADME.md",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Frecovery.md",2897,"https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Fmain\u002Fresources\u002Ftargets\u002Fclaude\u002Fskills\u002Fcore\u002Fpr\u002Fx-create-pr\u002Freferences\u002Frecovery.md",[62,69,76,83,90,97],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M757M8J48TQ1Y3X25GSJBXAS","x-parallel-eval","Detects and classifies file-collision risks between work units (tasks, stories, or epic phases) before parallel execution. Reads ## File Footprint blocks produced by x-task-plan \u002F x-story-plan, applies the parallelism-heuristics knowledge pack (hard \u002F regen \u002F soft categories + hotspot overrides), and emits a collision matrix + serialization recommendation in Markdown (default) or JSON.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fx-parallel-eval\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M757M57XMR9546S69466HDWT","parallelism-heuristics","Canonical catalog of file-collision heuristics for parallel task, story, and epic execution. Defines the File Footprint block format, the three Conflict Categories (hard \u002F regen \u002F soft), a hotspot list of high-contention paths, and the degrade-with-warning policy. Consumed by x-task-plan, x-story-plan, x-epic-map, x-parallel-eval, and x-dev-*-implement.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fparallelism-heuristics\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M757M11SZ8P1VCQABT08QVYA","x-watch-pr-ci","Polls a PR's CI checks and Copilot review status, blocking until checks complete or timeout. Returns one of 8 stable exit codes (SUCCESS=0, CI_PENDING_PROCEED=10, CI_FAILED=20, TIMEOUT=30, PR_ALREADY_MERGED=40, NO_CI_CONFIGURED=50, PR_CLOSED=60, PR_NOT_FOUND=70). Writes a versioned state-file for session resume.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-watch-pr-ci\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M757KW53K8KFPGADFB4PH949","x-validate-docs","Documentation freshness gate: validates 6 dimensions (readme, api-specs, grpc-proto, adr, skill-docs, system-architecture) against code changes in a PR. Stack-aware — only validates targets declared\u002Fauto-detected from ProjectConfig.documentation.targets. Returns exit non-zero on staleness; produces structured report.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-validate-docs\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M757KQZHSA10MKC0CR571D60","x-update-system-architecture","Incrementally updates docs\u002Farchitecture\u002Fsystem.md after an epic completes. Appends new entries to the Decision Log (§11) using x-internal-write-report --append (dedup by ## ID: marker) and surgically inserts component\u002Fintegration changes into sections 1-10 via Edit. Idempotent: re-running with the same epic produces a byte-identical system.md.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-update-system-architecture\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M757KKBT5Q1SVF8DMJBVF46M","x-update-architecture","Incrementally updates the service architecture document with changes from architecture plans. Adds new components, integrations, flows, and ADR references without rewriting existing content. Use after implementation to keep architecture documentation current.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-update-architecture\u002FSKILL.md",[],[]]