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.
scripts/setup-templates.sh
View on GitHub#!/bin/bash
# APEX Template Setup Script
# Creates output directory structure and initializes template files
#
# Usage: setup-templates.sh "feature-name" [other args...]
# The script auto-generates the task ID with the next available number.
set -e
# Arguments - first arg is now just the feature name (kebab-case)
FEATURE_NAME="$1"
TASK_DESCRIPTION="$2"
AUTO_MODE="${3:-false}"
EXAMINE_MODE="${4:-false}"
SAVE_MODE="${5:-false}"
TEST_MODE="${6:-false}"
ECONOMY_MODE="${7:-false}"
BRANCH_MODE="${8:-false}"
PR_MODE="${9:-false}"
INTERACTIVE_MODE="${10:-false}"
TASKS_MODE="${11:-false}"
VERIFY_MODE="${12:-false}"
BRANCH_NAME="${13:-}"
ORIGINAL_INPUT="${14:-}"
# Validate required arguments
if [[ -z "$FEATURE_NAME" ]]; then
echo "Error: FEATURE_NAME is required"
exit 1
fi
if [[ -z "$TASK_DESCRIPTION" ]]; then
echo "Error: TASK_DESCRIPTION is required"
exit 1
fi
# Get current timestamp
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
# Use current working directory as project root
PROJECT_ROOT=$(pwd)
APEX_OUTPUT_DIR="${PROJECT_ROOT}/.claude/output/apex"
# Create apex output directory if it doesn't exist
mkdir -p "$APEX_OUTPUT_DIR"
# Find the next available number
NEXT_NUM=1
if [[ -d "$APEX_OUTPUT_DIR" ]]; then
# Find highest existing number prefix
HIGHEST=$(ls -1 "$APEX_OUTPUT_DIR" 2>/dev/null | grep -oE '^[0-9]+' | sort -n | tail -1)
if [[ -n "$HIGHEST" ]]; then
# Force base-10 interpretation (leading zeros would be treated as octal)
NEXT_NUM=$((10#$HIGHEST + 1))
fi
fi
# Format with leading zeros (2 digits)
TASK_NUM=$(printf "%02d" "$NEXT_NUM")
# Build full task ID
TASK_ID="${TASK_NUM}-${FEATURE_NAME}"
OUTPUT_DIR="${APEX_OUTPUT_DIR}/${TASK_ID}"
# Get skill directory
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
TEMPLATE_DIR="${SKILL_DIR}/templates"
# Create output directory
mkdir -p "$OUTPUT_DIR"
# Function to replace template variables
render_template() {
local template_file="$1"
local output_file="$2"
# Determine status strings based on flags
local examine_status="⏭ Skip"
[[ "$EXAMINE_MODE" == "true" ]] && examine_status="⏸ Pending"
local test_status="⏭ Skip"
[[ "$TEST_MODE" == "true" ]] && test_status="⏸ Pending"
local pr_status="⏭ Skip"
[[ "$PR_MODE" == "true" ]] && pr_status="⏸ Pending"
local verify_status="⏭ Skip"
[[ "$VERIFY_MODE" == "true" ]] && verify_status="⏸ Pending"
local tasks_status="⏭ Skip"
[[ "$TASKS_MODE" == "true" ]] && tasks_status="⏸ Pending"
# Read template and replace variables
sed -e "s|{{task_id}}|${TASK_ID}|g" \
-e "s|{{task_description}}|${TASK_DESCRIPTION}|g" \
-e "s|{{timestamp}}|${TIMESTAMP}|g" \
-e "s|{{auto_mode}}|${AUTO_MODE}|g" \
-e "s|{{examine_mode}}|${EXAMINE_MODE}|g" \
-e "s|{{save_mode}}|${SAVE_MODE}|g" \
-e "s|{{test_mode}}|${TEST_MODE}|g" \
-e "s|{{economy_mode}}|${ECONOMY_MODE}|g" \
-e "s|{{branch_mode}}|${BRANCH_MODE}|g" \
-e "s|{{pr_mode}}|${PR_MODE}|g" \
-e "s|{{interactive_mode}}|${INTERACTIVE_MODE}|g" \
-e "s|{{tasks_mode}}|${TASKS_MODE}|g" \
-e "s|{{verify_mode}}|${VERIFY_MODE}|g" \
-e "s|{{branch_name}}|${BRANCH_NAME}|g" \
-e "s|{{original_input}}|${ORIGINAL_INPUT}|g" \
-e "s|{{examine_status}}|${examine_status}|g" \
-e "s|{{test_status}}|${test_status}|g" \
-e "s|{{tasks_status}}|${tasks_status}|g" \
-e "s|{{verify_status}}|${verify_status}|g" \
-e "s|{{pr_status}}|${pr_status}|g" \
"$template_file" > "$output_file"
}
# Initialize 00-context.md
render_template "${TEMPLATE_DIR}/00-context.md" "${OUTPUT_DIR}/00-context.md"
# Initialize other step files (only headers, content appended during execution)
render_template "${TEMPLATE_DIR}/01-analyze.md" "${OUTPUT_DIR}/01-analyze.md"
render_template "${TEMPLATE_DIR}/02-plan.md" "${OUTPUT_DIR}/02-plan.md"
render_template "${TEMPLATE_DIR}/03-execute.md" "${OUTPUT_DIR}/03-execute.md"
render_template "${TEMPLATE_DIR}/04-validate.md" "${OUTPUT_DIR}/04-validate.md"
# Conditional templates
if [[ "$EXAMINE_MODE" == "true" ]]; then
render_template "${TEMPLATE_DIR}/05-examine.md" "${OUTPUT_DIR}/05-examine.md"
render_template "${TEMPLATE_DIR}/06-resolve.md" "${OUTPUT_DIR}/06-resolve.md"
fi
if [[ "$TEST_MODE" == "true" ]]; then
render_template "${TEMPLATE_DIR}/07-tests.md" "${OUTPUT_DIR}/07-tests.md"
render_template "${TEMPLATE_DIR}/08-run-tests.md" "${OUTPUT_DIR}/08-run-tests.md"
fi
if [[ "$VERIFY_MODE" == "true" ]]; then
render_template "${TEMPLATE_DIR}/10-verify.md" "${OUTPUT_DIR}/10-verify.md"
fi
if [[ "$TASKS_MODE" == "true" ]]; then
mkdir -p "${OUTPUT_DIR}/tasks"
fi
if [[ "$PR_MODE" == "true" ]]; then
render_template "${TEMPLATE_DIR}/09-finish.md" "${OUTPUT_DIR}/09-finish.md"
fi
# Output the generated task_id for capture by caller
echo "TASK_ID=${TASK_ID}"
echo "OUTPUT_DIR=${OUTPUT_DIR}"
echo "✓ APEX templates initialized: ${OUTPUT_DIR}"
exit 0
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 |