REQUIRED Phase 2 of /dev workflow after dev-brainstorm. This skill should be used when you need to 'explore the codebase', 'map architecture', 'find similar features', 'discover test infrastructure', 'trace execution paths', 'identify code patterns', or understand WHERE code lives and HOW it works before implementation. Launches parallel explore agents and returns prioritized key files list.
/plugin marketplace add edwinhu/workflows/plugin install workflows@edwinhu-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/ast-grep-patterns.mdAnnounce: "I'm using dev-explore (Phase 2) to map the codebase."
Map relevant code, trace execution paths, and return prioritized files for reading.
Prerequisite: .claude/SPEC.md must exist with draft requirements.
RETURN KEY FILES LIST. This is not negotiable.
Every exploration MUST return:
After agents return, main chat MUST read all key files before proceeding.
If you catch yourself about to move on without reading the key files, STOP. </EXTREMELY-IMPORTANT>
| DO | DON'T |
|---|---|
| Trace execution paths | Ask user questions (that's clarify) |
| Map architecture layers | Design approaches (that's design) |
| Find similar features | Write implementation tasks |
| Identify patterns and conventions | Make architecture decisions |
| Return key files list | Skip reading key files |
Explore answers: WHERE is the code and HOW does it work Design answers: WHAT approach to take (separate skill)
Use run_in_background: true for ALL explore agents.
This enables true parallel execution:
Pattern from oh-my-opencode: Default to background + parallel for exploratory work. </EXTREMELY-IMPORTANT>
Based on .claude/SPEC.md, spawn 3-5 agents with different focuses:
# PARALLEL + BACKGROUND: All Task calls in ONE message
Task(
subagent_type="Explore",
description="Find similar features",
run_in_background=true,
prompt="""
Explore the codebase for [FEATURE AREA].
Focus: Find similar features to [SPEC REQUIREMENT]
Use ast-grep for semantic search:
- sg -p 'function_name($$$)' --lang [language]
- sg -p 'class $NAME { $$$ }' --lang [language]
Tasks:
- Trace execution paths from entry point to data storage
- Find similar implementations to follow
- Identify patterns used
- Return 5-10 key files with line numbers
Context from SPEC.md:
[paste relevant requirements]
""")
Task(
subagent_type="Explore",
description="Map architecture layers",
run_in_background=true,
prompt="""
Explore the codebase for [FEATURE AREA].
Focus: Map architecture and abstractions for [AREA]
Use ast-grep for semantic search:
- sg -p 'class $NAME($BASE):' --lang [language]
- sg -p 'interface $NAME { $$$ }' --lang [language]
Tasks:
- Identify abstraction layers
- Find cross-cutting concerns (logging, auth, errors)
- Map module dependencies
- Return 5-10 key files with line numbers
Context from SPEC.md:
[paste relevant requirements]
""")
Task(
subagent_type="Explore",
description="Find test infrastructure",
run_in_background=true,
prompt="""
Explore the codebase for [FEATURE AREA].
Focus: Test infrastructure and patterns
Use ast-grep for test discovery:
- sg -p 'def test_$NAME($$$):' --lang python
- sg -p 'it($DESC, $$$)' --lang javascript
- sg -p '@pytest.fixture' --lang python
Tasks:
- Find test directory and framework
- Identify existing test patterns
- Check for fixtures, mocks, helpers
- Return 5-10 key test files with line numbers
Context from SPEC.md:
[paste relevant requirements]
""")
After launching all agents in parallel:
/tasks commandOnce agents complete, collect their findings:
# Check running tasks
/tasks
# Get results from completed agents
TaskOutput(task_id="task-abc123", block=true, timeout=30000)
TaskOutput(task_id="task-def456", block=true, timeout=30000)
TaskOutput(task_id="task-ghi789", block=true, timeout=30000)
Stop Conditions (from oh-my-opencode):
DO NOT over-explore. Time is precious.
After all agents return, consolidate their key files lists:
CRITICAL: Main chat must read every file on the key files list.
Read(file_path="src/auth/login.ts")
Read(file_path="src/services/session.ts")
...
This builds deep understanding before asking clarifying questions.
Write exploration summary (can be verbal or in .claude/EXPLORATION.md):
Prefer semantic search over text search when exploring code.
Use ast-grep (sg) for precise AST-based pattern matching and ripgrep-all (rga) for searching non-code files.
For detailed patterns and usage, see: references/ast-grep-patterns.md
REAL automated tests EXECUTE code and verify RUNTIME behavior. Grepping source files is NOT testing. Log checking is NOT testing.
| ✅ REAL TEST INFRASTRUCTURE | ❌ NOT TESTING (never acceptable) |
|---|---|
| pytest that calls functions | grep/ast-grep to find code |
| Playwright that clicks buttons | Reading logs for "success" |
| ydotool that simulates user input | Code review / structure check |
| API calls that verify responses | "It looks correct" |
If you can't find a way to EXECUTE and VERIFY, flag this as a blocker. </EXTREMELY-IMPORTANT>
# Find test directory and framework
ls -d tests/ test/ spec/ __tests__/ 2>/dev/null
cat meson.build 2>/dev/null | grep -i test
cat package.json 2>/dev/null | grep -E "(test|jest|mocha|vitest)"
cat pyproject.toml 2>/dev/null | grep -i pytest
cat Cargo.toml 2>/dev/null | grep -i "\[dev-dependencies\]"
# Find existing tests that EXECUTE code
find . -name "*test*" -type f | head -20
| What to Test | Tool | How It's a REAL Test |
|---|---|---|
| Functions | pytest, jest, cargo test | Calls function, checks return value |
| CLI | subprocess, execa | Runs binary, checks output |
| Web UI | Playwright MCP | Clicks button, verifies DOM |
| Desktop UI | ydotool + grim | Simulates input, screenshots result |
| API | requests, fetch | Sends request, checks response |
| D-Bus apps | dbus-send | Invokes method, checks return |
# Desktop automation (Wayland)
which ydotool grim dbus-send 2>/dev/null
# Check for D-Bus interfaces (desktop apps)
dbus-send --session --print-reply --dest=org.freedesktop.DBus \
/org/freedesktop/DBus org.freedesktop.DBus.ListNames 2>/dev/null | grep -i appname
REQUIRED findings for SPEC.md:
Each agent MUST return files in this format:
## Key Files to Read
| Priority | File:Line | Purpose |
|----------|-----------|---------|
| 1 | `src/auth/login.ts:45` | Entry point for auth flow |
| 2 | `src/services/session.ts:12` | Session management |
| 3 | `src/middleware/auth.ts:78` | Auth middleware |
| 4 | `src/types/user.ts:1` | User type definitions |
| 5 | `tests/auth/login.test.ts:1` | Existing test patterns |
| Action | Why It's Wrong | Do Instead |
|---|---|---|
| Skip reading key files | You'll miss crucial context | Read every file on the list |
| Ask design questions | Exploration is about understanding | Save for clarify/design phases |
| Propose approaches | Too early for decisions | Just document what exists |
| Start implementing | Must understand first | Complete exploration fully |
Exploration complete when:
REQUIRED SUB-SKILL: After completing exploration, IMMEDIATELY invoke:
Skill(skill="workflows:dev-clarify")
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.