بنقرة واحدة
bugs
Bug hunting with Codex CLI Use when: (1) /bugs is invoked, (2) task relates to bugs functionality.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Bug hunting with Codex CLI Use when: (1) /bugs is invoked, (2) task relates to bugs functionality.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Full orchestration workflow with swarm mode: evaluate -> clarify -> classify -> persist -> plan mode -> spawn teammates -> execute -> validate -> retrospective. Use when: (1) implementing features, (2) complex refactoring, (3) multi-file changes, (4) tasks requiring coordination. Triggers: /orchestrator, /orch, 'orchestrate', 'full workflow', 'implement feature'.
Comprehensive research skill using Zai MCP web search and native Claude Code tools
Smart Forking - Find and fork from relevant historical sessions using parallel memory search across vault, handoffs, and ledgers
Apply adversarial opposite-analysis to plans, specs, architecture, code changes, and claims. Use when the user asks for adversarial review, opposing analysis, contrarian review, red-team reasoning, or Z.ai and MiniMax cross-checks through the Ralph MCP router.
Test case mutation and variation generator for adversarial testing
Patterns for using Context7 MCP for library documentation (v2.25)
| name | bugs |
| description | Bug hunting with Codex CLI Use when: (1) /bugs is invoked, (2) task relates to bugs functionality. |
| context | fork |
| user-invocable | true |
| allowed-tools | ["LSP","Read","Bash","Grep","Glob"] |
Deep bug analysis using Codex gpt-5.2-codex with the bug-hunter skill and TLDR context optimization.
~/.claude/settings.json or CLI/env varsANTHROPIC_DEFAULT_*_MODEL env varsOptimal Scenario: Pure Custom Subagents
This skill uses Pure Custom Subagents (no Agent Teams) for specialized, focused bug analysis.
Task(subagent_type="ralph-reviewer", prompt="Analyze $TARGET for bugs...")
→ Agent executes with restricted tools (no Write/Edit)
→ Returns structured bug findings
→ Complete (no team cleanup needed)
When analyzing directories with many files:
# Spawn multiple reviewers in parallel (no team needed)
Task(subagent_type="ralph-reviewer", prompt="Analyze files 1-10...")
Task(subagent_type="ralph-reviewer", prompt="Analyze files 11-20...")
Task(subagent_type="ralph-reviewer", prompt="Analyze files 21-30...")
# Aggregate results manually or via simple script
AUTOMATIC - Before bug hunting, gather context with 95% token savings:
# Get function signatures and call flow
tldr context "$TARGET_FILE" . > /tmp/bugs-context.md
# Get dependency graph for tracking bug propagation
tldr deps "$TARGET_FILE" . > /tmp/bugs-deps.md
# Get codebase structure for understanding module relationships
tldr structure . > /tmp/bugs-structure.md
# Semantic search for error handling patterns
tldr semantic "try catch error exception throw" .
The /bugs command performs comprehensive static analysis using TLDR-compressed context to identify potential bugs, logic errors, race conditions, edge cases, and other code issues that could cause runtime failures or unexpected behavior. It uses Codex GPT-5.2 model with specialized bug-hunting capabilities to analyze code paths, detect anti-patterns, and suggest fixes.
Unlike traditional linters, Codex bug hunting performs deep semantic analysis:
Use /bugs when:
Codex bug hunting follows a systematic approach:
| Category | Examples | Severity |
|---|---|---|
| Logic Errors | Off-by-one, incorrect conditions, wrong operators | HIGH |
| Race Conditions | Unprotected shared state, TOCTOU bugs | HIGH |
| Memory Issues | Leaks, use-after-free, buffer overflows | CRITICAL |
| Type Errors | Implicit conversions, type coercion bugs | MEDIUM |
| Error Handling | Uncaught exceptions, missing null checks | HIGH |
| Edge Cases | Empty arrays, boundary values, overflow | MEDIUM |
| Async Issues | Unhandled promises, callback hell, deadlocks | HIGH |
| Security Bugs | Injection, XSS, CSRF (see /security for full audit) | CRITICAL |
# Bug hunt on specific file
ralph bugs src/auth/login.ts
# Bug hunt on directory
ralph bugs src/components/
# Bug hunt on entire codebase
ralph bugs .
# Background execution with logging
ralph bugs src/ > bugs-report.json 2>&1 &
Use the Task tool to invoke Codex bug hunting with TLDR context:
Task:
subagent_type: "debugger"
model: "sonnet"
run_in_background: true
description: "Codex bug hunting analysis"
prompt: |
# Context (95% token savings via tldr)
Structure: $(tldr structure .)
File Context: $(tldr context $ARGUMENTS .)
Dependencies: $(tldr deps $ARGUMENTS .)
Execute Codex bug hunting via CLI:
cd ~/Documents/GitHub/multi-agent-ralph-loop && \
codex exec --yolo --enable-skills -m gpt-5.2-codex \
"Use bug-hunter skill. Find bugs in: $ARGUMENTS
Output JSON: {
bugs: [
{
severity: 'CRITICAL|HIGH|MEDIUM|LOW',
type: 'logic|race|memory|type|error-handling|edge-case|async|security',
file: 'path/to/file.ts',
line: 42,
description: 'Clear bug description',
fix: 'Concrete remediation steps'
}
],
summary: {
total: 5,
high: 2,
medium: 2,
low: 1,
approved: false
}
}"
Apply Ralph Loop: iterate until all HIGH+ bugs are resolved or approved.
For immediate results without Task orchestration:
codex exec --yolo --enable-skills -m gpt-5.2-codex \
"Use bug-hunter skill. Find bugs in: src/
Focus on:
- Race conditions in async code
- Uncaught promise rejections
- Type coercion issues
- Edge case handling
Output JSON with severity, type, file, line, description, fix"
The bug hunting analysis returns structured JSON:
{
"bugs": [
{
"severity": "HIGH",
"type": "race",
"file": "src/auth/session.ts",
"line": 87,
"description": "Race condition: session.user accessed before async initialization completes",
"fix": "Add await before accessing session.user, or use Promise.all() to ensure initialization"
},
{
"severity": "MEDIUM",
"type": "edge-case",
"file": "src/utils/parser.ts",
"line": 23,
"description": "Empty array not handled: arr[0] will throw if arr is empty",
"fix": "Add guard: if (arr.length === 0) return null; before accessing arr[0]"
}
],
"summary": {
"total": 2,
"high": 1,
"medium": 1,
"low": 0,
"approved": false
}
}
| Severity | Meaning | Action |
|---|---|---|
| CRITICAL | Production-breaking, security issues | MUST FIX before merge |
| HIGH | Likely to cause failures, data corruption | SHOULD FIX before merge |
| MEDIUM | Edge cases, potential issues under load | Review and decide |
| LOW | Code smells, minor improvements | Optional fix |
The /bugs command integrates with other Ralph workflows:
Task:
subagent_type: "debugger"
model: "opus" # Opus for deep analysis
description: "Full debugging workflow"
prompt: |
1. Run /bugs on $TARGET
2. Analyze top 5 HIGH severity bugs
3. Trace execution paths to root cause
4. Propose fixes with test cases
5. Validate fixes pass quality gates
When a bug fix needs a clarified spec:
# Step 1: Bug hunting
ralph bugs src/payment/
# Step 2: Draft a short spec for the fix
ralph adversarial "Draft: Fix payment retry logic with idempotency"
Generate tests that specifically target discovered bugs:
Task:
subagent_type: "test-architect"
model: "sonnet"
prompt: |
Read bugs-report.json
For each HIGH/CRITICAL bug:
- Write failing test that reproduces bug
- Verify test fails before fix
- Apply fix from bug report
- Verify test passes after fix
Use TDD pattern: RED → FIX → GREEN
| Command | Purpose | When to Use |
|---|---|---|
/security | Security-focused audit (CWE checks) | Before production deploy |
/unit-tests | Generate test coverage | After bug fixes |
/refactor | Improve code structure | After identifying patterns |
/adversarial | Adversarial spec refinement | Critical code paths |
/full-review | Comprehensive analysis (6 agents) | Major features/releases |
The /bugs command follows the Ralph Loop pattern with these hooks:
┌─────────────────────────────────────────────────────────┐
│ RALPH LOOP: Bug Hunting │
├─────────────────────────────────────────────────────────┤
│ │
│ 1. EXECUTE → codex exec bug-hunter │
│ 2. VALIDATE → Check severity counts │
│ 3. ITERATE → Fix HIGH+ bugs │
│ 4. VERIFY → Re-run until summary.approved = true │
│ │
│ Quality Gate: No HIGH+ bugs OR all explicitly approved │
│ Max Iterations: 15 (Codex GPT-5.2) │
│ │
└─────────────────────────────────────────────────────────┘
The bug hunting loop continues until:
Full bug hunting and remediation workflow:
# 1. Initial bug scan
ralph bugs src/
# 2. Review report
cat .claude/tmp/codex_bugs.json | jq '.summary'
# 3. Fix HIGH severity bugs
# (manual or via /refactor)
# 4. Verify fixes
ralph bugs src/ # Should show reduced bug count
# 5. Generate regression tests
ralph unit-tests src/
# 6. Run quality gates
ralph gates
# 7. Final approval (if LOW bugs remain)
# Add to bugs-report.json: "approved": true, "justification": "Low risk edge cases"
--model opus for payment/auth/crypto code| Model | Cost | Speed | When to Use |
|---|---|---|---|
| GPT-5.2-Codex | ~15% | Fast | Default for bug hunting |
| Opus | 100% | Slow | Critical code paths |
| Sonnet | 60% | Medium | Task orchestration only |
Recommended: Codex GPT-5.2 for bug hunting (optimized for code analysis)
Esta skill genera reportes automáticos completos para trazabilidad:
Cuando esta skill completa, se genera automáticamente:
docs/actions/bugs/{timestamp}.md.claude/metadata/actions/bugs/{timestamp}.jsonCada reporte incluye:
# Listar todos los reportes de esta skill
ls -lt docs/actions/bugs/
# Ver el reporte más reciente
cat $(ls -t docs/actions/bugs/*.md | head -1)
# Buscar reportes fallidos
grep -l "Status: FAILED" docs/actions/bugs/*.md
source .claude/lib/action-report-lib.sh
start_action_report "bugs" "Task description"
# ... ejecución ...
complete_action_report "success" "Summary" "Recommendations"