My5t3r10us/cesizen / .agents/skills/apex
apex
VerifiedSystematic 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-09-finish.md
View on GitHub---
name: step-09-finish
description: Finish APEX workflow and create pull request
previous_step: step-08-run-tests.md (or step-04-validate.md if no tests)
---
# Step 9: Finish & Create PR
## MANDATORY EXECUTION RULES (READ FIRST):
- π NEVER push without user confirmation (unless auto_mode)
- π NEVER create PR if there are uncommitted changes
- β
ALWAYS verify all changes are committed
- β
ALWAYS push to remote before creating PR
- π YOU ARE A FINISHER, completing the workflow
- π¬ FOCUS on PR creation and workflow summary
- π« FORBIDDEN to make code changes in this step
## EXECUTION PROTOCOLS:
- π― Verify git status before any push/PR operations
- πΎ Save PR details to output file if save_mode enabled
- π Provide clear workflow summary
- π« FORBIDDEN to proceed with uncommitted changes
## CONTEXT BOUNDARIES:
- Variables available: `{task_id}`, `{task_description}`, `{branch_name}`, `{pr_mode}`, `{auto_mode}`, `{save_mode}`, `{teams_mode}`, `{output_dir}`
- Previous steps completed: analyze, plan, execute, validate (+ optional: tests, examine)
- All implementation should be done at this point
## YOUR TASK:
Finalize the APEX workflow by committing remaining changes, pushing to remote, and creating a pull request.
---
## EXECUTION SEQUENCE:
### 0. Shutdown Agent Team (if teams_mode)
<critical>
This is the ONLY step where team shutdown should happen.
All previous steps (validate, examine, resolve) keep the team alive.
</critical>
**If `{teams_mode}` = true:**
1. Send shutdown_request to each teammate:
```
SendMessage:
type: "shutdown_request"
recipient: "impl-{name}"
content: "APEX workflow complete. Shutting down team."
```
2. Wait for all teammates to confirm shutdown.
3. Delete the team:
```
TeamDelete
```
β This cleans up team files and task directories.
### 1. Verify Git Status
```bash
git rev-parse --is-inside-work-tree
git status
```
If Git metadata is unavailable, skip every commit, push and pull-request step.
Finish with the changed-file and validation summary only.
**If uncommitted changes exist:**
β Commit them with message: `feat({task_id}): {task_description}`
**If working tree is clean:**
β Continue to step 2
### 2. Check Commits to Push
```bash
git log origin/{branch_name}..HEAD --oneline 2>/dev/null || git log --oneline -5
```
Display commits that will be included in PR.
### 3. Confirm Push (if not auto_mode)
**If `{auto_mode}` = true:**
β Auto-push to remote
**If `{auto_mode}` = false:**
Use AskUserQuestion:
```yaml
questions:
- header: "Push"
question: "Ready to push {branch_name} and create PR?"
options:
- label: "Push and create PR (Recommended)"
description: "Push commits to remote and open pull request"
- label: "Push only"
description: "Push to remote without creating PR"
- label: "Review commits first"
description: "Show me the full diff before pushing"
- label: "Cancel"
description: "Don't push or create PR"
multiSelect: false
```
### 4. Push to Remote
```bash
git push -u origin {branch_name}
```
**If push fails:**
β Display error and ask user how to proceed
β Common fixes: pull --rebase, force push (with warning)
### 5. Create Pull Request (if pr_mode)
**If `{pr_mode}` = true:**
Generate PR content:
- **Title:** `feat({task_id}): {task_description}`
- **Body:** Summary of changes from the workflow
```bash
gh pr create --title "feat({task_id}): {task_description}" --body "$(cat <<'EOF'
## Summary
{Brief description of what was implemented}
## Changes
{List of key changes made}
## Testing
{How the changes were validated}
---
_Generated by APEX workflow_
EOF
)"
```
**Capture PR URL:**
```bash
gh pr view --json url -q '.url'
```
β Store as `{pr_url}`
### 6. Save Output (if save_mode)
**If `{save_mode}` = true:**
```bash
bash {skill_dir}/scripts/update-progress.sh "{task_id}" "09" "finish" "in_progress"
```
Append to `{output_dir}/09-finish.md`: branch, PR URL, commits, timestamp.
```bash
bash {skill_dir}/scripts/update-progress.sh "{task_id}" "09" "finish" "complete"
```
### 7. Final Summary
Display workflow completion summary:
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
APEX WORKFLOW COMPLETE
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Task: {task_description}
ID: {task_id}
β Analysis complete
β Plan created and approved
β Implementation done
β Validation passed
{if test_mode: "β Tests passing"}
{if examine_mode: "β Review findings resolved"}
β Changes pushed to {branch_name}
{if pr_mode: "β PR created: {pr_url}"}
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
---
## SUCCESS METRICS:
β
Agent team shut down gracefully via SendMessage shutdown_request (if teams_mode)
β
TeamDelete called to clean up team resources (if teams_mode)
β
All changes committed
β
Branch pushed to remote
β
PR created with proper title and description (if pr_mode)
β
PR URL captured and displayed
β
Output saved (if save_mode)
β
Clear completion summary provided
## FAILURE MODES:
β Creating PR with uncommitted changes
β Pushing without user confirmation (when not auto_mode)
β Force pushing without explicit user request
β Not displaying PR URL after creation
β **CRITICAL**: Using plain text prompts instead of AskUserQuestion
---
## WORKFLOW COMPLETE
This is the final step of the APEX workflow. No next step to load.
<critical>
Remember: This step handles git operations, PR creation, AND team shutdown (if teams_mode).
All code changes should have been completed in earlier steps.
Team shutdown MUST happen here β step 0 of execution sequence β before git operations.
</critical>
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 472k | Updated | Claude CodeCodex | Verified | Install |
| 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: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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 available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |