一键导入
explain-code
Analyze and explain complex code sections in any programming language with clear, comprehensive explanations.
菜单
Analyze and explain complex code sections in any programming language with clear, comprehensive explanations.
ローカル ~/.claude/ 配下の Claude Code 設定 (CLAUDE.md, settings.json, mcp.json, agents/, hooks/, rules/, skills/) を、ansible が管理する terakoya76-playbooks リポジトリの roles/dotfiles/files/claude/ にミラーする。「ansible に反映」「claude config を sync」「dotfiles に取り込み」等と依頼されたとき、あるいは local で skill / agent / settings を更新した直後に使う。
Check diffs and commit with conventional commits guidelines. No co-authored or generated-by lines.
Use sequential-thinking MCP for problem solving and error fixing with ultrathink reasoning. Considers edge cases and best practices. Runs security review after code changes.
Multi-agent problem solving with architect and planner subagents for medium complexity tasks.
Initiate refactor-cleaner subagent to safely identify and remove dead code with test verification.
Initiate bug-reproducer subagent to create reproducing cases and narrow down to minimal reproduction.
| name | explain-code |
| description | Analyze and explain complex code sections in any programming language with clear, comprehensive explanations. |
| allowed-tools | Read, Glob, Grep |
Analyze and explain complex code sections in any programming language with clear, comprehensive explanations.
Follow this systematic approach to explain code: $ARGUMENTS
Code Context Analysis
High-Level Overview
Code Structure Breakdown
Line-by-Line Analysis
Algorithm and Logic Explanation
Data Structures and Types
Framework and Library Usage
Error Handling and Edge Cases
Performance Considerations
Security Implications
Testing and Debugging
Dependencies and Integrations
Explanation Format Examples:
For Complex Algorithms:
This function implements a depth-first search algorithm:
1. Line 1-3: Initialize a stack with the starting node and a visited set
2. Line 4-8: Main loop - continue until stack is empty
3. Line 9-11: Pop a node and check if it's the target
4. Line 12-15: Add unvisited neighbors to the stack
5. Line 16: Return null if target not found
Time Complexity: O(V + E) where V is vertices and E is edges
Space Complexity: O(V) for the visited set and stack
For API Integration Code:
This code handles user authentication with a third-party service:
1. Extract credentials from request headers
2. Validate credential format and required fields
3. Make API call to authentication service
4. Handle response and extract user data
5. Create session token and set cookies
6. Return user profile or error response
Error Handling: Catches network errors, invalid credentials, and service unavailability
Security: Uses HTTPS, validates inputs, and sanitizes responses
For Database Operations:
This function performs a complex database query with joins:
1. Build base query with primary table
2. Add LEFT JOIN for related user data
3. Apply WHERE conditions for filtering
4. Add ORDER BY for consistent sorting
5. Implement pagination with LIMIT/OFFSET
6. Execute query and handle potential errors
7. Transform raw results into domain objects
Performance Notes: Uses indexes on filtered columns, implements connection pooling
Common Patterns and Idioms
Potential Improvements
Related Code and Context
Debugging and Troubleshooting
Language-Specific Considerations:
JavaScript/TypeScript:
Python:
Java:
C#:
Go:
Rust:
Remember to: