code-explain
Explain code logic, triage incoming changes, or map the project architecture.
Process
-
Identify context:
- If code changes are involved: run
jj diff -sfirst to see changed files - If the user specified specific files or paths, focus on those
- If code changes are involved: run
-
Determine goal:
- Explain: User wants to understand existing code
- Triage: User wants to understand/assess a diff
- Map: User wants a high-level overview of the project structure
-
Execute based on goal:
Explain:
- Read the relevant files to understand the code
- Lookup documentation for libraries/frameworks used (use WebSearch/WebFetch)
- Identify patterns and data flow
- Synthesize: Purpose, How it works, Patterns, Dependencies, Gotchas
Triage:
- Skim relevant diffs
- Identify: Areas touched, Risk hotspots, Review order
Map:
- Analyze the directory structure and imports
- Create a high-level dependency graph and module breakdown
- Identify: Key Entry Points, Core Domain Logic, Infrastructure/Adapters
Output
For Explanation:
- Purpose & Mechanics
- Patterns & Dependencies
- Gotchas
For Triage:
- Change Summary
- Risk Hotspots
- Suggested Review Order
For Map:
- High-Level Diagram (Mermaid or Text tree)
- Key Modules & Responsibilities
- Data Flow Overview
More from sirn/dotfiles
code-plan
Generate comprehensive implementation plan based on analysis. Use when user asks to plan this, create a plan, how should I implement, or wants implementation guidance.
19code-commit
Commit current changes using jj. Analyzes changes, suggests commit messages following repository conventions, proposes splits if needed, and creates commits. Use ONLY when user explicitly asks to commit changes or create commits.
18gemini-reference
Reference for calling the Gemini CLI agent from other agents. ALWAYS read BEFORE invoking Gemini to ensure correct JSON protocol, session management, and subtask delegation patterns.
18code-quality
Run comprehensive quality checks by orchestrating review, verification, testing, and linting. Use when user asks to check code quality, run full checks, or verify code health.
18context7
Retrieve up-to-date documentation context for libraries using the Context7 API. Use when needing current library documentation (React, Python stdlib, Rust, etc.) BEFORE implementing or writing code.
17code-setup-project
Sets up project development environment (wrapper scripts and/or Nix flake). Use when user wants to set up a development environment, create wrapper scripts, or add a Nix flake.
17