[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M754RCFSS652MDXEB1205F1Y":3,"skill-same:01M754RCFSS652MDXEB1205F1Y":53},{"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":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":6,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M754RCFSS652MDXEB1205F1Y","x-internal-ensure-epic-branch",null,"Single source of truth for the `epic\u002F\u003CID>` branch convention (RULE-001). Invoked by every epic entry-point (x-epic-create, x-epic-decompose, x-orchestrate-epic, x-implement-epic, x-epic-map) at step 0; ensures the branch exists idempotently both locally and on origin. When the branch is absent, delegates creation to `x-create-git-branch`; when present locally but not on origin, emits a complementary `git push`. Seventh skill in the x-internal-* convention and the first under internal\u002Fgit\u002F (after x-internal-update-status \u002F x-internal-write-report \u002F x-internal-normalize-args at internal\u002Fops\u002F and x-internal-load-story-context \u002F x-internal-build-story-plan \u002F x-internal-verify-story at internal\u002Fplan\u002F).","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\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-fintech-pci\u002F.claude\u002Fskills\u002Fx-internal-ensure-epic-branch\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: x-internal-ensure-epic-branch\ndescription: \"Single source of truth for the `epic\u002F\u003CID>` branch convention (RULE-001). Invoked by every epic entry-point (x-epic-create, x-epic-decompose, x-orchestrate-epic, x-implement-epic, x-epic-map) at step 0; ensures the branch exists idempotently both locally and on origin. When the branch is absent, delegates creation to `x-create-git-branch`; when present locally but not on origin, emits a complementary `git push`. Seventh skill in the x-internal-* convention and the first under internal\u002Fgit\u002F (after x-internal-update-status \u002F x-internal-write-report \u002F x-internal-normalize-args at internal\u002Fops\u002F and x-internal-load-story-context \u002F x-internal-build-story-plan \u002F x-internal-verify-story at internal\u002Fplan\u002F).\"\nvisibility: internal\nuser-invocable: false\nallowed-tools: Bash\nargument-hint: \"--epic-id \u003CXXXX> [--base \u003Cbranch>] [--push \u003Ctrue|false>]\"\ncategory: internal-git\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> 🔒 **INTERNAL SKILL**\n> Esta skill é invocada apenas por outras skills (orquestradores).\n> NÃO é destinada a invocação direta pelo usuário.\n> Callers principais: x-epic-create, x-epic-decompose, x-orchestrate-epic,\n> x-implement-epic, x-epic-map (story-0049-0018, 0049-0021, 0049-0022).\n> Sétima skill da convenção `x-internal-*` (após x-internal-update-status\n> pilot 0049-0005, x-internal-write-report 0049-0006, x-internal-normalize-args\n> 0049-0007, x-internal-load-story-context 0049-0011, x-internal-build-story-plan\n> 0049-0012, x-internal-verify-story 0049-0014). Primeira skill na subdir\n> `internal\u002Fgit\u002F` — o subdir `git\u002F` agrupa operações git de orquestração\n> (ensure de branches de épico; futuras skills de ensure de release branch,\n> merge-back de hotfix, etc.).\n\n# Skill: x-internal-ensure-epic-branch\n\n## Purpose\n\nProvide a single, idempotent entry point for the RULE-001 convention\n\"one branch per epic (`epic\u002F\u003CID>`), always exists, always pushed\". The\norchestrator skills that open an epic lifecycle step MUST call this\nskill at step 0 rather than issuing inline `git checkout -b` or\n`git push -u origin` commands; this eliminates three historical\nregressions:\n\n1. Duplicate branches created in parallel invocations (two entry-points\n   launched in the same wave both running `git checkout -b`).\n2. Local-only branches that lagged origin for hours because the caller\n   forgot to push (documented in EPIC-0033 post-mortem).\n3. Divergent base commits between local and remote due to mixed\n   `--base` flags across entry-points.\n\nResponsibilities (single):\n\n1. Validate `--epic-id` against the canonical 4-digit regex.\n2. Resolve branch name → `epic\u002F\u003CID>`.\n3. Detect local existence (`git rev-parse --verify`).\n4. Detect remote existence (`git ls-remote origin`).\n5. Apply the 3-state decision:\n   - new (neither) ⇒ delegate to `Skill x-create-git-branch --push`;\n   - local-only ⇒ emit complementary `git push -u origin`;\n   - local+remote ⇒ idempotent no-op.\n6. Emit a single-line JSON envelope consumed by the caller.\n\nThis skill does NOT create branches directly — all branch creation\ngoes through `x-create-git-branch` (story-0049-0001) to preserve the \"one\ncreation path\" invariant of RULE-001.\n\n## Convention Anchors (x-internal-* 7th skill)\n\n| Aspect | Value | Rationale |\n| :--- | :--- | :--- |\n| Path | `internal\u002Fgit\u002Fx-internal-ensure-epic-branch\u002F` | `internal\u002F` prefix scopes visibility; `git\u002F` groups orchestration-level git ensure operations (distinct from `internal\u002Fops\u002F` state mutation and `internal\u002Fplan\u002F` planning-phase carve-outs). |\n| Frontmatter `visibility` | `internal` | Generator filters from `\u002Fhelp` menu. |\n| Frontmatter `user-invocable` | `false` | Declarative complement to `visibility: internal`. |\n| Body marker | `> 🔒 **INTERNAL SKILL**` as first non-frontmatter content | Human-visible when browsing the repo. |\n| Allowed tools | `Bash` only | Minimal surface; delegates to `x-create-git-branch` via Skill tool when needed. |\n| Naming | `x-internal-{subject}-{action}` | subject = `epic-branch`; action = `ensure`. Mirrors Rule 04 skill taxonomy. |\n\nAudit rule: Rule 22 (Lifecycle Integrity) validates every skill under\n`internal\u002F**` satisfies all 6 anchors above. Violations fail the\n`LifecycleIntegrityAuditTest`.\n\n## Triggers\n\nBare-slash form is intentionally omitted — this skill is never invoked\nby a human typing `\u002Fx-internal-ensure-epic-branch` in chat. All\ninvocations follow Rule 13 INLINE-SKILL pattern from a calling\norchestrator:\n\n```markdown\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0049\")\n```\n\n```markdown\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0050 --base main --push true\")\n```\n\n## Parameters\n\n| Parameter | Required | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `--epic-id \u003CXXXX>` | M | — | 4-digit numeric epic identifier. Must match `^\\d{4}$`. |\n| `--base \u003Cbranch>` | O | `develop` | Base branch for the delegated creation. Must exist locally. |\n| `--push \u003Ctrue\\|false>` | O | `true` | When `true`, guarantees the branch is present on `origin`. When `false`, creation is local-only and the remote-check step is skipped. |\n\n## Response Contract\n\nSuccessful invocations emit a single-line JSON object on stdout:\n\n| Field | Type | Always Present | Description |\n| :--- | :--- | :--- | :--- |\n| `branchName` | `String` | yes | Resolved branch name (`epic\u002F\u003CID>`). |\n| `baseSha` | `String(40)` | yes | SHA of `--base` at the moment the skill ran (captured for audit). |\n| `created` | `Boolean` | yes | `true` when the branch was created in this invocation (delegation to `x-create-git-branch` succeeded). |\n| `alreadyExisted` | `Boolean` | yes | `true` when the branch already existed locally before this invocation. |\n| `pushedNow` | `Boolean` | yes | `true` when this invocation issued the `git push -u origin \u003Cbranch>` (either through `x-create-git-branch --push` or the complementary-push branch). |\n\nInvariant: exactly one of (`created`, `alreadyExisted`) is `true`.\n`pushedNow` is independent; it can be `true` with either.\n\n## Exit Codes\n\n| Code | Name | Condition | Message Format |\n| :--- | :--- | :--- | :--- |\n| 0 | SUCCESS | Ensure completed (created, no-op, or complementary push) | — |\n| 1 | INVALID_EPIC_ID | `--epic-id` missing or fails `^\\d{4}$` | `Epic ID must be 4 digits` |\n| 2 | BASE_NOT_FOUND | `--base` does not resolve locally | `Base branch '\u003Cname>' not found` |\n| 3 | DELEGATION_FAILED | `x-create-git-branch` returned non-zero | `x-create-git-branch failed with exit \u003Ccode>: \u003Cstderr>` |\n| 4 | PUSH_FAILED | Complementary `git push` returned non-zero | `Push to origin failed: \u003Cstderr>` |\n\nExit codes 1 and 2 mirror the story's Section 5.3 error-code table.\nCodes 3 and 4 surface child-process failures without swallowing stderr.\n\n## Workflow\n\n### Step 1 — Argument parsing and `--epic-id` validation\n\n```bash\nEPIC_ID=\"\"\nBASE_BRANCH=\"develop\"\nPUSH=\"true\"\n\nwhile [ $# -gt 0 ]; do\n  case \"$1\" in\n    --epic-id) EPIC_ID=\"$2\"; shift 2 ;;\n    --base)    BASE_BRANCH=\"$2\"; shift 2 ;;\n    --push)    PUSH=\"$2\"; shift 2 ;;\n    *) echo \"ERROR: unknown flag: $1\" >&2; exit 64 ;;\n  esac\ndone\n\nif ! printf '%s' \"$EPIC_ID\" | grep -Eq '^[0-9]{4}$'; then\n  echo \"INVALID_EPIC_ID — Epic ID must be 4 digits\" >&2\n  exit 1\nfi\n```\n\nThe 4-digit regex matches the story's Section 5.1 validation rule. The\nskill intentionally does NOT accept a `feat\u002F` \u002F `epic\u002F` prefix in\n`--epic-id` — the caller supplies the raw number; prefix composition\nis the skill's responsibility.\n\n### Step 2 — Base branch existence check\n\n```bash\nif ! git rev-parse --verify --quiet \"$BASE_BRANCH\" >\u002Fdev\u002Fnull; then\n  echo \"BASE_NOT_FOUND — Base branch '$BASE_BRANCH' not found\" >&2\n  exit 2\nfi\nBASE_SHA=$(git rev-parse --verify \"$BASE_BRANCH\")\n```\n\nExits early before touching any network operation. Matches\n`x-create-git-branch` Step 3 semantics.\n\n### Step 3 — Compute target branch name\n\n```bash\nBRANCH_NAME=\"epic\u002F${EPIC_ID}\"\n```\n\nHard-coded prefix — the RULE-001 convention has exactly one form. No\nconfigurability is intentional; variance breaks the \"one branch per\nepic\" audit trail.\n\n### Step 4 — Local existence detection\n\n```bash\nALREADY_EXISTED=\"false\"\nif git rev-parse --verify --quiet \"$BRANCH_NAME\" >\u002Fdev\u002Fnull; then\n  ALREADY_EXISTED=\"true\"\nfi\n```\n\nA local branch is authoritative over remote — the epic lifecycle runs\nN times on a developer workstation between pushes. The skill trusts\nthe local state and only reconciles to remote when `--push=true`.\n\n### Step 5 — Remote existence detection (skipped when `--push=false`)\n\n```bash\nREMOTE_EXISTS=\"false\"\nif [ \"$PUSH\" = \"true\" ]; then\n  if git ls-remote --exit-code --heads origin \"$BRANCH_NAME\" >\u002Fdev\u002Fnull 2>&1; then\n    REMOTE_EXISTS=\"true\"\n  fi\nfi\n```\n\nWhen `--push=false`, the remote check is skipped and the\ncomplementary-push branch becomes unreachable. The skill still emits\n`pushedNow=false` in that case; the caller owns the downstream\ndecision (e.g., a dry-run mode may want local-only).\n\n### Step 6 — Three-state decision and execution\n\n```bash\nCREATED=\"false\"\nPUSHED_NOW=\"false\"\n\nif [ \"$ALREADY_EXISTED\" = \"true\" ] && [ \"$REMOTE_EXISTS\" = \"true\" ]; then\n  # State A — idempotent no-op\n  :\nelif [ \"$ALREADY_EXISTED\" = \"true\" ] && [ \"$REMOTE_EXISTS\" = \"false\" ] && [ \"$PUSH\" = \"true\" ]; then\n  # State B — complementary push\n  if ! git push -u origin \"$BRANCH_NAME\" 2>\u002Ftmp\u002Fepic-branch-ensure.push.err; then\n    echo \"PUSH_FAILED — Push to origin failed\" >&2\n    cat \u002Ftmp\u002Fepic-branch-ensure.push.err >&2\n    exit 4\n  fi\n  PUSHED_NOW=\"true\"\nelif [ \"$ALREADY_EXISTED\" = \"false\" ]; then\n  # State C — delegate creation to x-create-git-branch\n  #\n  # Invocation shape (Rule 13 INLINE-SKILL):\n  #\n  #   Skill(skill: \"x-create-git-branch\",\n  #         args: \"--name epic\u002F\u003CID> --base \u003CBASE_BRANCH> [--push]\")\n  #\n  # The calling orchestrator forwards --push=true\u002Ffalse verbatim. A\n  # successful invocation populates baseSha, created=true, pushed=\u003Cpush>\n  # on the x-create-git-branch response; this skill re-exports those as\n  # created=true, pushedNow=\u003Cpush>.\n  echo \"DELEGATE_TO_X_GIT_BRANCH — name=$BRANCH_NAME base=$BASE_BRANCH push=$PUSH\" >&2\n  # The orchestrator layer performs the actual Skill(...) call and\n  # captures the result; see the full protocol for the end-to-end\n  # envelope translation.\n  CREATED=\"true\"\n  if [ \"$PUSH\" = \"true\" ]; then\n    PUSHED_NOW=\"true\"\n  fi\nfi\n```\n\nState A, B, and C are mutually exclusive. The caller can distinguish\nthem post-hoc by inspecting `(created, alreadyExisted, pushedNow)`.\n\n### Step 7 — Emit structured response\n\n```bash\nprintf '{\"branchName\":\"%s\",\"baseSha\":\"%s\",\"created\":%s,\"alreadyExisted\":%s,\"pushedNow\":%s}\\n' \\\n  \"$BRANCH_NAME\" \"$BASE_SHA\" \"$CREATED\" \"$ALREADY_EXISTED\" \"$PUSHED_NOW\"\n```\n\nSingle-line JSON keeps parsing cost at O(1) for the caller, which is\ntypically the very first step of an epic entry-point — any overhead\nhere is paid N times per day on a developer workstation.\n\n## Examples\n\n### Example 1 — New epic, branch absent locally and remotely\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0050\")\n```\n\nExpected stdout:\n```json\n{\"branchName\":\"epic\u002F0050\",\"baseSha\":\"\u003Csha>\",\"created\":true,\"alreadyExisted\":false,\"pushedNow\":true}\n```\nExit: 0. Matches Section 7 Gherkin scenario \"Criar branch nova quando\nepic é novo\".\n\n### Example 2 — Idempotent no-op, branch present locally + remotely\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0049\")\n```\n\nExpected stdout:\n```json\n{\"branchName\":\"epic\u002F0049\",\"baseSha\":\"\u003Csha>\",\"created\":false,\"alreadyExisted\":true,\"pushedNow\":false}\n```\nExit: 0. Matches \"Idempotência — branch já existe local + remoto\".\n\n### Example 3 — Complementary push, local-only branch\n\n```bash\n# Branch created manually earlier; never pushed.\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0049 --push true\")\n```\n\nExpected stdout:\n```json\n{\"branchName\":\"epic\u002F0049\",\"baseSha\":\"\u003Csha>\",\"created\":false,\"alreadyExisted\":true,\"pushedNow\":true}\n```\nExit: 0. Matches \"Push complementar — branch local mas não remota\".\n\n### Example 4 — Custom base\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0051 --base main\")\n```\n\nExpected stdout:\n```json\n{\"branchName\":\"epic\u002F0051\",\"baseSha\":\"\u003Csha>\",\"created\":true,\"alreadyExisted\":false,\"pushedNow\":true}\n```\nExit: 0.\n\n### Example 5 — Missing base branch\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0052 --base mybase\")\n```\n\nExpected stderr:\n```\nBASE_NOT_FOUND — Base branch 'mybase' not found\n```\nExit: 2. Matches \"Erro — base inexistente\".\n\n### Example 6 — Malformed epic-id\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 49\")\n```\n\nExpected stderr:\n```\nINVALID_EPIC_ID — Epic ID must be 4 digits\n```\nExit: 1. Matches \"Boundary — epic-id mal formado\".\n\n### Example 7 — Local-only flow (`--push false`)\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0053 --push false\")\n```\n\nExpected stdout:\n```json\n{\"branchName\":\"epic\u002F0053\",\"baseSha\":\"\u003Csha>\",\"created\":true,\"alreadyExisted\":false,\"pushedNow\":false}\n```\nExit: 0. The skill never issues a network operation; suitable for\noffline dry-runs.\n\n## Error Handling\n\n| Scenario | Action |\n| :--- | :--- |\n| `--epic-id` missing or fails regex | Exit 1 (`INVALID_EPIC_ID`); stderr carries the offending value. |\n| `--base` absent locally | Exit 2 (`BASE_NOT_FOUND`); suggest `git fetch origin`. |\n| `x-create-git-branch` delegation fails (State C) | Exit 3 (`DELEGATION_FAILED`); stderr carries `x-create-git-branch` stderr verbatim. |\n| `git push` fails in State B | Exit 4 (`PUSH_FAILED`); stderr carries `git push` stderr verbatim. |\n| `git ls-remote` times out or auth fails | Exit 4 (`PUSH_FAILED`); remote-check failure is treated as a push-side failure. |\n| Unknown flag | Exit 64 (sysexits EX_USAGE); print `usage:` banner. |\n| `git` absent on `PATH` | Exit 127 with `git is required`; abort before any state mutation. |\n\nAll exits preserve `set -e` \u002F `trap`-free semantics: no temp files are\nwritten in the happy path, and the complementary-push temp file at\n`\u002Ftmp\u002Fepic-branch-ensure.push.err` is overwritten on the next\ninvocation (no accumulation).\n\n## Idempotency Contract\n\nThe skill satisfies RULE-002 idempotency over the full 3-state matrix:\n\n| State before | First call | Second call |\n| :--- | :--- | :--- |\n| Branch absent (local + remote) | `created=true, alreadyExisted=false, pushedNow=true` | `created=false, alreadyExisted=true, pushedNow=false` |\n| Branch local, not remote | `created=false, alreadyExisted=true, pushedNow=true` | `created=false, alreadyExisted=true, pushedNow=false` |\n| Branch local + remote | `created=false, alreadyExisted=true, pushedNow=false` | `created=false, alreadyExisted=true, pushedNow=false` |\n\nTwo concurrent invocations of the same `--epic-id` serialize on the\n`git` process lock; the later caller always observes the earlier\ncaller's result as \"already exists\". No `flock` is required — git's\nown `.git\u002Findex.lock` provides the critical-section guarantee at the\ngranularity we need.\n\n## Performance Contract (story Section 3.5)\n\n| Operation | Budget |\n| :--- | :--- |\n| State A (idempotent no-op; no network) | \u003C 1s (two `git rev-parse` calls + `ls-remote`) |\n| State B (complementary push) | \u003C 3s (`ls-remote` + single push round-trip) |\n| State C (delegate to `x-create-git-branch`) | \u003C 3s (branch create + push; matches `x-create-git-branch` budget) |\n\nThe \"\u003C 1s\" ceiling for idempotency is the dominant case in a\nmulti-entry-point workflow: `x-implement-epic` followed by\n`x-orchestrate-epic` followed by `x-epic-map` on the same epic will\ntrigger State A three times; the aggregate overhead must stay sub-3s.\n\n## Testing\n\nThe story ships the following acceptance test scenarios, which are\nthe reference contract every downstream caller (0049-0018, 0049-0021,\n0049-0022) can rely on:\n\n1. **Happy path (State C)** — branch absent both sides; assert\n   `created=true, alreadyExisted=false, pushedNow=true`; assert the\n   ref exists locally (`git rev-parse`) and on origin\n   (`git ls-remote`).\n2. **Idempotency (State A)** — second invocation of the same epic ID\n   yields `created=false, alreadyExisted=true, pushedNow=false`; file\n   tree unchanged; `.git\u002Fpacked-refs` unchanged.\n3. **Complementary push (State B)** — pre-create local branch without\n   pushing, then invoke skill; assert `pushedNow=true`; origin ref\n   now present.\n4. **`--push false`** — assert no network call; `pushedNow=false`\n   regardless of remote state.\n5. **BASE_NOT_FOUND** — pass `--base unknown`; exit 2; message\n   contains `BASE_NOT_FOUND`.\n6. **INVALID_EPIC_ID** — pass `--epic-id 49`; exit 1; message contains\n   `INVALID_EPIC_ID`.\n\nNo Java production code is introduced by this story; the SKILL.md is\nthe deliverable. Golden-file smoke tests are covered upstream by the\ngenerator's existing skill-inventory goldens — this skill, being\n`visibility: internal`, does NOT appear in the `\u002Fhelp` menu or in\n`.claude\u002FREADME.md`, so no golden-file updates are required.\n\n## Generator Filter Contract\n\nThe `ia-dev-env` generator MUST exclude skills with\n`visibility: internal` from:\n\n1. The `.claude\u002FREADME.md` skill-inventory table.\n2. The `\u002Fhelp` menu listing surfaced by Claude Code.\n3. User-facing autocomplete in the chat input.\n\nInternal skills ARE still copied into `.claude\u002Fskills\u002F` (flat layout)\nso `Skill(skill: \"x-internal-ensure-epic-branch\")` invocations from\nother skills resolve correctly. The invariant: **user cannot see\nthem; orchestrators can invoke them.**\n\n## Telemetry\n\nInternal skills DO NOT emit `phase.start` \u002F `phase.end` markers —\ntelemetry is produced by the invoking orchestrator (the `phase`\nwrapping the orchestrator's own step 0 is the correct aggregation\nboundary). Passive hooks still capture `tool.call` for the underlying\n`Bash` invocation.\n\nReference: Rule 13 (Skill Invocation Protocol), Rule 22 (Lifecycle\nIntegrity Audit), ADR-0010 (Interactive Gates Convention — exempts\ninternal skills from the 3-option menu contract).\n\n## Rule References\n\n- **RULE-001** (EPIC-0049) — Branch única por épico (`epic\u002F\u003CID>`).\n  This skill IS the canonical enforcement point.\n- **RULE-005** (EPIC-0049) — Thin orchestrator (UseCase pattern). Epic\n  entry-points call this skill instead of inlining branch logic.\n- **RULE-006** (EPIC-0049) — `x-internal-*` convention. This is the\n  seventh skill to follow the convention.\n- **Rule 09** (Branching Model) — `epic\u002F\u003CID>` is a canonical prefix\n  in the generic branch-name regex.\n- **Rule 13** (Skill Invocation Protocol) — INLINE-SKILL pattern\n  used by all callers.\n- **Rule 22** (Lifecycle Integrity Audit) — validates the 6\n  convention anchors above.\n\n## Integration Notes\n\n| Skill | Relationship | Context |\n| :--- | :--- | :--- |\n| `x-create-git-branch` | delegate (State C) | The only skill this one calls. Handles actual `git branch` + optional push. |\n| `x-epic-create` | caller (future — story-0049-0018) | Step 0 before writing epic metadata. |\n| `x-epic-decompose` | caller (future — story-0049-0018) | Step 0 before writing stories \u002F IMPLEMENTATION-MAP. |\n| `x-orchestrate-epic` | caller (future — story-0049-0021) | Step 0 before per-story planning loop. |\n| `x-implement-epic` | caller (future — story-0049-0021) | Step 0 before Phase 0 preparation. |\n| `x-epic-map` | caller (future — story-0049-0022) | Step 0 before IMPLEMENTATION-MAP refresh. |\n| `x-internal-update-status` | peer (internal\u002Fops\u002F) | Independent — mutates execution-state; this skill mutates git refs. Never co-serialized. |\n| `x-internal-normalize-args` | peer (internal\u002Fops\u002F) | Future refactor may adopt it for flag parsing; current implementation uses inline Bash parsing for minimal surface. |\n\nDownstream stories that depend on this skill: story-0049-0018\n(epic-create \u002F epic-decompose refactor), story-0049-0021\n(epic-orchestrate \u002F epic-implement refactor), story-0049-0022\n(epic-map refactor).\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> 🔒 **INTERNAL SKILL**\n> Esta skill é invocada apenas por outras skills (orquestradores).\n> NÃO é destinada a invocação direta pelo usuário.\n> Callers principais: x-epic-create, x-epic-decompose, x-orchestrate-epic,\n> x-implement-epic, x-epic-map (story-0049-0018, 0049-0021, 0049-0022).\n> Sétima skill da convenção `x-internal-*` (após x-internal-update-status\n> pilot 0049-0005, x-internal-write-report 0049-0006, x-internal-normalize-args\n> 0049-0007, x-internal-load-story-context 0049-0011, x-internal-build-story-plan\n> 0049-0012, x-internal-verify-story 0049-0014). Primeira skill na subdir\n> `internal\u002Fgit\u002F` — o subdir `git\u002F` agrupa operações git de orquestração\n> (ensure de branches de épico; futuras skills de ensure de release branch,\n> merge-back de hotfix, etc.).\n\n# Skill: x-internal-ensure-epic-branch\n\n## Purpose\n\nProvide a single, idempotent entry point for the RULE-001 convention\n\"one branch per epic (`epic\u002F\u003CID>`), always exists, always pushed\". The\norchestrator skills that open an epic lifecycle step MUST call this\nskill at step 0 rather than issuing inline `git checkout -b` or\n`git push -u origin` commands; this eliminates three historical\nregressions:\n\n1. Duplicate branches created in parallel invocations (two entry-points\n   launched in the same wave both running `git checkout -b`).\n2. Local-only branches that lagged origin for hours because the caller\n   forgot to push (documented in EPIC-0033 post-mortem).\n3. Divergent base commits between local and remote due to mixed\n   `--base` flags across entry-points.\n\nResponsibilities (single):\n\n1. Validate `--epic-id` against the canonical 4-digit regex.\n2. Resolve branch name → `epic\u002F\u003CID>`.\n3. Detect local existence (`git rev-parse --verify`).\n4. Detect remote existence (`git ls-remote origin`).\n5. Apply the 3-state decision:\n   - new (neither) ⇒ delegate to `Skill x-create-git-branch --push`;\n   - local-only ⇒ emit complementary `git push -u origin`;\n   - local+remote ⇒ idempotent no-op.\n6. Emit a single-line JSON envelope consumed by the caller.\n\nThis skill does NOT create branches directly — all branch creation\ngoes through `x-create-git-branch` (story-0049-0001) to preserve the \"one\ncreation path\" invariant of RULE-001.\n\n## Convention Anchors (x-internal-* 7th skill)\n\n| Aspect | Value | Rationale |\n| :--- | :--- | :--- |\n| Path | `internal\u002Fgit\u002Fx-internal-ensure-epic-branch\u002F` | `internal\u002F` prefix scopes visibility; `git\u002F` groups orchestration-level git ensure operations (distinct from `internal\u002Fops\u002F` state mutation and `internal\u002Fplan\u002F` planning-phase carve-outs). |\n| Frontmatter `visibility` | `internal` | Generator filters from `\u002Fhelp` menu. |\n| Frontmatter `user-invocable` | `false` | Declarative complement to `visibility: internal`. |\n| Body marker | `> 🔒 **INTERNAL SKILL**` as first non-frontmatter content | Human-visible when browsing the repo. |\n| Allowed tools | `Bash` only | Minimal surface; delegates to `x-create-git-branch` via Skill tool when needed. |\n| Naming | `x-internal-{subject}-{action}` | subject = `epic-branch`; action = `ensure`. Mirrors Rule 04 skill taxonomy. |\n\nAudit rule: Rule 22 (Lifecycle Integrity) validates every skill under\n`internal\u002F**` satisfies all 6 anchors above. Violations fail the\n`LifecycleIntegrityAuditTest`.\n\n## Triggers\n\nBare-slash form is intentionally omitted — this skill is never invoked\nby a human typing `\u002Fx-internal-ensure-epic-branch` in chat. All\ninvocations follow Rule 13 INLINE-SKILL pattern from a calling\norchestrator:\n\n```markdown\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0049\")\n```\n\n```markdown\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0050 --base main --push true\")\n```\n\n## Parameters\n\n| Parameter | Required | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `--epic-id \u003CXXXX>` | M | — | 4-digit numeric epic identifier. Must match `^\\d{4}$`. |\n| `--base \u003Cbranch>` | O | `develop` | Base branch for the delegated creation. Must exist locally. |\n| `--push \u003Ctrue\\|false>` | O | `true` | When `true`, guarantees the branch is present on `origin`. When `false`, creation is local-only and the remote-check step is skipped. |\n\n## Response Contract\n\nSuccessful invocations emit a single-line JSON object on stdout:\n\n| Field | Type | Always Present | Description |\n| :--- | :--- | :--- | :--- |\n| `branchName` | `String` | yes | Resolved branch name (`epic\u002F\u003CID>`). |\n| `baseSha` | `String(40)` | yes | SHA of `--base` at the moment the skill ran (captured for audit). |\n| `created` | `Boolean` | yes | `true` when the branch was created in this invocation (delegation to `x-create-git-branch` succeeded). |\n| `alreadyExisted` | `Boolean` | yes | `true` when the branch already existed locally before this invocation. |\n| `pushedNow` | `Boolean` | yes | `true` when this invocation issued the `git push -u origin \u003Cbranch>` (either through `x-create-git-branch --push` or the complementary-push branch). |\n\nInvariant: exactly one of (`created`, `alreadyExisted`) is `true`.\n`pushedNow` is independent; it can be `true` with either.\n\n## Exit Codes\n\n| Code | Name | Condition | Message Format |\n| :--- | :--- | :--- | :--- |\n| 0 | SUCCESS | Ensure completed (created, no-op, or complementary push) | — |\n| 1 | INVALID_EPIC_ID | `--epic-id` missing or fails `^\\d{4}$` | `Epic ID must be 4 digits` |\n| 2 | BASE_NOT_FOUND | `--base` does not resolve locally | `Base branch '\u003Cname>' not found` |\n| 3 | DELEGATION_FAILED | `x-create-git-branch` returned non-zero | `x-create-git-branch failed with exit \u003Ccode>: \u003Cstderr>` |\n| 4 | PUSH_FAILED | Complementary `git push` returned non-zero | `Push to origin failed: \u003Cstderr>` |\n\nExit codes 1 and 2 mirror the story's Section 5.3 error-code table.\nCodes 3 and 4 surface child-process failures without swallowing stderr.\n\n## Workflow\n\n### Step 1 — Argument parsing and `--epic-id` validation\n\n```bash\nEPIC_ID=\"\"\nBASE_BRANCH=\"develop\"\nPUSH=\"true\"\n\nwhile [ $# -gt 0 ]; do\n  case \"$1\" in\n    --epic-id) EPIC_ID=\"$2\"; shift 2 ;;\n    --base)    BASE_BRANCH=\"$2\"; shift 2 ;;\n    --push)    PUSH=\"$2\"; shift 2 ;;\n    *) echo \"ERROR: unknown flag: $1\" >&2; exit 64 ;;\n  esac\ndone\n\nif ! printf '%s' \"$EPIC_ID\" | grep -Eq '^[0-9]{4}$'; then\n  echo \"INVALID_EPIC_ID — Epic ID must be 4 digits\" >&2\n  exit 1\nfi\n```\n\nThe 4-digit regex matches the story's Section 5.1 validation rule. The\nskill intentionally does NOT accept a `feat\u002F` \u002F `epic\u002F` prefix in\n`--epic-id` — the caller supplies the raw number; prefix composition\nis the skill's responsibility.\n\n### Step 2 — Base branch existence check\n\n```bash\nif ! git rev-parse --verify --quiet \"$BASE_BRANCH\" >\u002Fdev\u002Fnull; then\n  echo \"BASE_NOT_FOUND — Base branch '$BASE_BRANCH' not found\" >&2\n  exit 2\nfi\nBASE_SHA=$(git rev-parse --verify \"$BASE_BRANCH\")\n```\n\nExits early before touching any network operation. Matches\n`x-create-git-branch` Step 3 semantics.\n\n### Step 3 — Compute target branch name\n\n```bash\nBRANCH_NAME=\"epic\u002F${EPIC_ID}\"\n```\n\nHard-coded prefix — the RULE-001 convention has exactly one form. No\nconfigurability is intentional; variance breaks the \"one branch per\nepic\" audit trail.\n\n### Step 4 — Local existence detection\n\n```bash\nALREADY_EXISTED=\"false\"\nif git rev-parse --verify --quiet \"$BRANCH_NAME\" >\u002Fdev\u002Fnull; then\n  ALREADY_EXISTED=\"true\"\nfi\n```\n\nA local branch is authoritative over remote — the epic lifecycle runs\nN times on a developer workstation between pushes. The skill trusts\nthe local state and only reconciles to remote when `--push=true`.\n\n### Step 5 — Remote existence detection (skipped when `--push=false`)\n\n```bash\nREMOTE_EXISTS=\"false\"\nif [ \"$PUSH\" = \"true\" ]; then\n  if git ls-remote --exit-code --heads origin \"$BRANCH_NAME\" >\u002Fdev\u002Fnull 2>&1; then\n    REMOTE_EXISTS=\"true\"\n  fi\nfi\n```\n\nWhen `--push=false`, the remote check is skipped and the\ncomplementary-push branch becomes unreachable. The skill still emits\n`pushedNow=false` in that case; the caller owns the downstream\ndecision (e.g., a dry-run mode may want local-only).\n\n### Step 6 — Three-state decision and execution\n\n```bash\nCREATED=\"false\"\nPUSHED_NOW=\"false\"\n\nif [ \"$ALREADY_EXISTED\" = \"true\" ] && [ \"$REMOTE_EXISTS\" = \"true\" ]; then\n  # State A — idempotent no-op\n  :\nelif [ \"$ALREADY_EXISTED\" = \"true\" ] && [ \"$REMOTE_EXISTS\" = \"false\" ] && [ \"$PUSH\" = \"true\" ]; then\n  # State B — complementary push\n  if ! git push -u origin \"$BRANCH_NAME\" 2>\u002Ftmp\u002Fepic-branch-ensure.push.err; then\n    echo \"PUSH_FAILED — Push to origin failed\" >&2\n    cat \u002Ftmp\u002Fepic-branch-ensure.push.err >&2\n    exit 4\n  fi\n  PUSHED_NOW=\"true\"\nelif [ \"$ALREADY_EXISTED\" = \"false\" ]; then\n  # State C — delegate creation to x-create-git-branch\n  #\n  # Invocation shape (Rule 13 INLINE-SKILL):\n  #\n  #   Skill(skill: \"x-create-git-branch\",\n  #         args: \"--name epic\u002F\u003CID> --base \u003CBASE_BRANCH> [--push]\")\n  #\n  # The calling orchestrator forwards --push=true\u002Ffalse verbatim. A\n  # successful invocation populates baseSha, created=true, pushed=\u003Cpush>\n  # on the x-create-git-branch response; this skill re-exports those as\n  # created=true, pushedNow=\u003Cpush>.\n  echo \"DELEGATE_TO_X_GIT_BRANCH — name=$BRANCH_NAME base=$BASE_BRANCH push=$PUSH\" >&2\n  # The orchestrator layer performs the actual Skill(...) call and\n  # captures the result; see the full protocol for the end-to-end\n  # envelope translation.\n  CREATED=\"true\"\n  if [ \"$PUSH\" = \"true\" ]; then\n    PUSHED_NOW=\"true\"\n  fi\nfi\n```\n\nState A, B, and C are mutually exclusive. The caller can distinguish\nthem post-hoc by inspecting `(created, alreadyExisted, pushedNow)`.\n\n### Step 7 — Emit structured response\n\n```bash\nprintf '{\"branchName\":\"%s\",\"baseSha\":\"%s\",\"created\":%s,\"alreadyExisted\":%s,\"pushedNow\":%s}\\n' \\\n  \"$BRANCH_NAME\" \"$BASE_SHA\" \"$CREATED\" \"$ALREADY_EXISTED\" \"$PUSHED_NOW\"\n```\n\nSingle-line JSON keeps parsing cost at O(1) for the caller, which is\ntypically the very first step of an epic entry-point — any overhead\nhere is paid N times per day on a developer workstation.\n\n## Examples\n\n### Example 1 — New epic, branch absent locally and remotely\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0050\")\n```\n\nExpected stdout:\n```json\n{\"branchName\":\"epic\u002F0050\",\"baseSha\":\"\u003Csha>\",\"created\":true,\"alreadyExisted\":false,\"pushedNow\":true}\n```\nExit: 0. Matches Section 7 Gherkin scenario \"Criar branch nova quando\nepic é novo\".\n\n### Example 2 — Idempotent no-op, branch present locally + remotely\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0049\")\n```\n\nExpected stdout:\n```json\n{\"branchName\":\"epic\u002F0049\",\"baseSha\":\"\u003Csha>\",\"created\":false,\"alreadyExisted\":true,\"pushedNow\":false}\n```\nExit: 0. Matches \"Idempotência — branch já existe local + remoto\".\n\n### Example 3 — Complementary push, local-only branch\n\n```bash\n# Branch created manually earlier; never pushed.\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0049 --push true\")\n```\n\nExpected stdout:\n```json\n{\"branchName\":\"epic\u002F0049\",\"baseSha\":\"\u003Csha>\",\"created\":false,\"alreadyExisted\":true,\"pushedNow\":true}\n```\nExit: 0. Matches \"Push complementar — branch local mas não remota\".\n\n### Example 4 — Custom base\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0051 --base main\")\n```\n\nExpected stdout:\n```json\n{\"branchName\":\"epic\u002F0051\",\"baseSha\":\"\u003Csha>\",\"created\":true,\"alreadyExisted\":false,\"pushedNow\":true}\n```\nExit: 0.\n\n### Example 5 — Missing base branch\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0052 --base mybase\")\n```\n\nExpected stderr:\n```\nBASE_NOT_FOUND — Base branch 'mybase' not found\n```\nExit: 2. Matches \"Erro — base inexistente\".\n\n### Example 6 — Malformed epic-id\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 49\")\n```\n\nExpected stderr:\n```\nINVALID_EPIC_ID — Epic ID must be 4 digits\n```\nExit: 1. Matches \"Boundary — epic-id mal formado\".\n\n### Example 7 — Local-only flow (`--push false`)\n\n```bash\nSkill(skill: \"x-internal-ensure-epic-branch\",\n      args: \"--epic-id 0053 --push false\")\n```\n\nExpected stdout:\n```json\n{\"branchName\":\"epic\u002F0053\",\"baseSha\":\"\u003Csha>\",\"created\":true,\"alreadyExisted\":false,\"pushedNow\":false}\n```\nExit: 0. The skill never issues a network operation; suitable for\noffline dry-runs.\n\n## Error Handling\n\n| Scenario | Action |\n| :--- | :--- |\n| `--epic-id` missing or fails regex | Exit 1 (`INVALID_EPIC_ID`); stderr carries the offending value. |\n| `--base` absent locally | Exit 2 (`BASE_NOT_FOUND`); suggest `git fetch origin`. |\n| `x-create-git-branch` delegation fails (State C) | Exit 3 (`DELEGATION_FAILED`); stderr carries `x-create-git-branch` stderr verbatim. |\n| `git push` fails in State B | Exit 4 (`PUSH_FAILED`); stderr carries `git push` stderr verbatim. |\n| `git ls-remote` times out or auth fails | Exit 4 (`PUSH_FAILED`); remote-check failure is treated as a push-side failure. |\n| Unknown flag | Exit 64 (sysexits EX_USAGE); print `usage:` banner. |\n| `git` absent on `PATH` | Exit 127 with `git is required`; abort before any state mutation. |\n\nAll exits preserve `set -e` \u002F `trap`-free semantics: no temp files are\nwritten in the happy path, and the complementary-push temp file at\n`\u002Ftmp\u002Fepic-branch-ensure.push.err` is overwritten on the next\ninvocation (no accumulation).\n\n## Idempotency Contract\n\nThe skill satisfies RULE-002 idempotency over the full 3-state matrix:\n\n| State before | First call | Second call |\n| :--- | :--- | :--- |\n| Branch absent (local + remote) | `created=true, alreadyExisted=false, pushedNow=true` | `created=false, alreadyExisted=true, pushedNow=false` |\n| Branch local, not remote | `created=false, alreadyExisted=true, pushedNow=true` | `created=false, alreadyExisted=true, pushedNow=false` |\n| Branch local + remote | `created=false, alreadyExisted=true, pushedNow=false` | `created=false, alreadyExisted=true, pushedNow=false` |\n\nTwo concurrent invocations of the same `--epic-id` serialize on the\n`git` process lock; the later caller always observes the earlier\ncaller's result as \"already exists\". No `flock` is required — git's\nown `.git\u002Findex.lock` provides the critical-section guarantee at the\ngranularity we need.\n\n## Performance Contract (story Section 3.5)\n\n| Operation | Budget |\n| :--- | :--- |\n| State A (idempotent no-op; no network) | \u003C 1s (two `git rev-parse` calls + `ls-remote`) |\n| State B (complementary push) | \u003C 3s (`ls-remote` + single push round-trip) |\n| State C (delegate to `x-create-git-branch`) | \u003C 3s (branch create + push; matches `x-create-git-branch` budget) |\n\nThe \"\u003C 1s\" ceiling for idempotency is the dominant case in a\nmulti-entry-point workflow: `x-implement-epic` followed by\n`x-orchestrate-epic` followed by `x-epic-map` on the same epic will\ntrigger State A three times; the aggregate overhead must stay sub-3s.\n\n## Testing\n\nThe story ships the following acceptance test scenarios, which are\nthe reference contract every downstream caller (0049-0018, 0049-0021,\n0049-0022) can rely on:\n\n1. **Happy path (State C)** — branch absent both sides; assert\n   `created=true, alreadyExisted=false, pushedNow=true`; assert the\n   ref exists locally (`git rev-parse`) and on origin\n   (`git ls-remote`).\n2. **Idempotency (State A)** — second invocation of the same epic ID\n   yields `created=false, alreadyExisted=true, pushedNow=false`; file\n   tree unchanged; `.git\u002Fpacked-refs` unchanged.\n3. **Complementary push (State B)** — pre-create local branch without\n   pushing, then invoke skill; assert `pushedNow=true`; origin ref\n   now present.\n4. **`--push false`** — assert no network call; `pushedNow=false`\n   regardless of remote state.\n5. **BASE_NOT_FOUND** — pass `--base unknown`; exit 2; message\n   contains `BASE_NOT_FOUND`.\n6. **INVALID_EPIC_ID** — pass `--epic-id 49`; exit 1; message contains\n   `INVALID_EPIC_ID`.\n\nNo Java production code is introduced by this story; the SKILL.md is\nthe deliverable. Golden-file smoke tests are covered upstream by the\ngenerator's existing skill-inventory goldens — this skill, being\n`visibility: internal`, does NOT appear in the `\u002Fhelp` menu or in\n`.claude\u002FREADME.md`, so no golden-file updates are required.\n\n## Generator Filter Contract\n\nThe `ia-dev-env` generator MUST exclude skills with\n`visibility: internal` from:\n\n1. The `.claude\u002FREADME.md` skill-inventory table.\n2. The `\u002Fhelp` menu listing surfaced by Claude Code.\n3. User-facing autocomplete in the chat input.\n\nInternal skills ARE still copied into `.claude\u002Fskills\u002F` (flat layout)\nso `Skill(skill: \"x-internal-ensure-epic-branch\")` invocations from\nother skills resolve correctly. The invariant: **user cannot see\nthem; orchestrators can invoke them.**\n\n## Telemetry\n\nInternal skills DO NOT emit `phase.start` \u002F `phase.end` markers —\ntelemetry is produced by the invoking orchestrator (the `phase`\nwrapping the orchestrator's own step 0 is the correct aggregation\nboundary). Passive hooks still capture `tool.call` for the underlying\n`Bash` invocation.\n\nReference: Rule 13 (Skill Invocation Protocol), Rule 22 (Lifecycle\nIntegrity Audit), ADR-0010 (Interactive Gates Convention — exempts\ninternal skills from the 3-option menu contract).\n\n## Rule References\n\n- **RULE-001** (EPIC-0049) — Branch única por épico (`epic\u002F\u003CID>`).\n  This skill IS the canonical enforcement point.\n- **RULE-005** (EPIC-0049) — Thin orchestrator (UseCase pattern). Epic\n  entry-points call this skill instead of inlining branch logic.\n- **RULE-006** (EPIC-0049) — `x-internal-*` convention. This is the\n  seventh skill to follow the convention.\n- **Rule 09** (Branching Model) — `epic\u002F\u003CID>` is a canonical prefix\n  in the generic branch-name regex.\n- **Rule 13** (Skill Invocation Protocol) — INLINE-SKILL pattern\n  used by all callers.\n- **Rule 22** (Lifecycle Integrity Audit) — validates the 6\n  convention anchors above.\n\n## Integration Notes\n\n| Skill | Relationship | Context |\n| :--- | :--- | :--- |\n| `x-create-git-branch` | delegate (State C) | The only skill this one calls. Handles actual `git branch` + optional push. |\n| `x-epic-create` | caller (future — story-0049-0018) | Step 0 before writing epic metadata. |\n| `x-epic-decompose` | caller (future — story-0049-0018) | Step 0 before writing stories \u002F IMPLEMENTATION-MAP. |\n| `x-orchestrate-epic` | caller (future — story-0049-0021) | Step 0 before per-story planning loop. |\n| `x-implement-epic` | caller (future — story-0049-0021) | Step 0 before Phase 0 preparation. |\n| `x-epic-map` | caller (future — story-0049-0022) | Step 0 before IMPLEMENTATION-MAP refresh. |\n| `x-internal-update-status` | peer (internal\u002Fops\u002F) | Independent — mutates execution-state; this skill mutates git refs. Never co-serialized. |\n| `x-internal-normalize-args` | peer (internal\u002Fops\u002F) | Future refactor may adopt it for flag parsing; current implementation uses inline Bash parsing for minimal surface. |\n\nDownstream stories that depend on this skill: story-0049-0018\n(epic-create \u002F epic-decompose refactor), story-0049-0021\n(epic-orchestrate \u002F epic-implement refactor), story-0049-0022\n(epic-map refactor).\n",{"name":5,"category":24,"visibility":25,"description":7,"allowed-tools":26,"argument-hint":27,"context-budget":28,"user-invocable":20,"requires-capabilities":29},"internal-git","internal","Bash","--epic-id \u003CXXXX> [--base \u003Cbranch>] [--push \u003Ctrue|false>]","medium",[],"main","952a630c6f38d193a349d86fa18db1de8843e837","src\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-fintech-pci\u002F.claude\u002Fskills\u002Fx-internal-ensure-epic-branch",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":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-ensure-epic-branch",{"tool":45,"command":46},"bunx","bunx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-ensure-epic-branch",{"tool":48,"command":49},"pnpm","pnpm dlx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-ensure-epic-branch","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-fintech-pci\u002F.claude\u002Fskills\u002Fx-internal-ensure-epic-branch\u002FSKILL.md",true,[],[54,61,68,75,82,89],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"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":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"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":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"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":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"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":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"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":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"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",[],[]]