Agent skill

code-investigate

Dual-perspective code investigation. Use when: deep code analysis needing both Claude and Codex perspectives. Not for: quick exploration (use code-explore), code review (use codex-code-review). Output: integrated findings from dual analysis.

Stars 139
Forks 18

Install this agent skill to your Project

npx add-skill https://github.com/sd0xdev/sd0x-dev-flow/tree/main/skills/code-investigate

SKILL.md

Code Investigate Skill

Trigger

  • Keywords: investigate code, how feature works, trace implementation, dual confirmation, deep dive, how code works, what this code does, code research

When NOT to Use

  • Just need quick lookup (use Grep/Glob directly)
  • Code review (use codex-review)
  • System verification (use feature-verify)
  • Git history tracking (use git-investigate)

Core Principle

Codex must explore independently. Feeding Claude's conclusions to Codex is prohibited.
┌─────────────────┐     ┌─────────────────┐
│ Claude Explores  │     │ Codex Explores   │
│ Independently    │     │ Independently    │
│   (Phase 1-2)   │     │    (Phase 3)     │
└────────┬────────┘     └────────┬────────┘
         │                       │
         ▼                       ▼
   ┌───────────┐           ┌───────────┐
   │ Claude    │           │ Codex     │
   │ Conclusion│           │ Conclusion│
   └─────┬─────┘           └─────┬─────┘
         │                       │
         └───────────┬───────────┘
                     ▼
              ┌─────────────┐
              │ Consolidated│
              │   Report    │
              │  (Phase 4)  │
              └─────────────┘

Workflow

Phase Name Action Output
1 Claude Explore Grep/Glob/Read to search code Related files list
2 Claude Conclude Analyze logic, form understanding Initial conclusion (internal)
3 Codex Explore Invoke Codex MCP to explore independently Codex analysis report
4 Integrate Compare both perspectives, mark differences Consolidated report

Codex Invocation Rules

Required Parameters

Parameter Value Description
sandbox read-only Force read-only
approval-policy never Auto-execute
cwd Project root Exploration start point

Correct Approach

typescript
mcp__codex__codex({
  prompt: `# Code Investigation Task

## Question
${userQuestion}

## Project Info
- Path: ${cwd}
- Tech Stack: {FRAMEWORK} + TypeScript + {DATABASE}

Please **independently explore** the codebase and answer:
1. What files are related?
2. How does the core logic work?
3. What is the data flow?
4. What are the key dependencies?

Please grep/read and explore on your own, then provide your analysis.`,
  cwd: '/path/to/project',
  sandbox: 'read-only',
  'approval-policy': 'never',
});

Prohibited Approaches

Pattern Problem Example
Feeding conclusion Claude's findings leak to Codex Claude found these files: ${findings}
Leading question Presupposes answer I think the problem is in cache, verify
Scope restriction Prevents independent exploration Only look at src/service/

Output

markdown
## Investigation Report
- **Claude findings**: <independent analysis>
- **Codex findings**: <independent analysis>
- **Integrated conclusion**: <merged findings>
- **Confidence**: High / Medium / Low

Verification Checklist

Check Standard
Claude independent conclusion Phase 2 forms conclusion, not output to user
Codex prompt is clean Contains only question + project path, no Claude findings
Report perspectives separated Claude / Codex conclusions presented separately
Integration is complete Marks agreement, differences, possible gaps

References

File Purpose When to Read
references/prompts.md Codex prompt templates Before Phase 3
references/output-template.md Report format During Phase 4

Examples

Feature Investigation

Input: Investigate how order processing works
Phase 1: Grep "processOrder" -> Read src/service/order/*.ts
Phase 2: Form understanding: Controller -> Service -> Repository write
Phase 3: Codex explores independently (only given question + path)
Phase 4: Consolidated report -> mark both perspectives

Mechanism Understanding

Input: How does the API caching mechanism work?
Phase 1: Grep "cache" + "portfolio" -> Read related files
Phase 2: Understand Redis TTL + fallback mechanism
Phase 3: Codex investigates independently
Phase 4: Compare differences -> output consolidated report

Problem Diagnosis

Input: Why is token price sometimes null?
Phase 1: Search price-related logic + error handling
Phase 2: Identify possible fallback paths
Phase 3: Codex diagnoses independently
Phase 4: Synthesize both findings -> list possible causes

Expand your agent's capabilities with these related and highly-rated skills.

sd0xdev/sd0x-dev-flow

runbook

Generate and update feature release runbooks from existing docs and codebase. Use when: creating operational runbook, release handbook, deployment checklist, pre-release preparation. Not for: incident response (v2), code review (use codex-code-review), architecture design (use architecture).

139 18
Explore
sd0xdev/sd0x-dev-flow

ask

Context-aware Q&A with auto context gathering. Use when: user has a quick question about codebase, git history, rules, docs, or skills during development. Not for: code changes (use feature-dev), code review (use codex-review-fast), deep research (use deep-research), full code trace (use code-explore). Output: structured answer with source attribution.

139 18
Explore
sd0xdev/sd0x-dev-flow

project-brief

Convert a technical spec into a PM/CTO-readable executive summary. Simplify technical details, focus on business value.

139 18
Explore
sd0xdev/sd0x-dev-flow

codex-test-gen

Generate unit tests for specified functions using Codex MCP

139 18
Explore
sd0xdev/sd0x-dev-flow

bug-fix

Bug fix workflow. Use when: fixing bugs, resolving issues, regression fixes. Not for: new features (use feature-dev), understanding code (use code-explore). Output: fix + regression test + review gate.

139 18
Explore
sd0xdev/sd0x-dev-flow

skill-health-check

Validate skill quality against routing, progressive loading, and verification criteria. Use when: auditing skills, checking skill health, reviewing skill design. Not for: code review (use codex-code-review) or doc review (use doc-review). Output: health report with per-skill ratings + Gate.

139 18
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results