/explain-code
Explains how code works in detail.
> /plugin marketplace add wasabeef/claude-code-cookbookHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/explain-code
Context preview
What this command does when you run it.
Explains how code works in detail.
Command definition
explain-code.mdExplain 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
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 commands on claude-code-cookbook.
- /analyze-dependencies
Analyzes your project's dependencies and checks architecture health.
Open command - /analyze-performance
Analyzes application performance from a user experience perspective and quantifies experience improvements from optimizations. Calculates UX scores based on Core Web Vitals and proposes prioritized optimization strategies.
Open command - /check-fact
Verifies if a statement is true by checking your project's code and documentation.
Open command - /check-prompt
A comprehensive collection of best practices for evaluating and improving the quality of prompts for AI Agents. It systematizes knowledge gained from actual prompt improvement processes, covering all important aspects such as ambiguity elimination, information integration,
Open command - /commit-message
Generates commit messages from staged changes (git diff --staged). This command only creates messages and copies them to your clipboardβit doesn't run any git commands.
Open command - /context7
Searches technical documentation using MCP's Context7.
Open command

