Skip to content

My5t3r10us/cesizen / .agents/skills/apex

Systematic implementation using APEX methodology (Analyze-Plan-Execute-eXamine) with optional parallel subagents, self-validation, and adversarial review. Use when implementing features, fixing bugs, or making code changes that benefit from structured workflow.

steps/step-00b-branch.md

View on GitHub
---
name: step-00b-branch
description: Verify and setup git branch for APEX workflow
returns_to: step-00-init.md
---

# Step 0b: Branch Setup

## MANDATORY EXECUTION RULES (READ FIRST):

- πŸ›‘ NEVER commit directly to main/master when branch_mode enabled
- πŸ›‘ NEVER skip branch verification
- βœ… ALWAYS check current branch first
- βœ… ALWAYS store {branch_name} before returning
- πŸ“‹ YOU ARE A BRANCH MANAGER, not an implementer
- πŸ’¬ FOCUS on branch setup only
- 🚫 FORBIDDEN to start any implementation work

## CONTEXT BOUNDARIES:

- Variables available: `{task_id}`, `{auto_mode}`, `{pr_mode}`
- This sub-step sets: `{branch_name}`
- Return to step-00-init.md after completion

## YOUR TASK:

Verify the current git branch and create a feature branch if on main/master.

---

## EXECUTION SEQUENCE:

### 0. Verify Git Metadata

```bash
git rev-parse --is-inside-work-tree
```

If the command fails, record that Git metadata is unavailable, disable branch
and PR modes, and return to initialization. Do not treat the missing `.git`
directory as an implementation failure.

### 1. Check Current Branch

```bash
git branch --show-current
```

Store result as `{current_branch}`

### 2. Evaluate Branch Status

**If `{current_branch}` is `main` or `master`:**
β†’ Go to step 3 (Create Branch)

**If `{current_branch}` is NOT main/master:**
β†’ Store `{branch_name}` = `{current_branch}`
β†’ Display: "βœ“ Already on branch: {branch_name}"
β†’ Return to step-00-init.md

### 3. Create Feature Branch

**If `{auto_mode}` = true:**
β†’ Auto-create branch: `feat/{task_id}`

**If `{auto_mode}` = false:**
Use AskUserQuestion:
```yaml
questions:
  - header: "Branch"
    question: "You're on {current_branch}. Create a new branch for this task?"
    options:
      - label: "Create feat/{task_id} (Recommended)"
        description: "Create new feature branch and switch to it"
      - label: "Custom branch name"
        description: "I'll specify a custom branch name"
      - label: "Stay on {current_branch}"
        description: "Continue without creating a branch (not recommended for PRs)"
    multiSelect: false
```

### 4. Execute Branch Creation

**If user chose "Create feat/{task_id}" or auto_mode:**
```bash
git checkout -b feat/{task_id}
```
β†’ `{branch_name}` = `feat/{task_id}`

**If user chose "Custom branch name":**
β†’ Ask for branch name
```bash
git checkout -b {custom_name}
```
β†’ `{branch_name}` = `{custom_name}`

**If user chose "Stay on {current_branch}":**
β†’ `{branch_name}` = `{current_branch}`
β†’ Display warning if `{pr_mode}` = true:
  "⚠️ Warning: Creating PR from {current_branch} directly"

### 5. Confirm and Return

Display:
```
βœ“ Branch: {branch_name}
{if new branch created: "Created and switched to new branch"}
```

β†’ Return to step-00-init.md with `{branch_name}` set

---

## SUCCESS METRICS:

βœ… Current branch verified
βœ… Feature branch created if on main/master (unless user declined)
βœ… `{branch_name}` variable set
βœ… User warned if staying on main with PR mode

## FAILURE MODES:

❌ Starting implementation before returning
❌ Not setting `{branch_name}` variable
❌ Creating branch without user consent (when not auto_mode)
❌ **CRITICAL**: Using plain text prompts instead of AskUserQuestion

---

## RETURN:

After branch setup complete, return to `./step-00-init.md` to continue initialization.

<critical>
Remember: This sub-step ONLY handles branch setup. Return immediately after setting {branch_name}.
</critical>
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why β€” repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" β€” or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself β€” your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall