/explain-code
Explain code behavior in detail. Trigger with "explain this code", "what does this do?", "how does this work?", "what is this function for?", "explain the logic".
$ npx -y skills add wasabeef/claude-code-cookbook --skill explain-code --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/explain-code
Context preview
The summary Claude sees to decide when to auto-load this skill.
Explain code behavior in detail. Trigger with "explain this code", "what does this do?", "how does this work?", "what is this function for?", "explain the logic".
SKILL.md
explain-code.SKILL.mddescription: 'Explain code behavior in detail. Trigger with "explain this code", "what does this do?", "how does this work?", "what is this function for?", "explain the logic".'
allowed-tools:
- Read
- Grep
Explain code behavior in detail
Explains how code works in detail.
Usage
# Show a file and ask for explanation
cat <file>
"Explain how this code works"
Basic Examples
# Understand Rust ownership
cat main.rs
"Explain the ownership and lifetimes in this Rust code"
# Explain an algorithm
grep -A 50 "quicksort" sort.rs
"How does this sorting work? What's its time complexity?"
# Explain design patterns
cat factory.rs
"What design pattern is this? What are the benefits?"
Collaboration with Claude
# Beginner-friendly explanation
cat complex_function.py
"Explain this code line by line for someone new to programming"
# Performance check
cat algorithm.rs
"Find performance problems and how to fix them"
# Visual explanation
cat state_machine.js
"Show me the flow with ASCII diagrams"
# Security check
cat auth_handler.go
"What security issues do you see?"
Detailed Examples
# Complex logic breakdown
cat recursive_parser.rs
"Break down this recursive parser:
1. How does it flow?
2. What does each function do?
3. How are edge cases handled?
4. What could be better?"
# Async code explanation
cat async_handler.ts
"Explain this async code:
1. How do the Promises flow?
2. How are errors handled?
3. What runs in parallel?
4. Could this deadlock?"
# Architecture overview
ls -la src/ && cat src/main.rs src/lib.rs
"Explain how this project is structured"
What You'll Get
Not just what the code does, but also:
- Why it's written that way
- What benefits it provides
- What problems might come up
Read more
description: 'Explain code behavior in detail. Trigger with "explain this code", "what does this do?", "how does this work?", "what is this function for?", "explain the logic".' allowed-tools: - Read - Grep
Explain code behavior in detail
Explains how code works in detail.
Usage
# Show a file and ask for explanation cat <file> "Explain how this code works"
Basic Examples
# Understand Rust ownership cat main.rs "Explain the ownership and lifetimes in this Rust code" # Explain an algorithm grep -A 50 "quicksort" sort.rs "How does this sorting work? What's its time complexity?" # Explain design patterns cat factory.rs "What design pattern is this? What are the benefits?"
Collaboration with Claude
# Beginner-friendly explanation cat complex_function.py "Explain this code line by line for someone new to programming" # Performance check cat algorithm.rs "Find performance problems and how to fix them" # Visual explanation cat state_machine.js "Show me the flow with ASCII diagrams" # Security check cat auth_handler.go "What security issues do you see?"
Detailed Examples
# Complex logic breakdown cat recursive_parser.rs "Break down this recursive parser: 1. How does it flow? 2. What does each function do? 3. How are edge cases handled? 4. What could be better?" # Async code explanation cat async_handler.ts "Explain this async code: 1. How do the Promises flow? 2. How are errors handled? 3. What runs in parallel? 4. Could this deadlock?" # Architecture overview ls -la src/ && cat src/main.rs src/lib.rs "Explain how this project is structured"
What You'll Get
Not just what the code does, but also:
- Why it's written that way
- What benefits it provides
- What problems might come up
A collection of commands, roles, and automation scripts for Claude Code. Automate your workflow without unnecessary confirmations, allowing you to focus on what matters.
Repo: wasabeef/claude-code-cookbook
Other skills on claude-code-cookbook.
- /analyze-dependencies
Analyze project dependencies and evaluate architectural health. Trigger with "analyze dependencies", "detect circular dependencies", "architecture issues?", "check module coupling", "find layer violations". Generates dependency matrix, fan-in/fan-out analysis, and prioritized
Open skill - /analyze-performance
Performance analysis based on Core Web Vitals with UX scoring. Trigger with "analyze performance", "improve speed", "check Core Web Vitals", "page speed", "improve LCP", "identify performance issues".
Open skill - /check-fact
Verify information accuracy against codebase and documentation. Trigger with "is this correct?", "fact check", "verify this", "is this accurate?".
Open skill - /check-prompt
Evaluate and improve AI prompt quality. Trigger with "check this prompt", "evaluate prompt quality", "improve this prompt".
Open skill - /commit-message
Generate commit messages from staged changes. Trigger with "suggest commit message", "generate commit message", "what should the commit say?", "write commit message".
Open skill - /context7
Search technical documentation via Context7 MCP. Trigger with "check the docs", "look up documentation", "how to use this library?", "API reference".
Open skill

