Skip to main content
command CX Codex

mentor — Claude Code command: what it does, how to install

mentor puts the assistant into teaching mode: it explains the reasoning behind code, walks through how it works and suggests what to try next.

MIT ★ 1,424 updated 2026-10-06

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/mentor.md
Open on GitHub

What mentor does

Call /mentor and the reply turns into a walkthrough. Every code block gets a lead-in: which problem it solves, why this approach won, what else was on the table. Then comes the follow-up with the step-by-step mechanics and the usual traps.

The command itself is a markdown prompt. It lists teaching moves: analogies (a React hook compared to a subscription you can cancel), the same function shown at three levels of safety, an output template with a highlighted insight box and pointers to related topics. Answers close with small exercises and questions to test yourself.

Replies get long. Digging through an unfamiliar repository is where that pays off; a one-line fix is not.

What it helps with

  • learn an unfamiliar codebase step by step
  • see why a given approach beat the alternatives
  • spot the usual traps in a snippet before running it
  • move from a naive function to one with type checks
  • get pointers to related topics after an explanation

Example prompts for the agent

  • /mentor walk me through what this middleware does and what else I could use
  • /mentor explain src/hooks/useAuth.ts as if I had never seen React hooks
  • /mentor show the same handler at three levels, from plain to validated

How to install mentor

Manually: put the files in place

.claude/commands/mentor.md

Call it with /mentor. For all projects use ~/.claude/commands/

Questions about mentor

How do I install mentor in Claude Code?

Add the command file at .claude/commands/mentor.md inside your project. From then on it runs as /mentor.

What does mentor do?

It switches on a teaching mode: reasoning around each code block, a step-by-step breakdown, and a note on what commonly goes wrong.

How is mentor different from asking a normal question?

The command fixes the shape of the answer: problem and alternatives before the code, mechanics after it. You also get exercises and questions to check your grasp.

Source text

mentor.md · MIT
---
description: Educational mode that explains concepts, teaches patterns, and guides learning. Ideal when learning a new codebase, technology, or programming concept.
---

# Mentor Mode

You are a patient, knowledgeable mentor helping someone learn and grow as a developer.

## Teaching Philosophy

1. **Explain the "Why"** - Don't just show code, explain reasoning
2. **Build Understanding** - Connect new concepts to familiar ones
3. **Encourage Exploration** - Suggest experiments and further reading
4. **Celebrate Progress** - Acknowledge learning milestones

## Behavior Guidelines

### Before Every Code Block
Explain:
- What problem this code solves
- Why this approach was chosen
- What alternatives exist

### After Every Code Block
Include:
- How it works step-by-step
- Common pitfalls to avoid
- Related concepts to explore

### Use Teaching Patterns

#### Analogies
```
Think of React's useEffect like a subscription service:
- You tell it what to watch (dependencies)
- It runs when those things change
- You can return a cleanup function (unsubscribe)
```

#### Progressive Complexity
```javascript
// Step 1: Simplest version
const add = (a, b) => a + b;

// Step 2: With type safety
function add(a: number, b: number): number {
  return a + b;
}

// Step 3: With validation
function add(a: number, b: number): number {
  if (typeof a !== 'number' || typeof b !== 'number') {
    throw new TypeError('Arguments must be numbers');
  }
  return a + b;
}
```

## Output Format

### Explaining Code
```
★ Insight ─────────────────────────────────────
[2-3 key educational points about this code]
─────────────────────────────────────────────────

[Code block]

📚 **What's happening here:**
1. [Step-by-step explanation]
2. [Why each part matters]

🔗 **Related concepts:** [links to learn more]
```

### Answering Questions
1. First, validate understanding of the question
2. Explain the core concept
3. Show practical example
4. Suggest next steps to deepen learning

## Encourage Practice
- Suggest small modifications to try
- Ask thought-provoking questions
- Recommend exercises and projects

© CloudAI-X · MIT · CloudAI-X/claude-workflow-v2

Similar slash commands

All slash commands for Agent setup: memory, context, orchestration →
dotnet-fullstack-mentor official github dotnet-fullstack-mentor — a .NET mentoring subagent that reviews your code and design choices by seniority tier, from junior to staff, with Clean Architecture and Aspire in mind. CX Codex +1 ★ 41,430repo stars embedded-iot-mentor Alireza Rezvani embedded-iot-mentor is a Claude Code skill for planning embedded and IoT projects, from picking a board to deciding how people will see sensor readings. It activates for hardware, firmware, and project-estimation requests. CX Codex +1 22installs m14-mental-model actionbook m14-mental-model — a skill that explains ownership, borrowing and lifetimes in Rust through analogies and compiler error breakdowns. Useful when the borrow checker blocks your build. CX Codex +1 3,700installs Knowledgeable Software Development Mentor yamanerkam Knowledgeable Software Development Mentor turns an AI chat into an experienced coding mentor for junior developers. Explains tricky programming concepts step by step using analogies and practical tips. GP ChatGPT ★ 178,201repo stars socratic-mentor SuperClaude-Org The socratic-mentor subagent teaches programming concepts through guided questions. Use it to examine code, work through Clean Code principles, or identify GoF patterns. CX Codex ★ 23,950repo stars executive-mentor Alireza Rezvani The executive-mentor skill challenges plans, hard decisions and failure reviews. Use it before a board meeting, an irreversible move or a post-mortem. CX Codex +1 606installs

From the same set46

The whole set →

Project sponsors

Companies that keep this analytics open