Code Mentor Agent
Adaptive coding mentor that explains concepts at your level, reviews your code, suggests exercises, and guides through debugging
Code Mentor Agent
Adaptive coding mentor that calibrates explanations to your skill level, reviews your code with educational commentary, suggests targeted exercises, and guides you through debugging without simply giving you the answer. Acts as a patient pair-programming partner who prioritizes your understanding over speed, using the Socratic method to build lasting knowledge.
Supported Platforms & Integrations
| Platform | Integration Type | Features |
|---|---|---|
| VS Code | File system access | Review open files, explain code in context, suggest refactors with educational notes |
| GitHub | Repository access | Review PRs with learning-focused comments, explain open-source codebases, analyze commit history patterns |
| LeetCode | Problem descriptions | Guide through algorithm problems with hints (not solutions), explain time/space complexity |
| MDN Web Docs | Reference linking | Link to authoritative documentation when explaining web concepts, APIs, and standards |
| Stack Overflow | Concept reference | Reference common patterns and pitfalls from community knowledge when explaining solutions |
| Exercism | Exercise format | Generate practice exercises in Exercism's format with test cases and mentoring-style hints |
When to Use
- Learning a new language: Get explanations of syntax, idioms, and best practices tailored to languages you already know — "explain Rust ownership like I know JavaScript"
- Code review for learning: Submit your code for review focused on educational value, not just correctness — understand why the suggestion matters
- Debugging guidance: Walk through a bug with guided questions rather than receiving a direct fix, building your debugging intuition
- Algorithm practice: Work through data structure and algorithm problems with progressive hints and complexity analysis
- Understanding codebases: Get guided tours of unfamiliar codebases, explaining architecture patterns, design decisions, and conventions
- Interview preparation coding: Practice coding problems with an interviewer-style mentor who gives hints, evaluates approach, and provides feedback
Alternatives to consider:
- For structured courses with video content and certificates, use platforms like Coursera, Udemy, or freeCodeCamp
- For competitive programming with rankings, use Codeforces or HackerRank directly
- For enterprise team code reviews focused on production quality, use standard code review tools without the educational framing
Quick Start
code_mentor: skill_level: "intermediate" # beginner | intermediate | advanced known_languages: ["javascript", "python"] learning_language: "rust" teaching_style: "socratic" # socratic | direct | visual focus_areas: - "ownership and borrowing" - "pattern matching" - "error handling" exercise_difficulty: "medium" # easy | medium | hard explain_with_analogies: true compare_to_known: true # explain using familiar language concepts
Example prompt:
I'm learning Rust coming from JavaScript. Explain ownership and borrowing
using concepts I already know. Then give me a small exercise to practice.
Example output:
Ownership in Rust — A JavaScript Developer's Guide
In JavaScript, you're used to garbage collection handling memory:
let a = [1, 2, 3]; // JS: array lives until no references exist
let b = a; // JS: b points to same array, both work fine
console.log(a); // JS: still works, GC handles cleanup
In Rust, there's no garbage collector. Instead, ownership rules apply:
let a = vec![1, 2, 3]; // Rust: a OWNS this vector
let b = a; // Rust: ownership MOVES to b
println!("{:?}", a); // Rust: ERROR — a no longer owns the data
Think of it like transferring a physical object. In JS, you're copying
a link to a shared Google Doc. In Rust, you're handing someone a physical
book — once you hand it over, you can't read it anymore.
Borrowing is Rust's way of saying "let me look at your book without
taking it." Using & creates a reference (a borrow):
let a = vec![1, 2, 3];
let b = &a; // b borrows a (read-only)
println!("{:?}", a); // still works — a is just borrowed, not moved
--- Practice Exercise ---
Write a function `longest_string` that takes two string references
and returns the longer one. You'll need to think about:
1. Why does it take references, not owned strings?
2. What happens with the lifetime of the return value?
Try it yourself first. Ask me for a hint if you get stuck.
Advanced Configuration
Skill calibration settings:
calibration: auto_adjust: true # adjust level based on responses assessment_frequency: "every_5" # reassess every 5 interactions known_concepts: # skip explanations for these - "variables and types" - "functions and closures" - "async/await basics" struggle_areas: # spend extra time on these - "type systems" - "memory management" - "concurrency"
Feedback depth configuration:
code_review: detail_level: "thorough" # brief | thorough | exhaustive explain_why: true # explain reasoning, not just what to change show_alternatives: 2 # number of alternative approaches to show highlight_patterns: true # name design patterns when applicable security_review: true # flag security concerns with explanation
Full parameter reference:
| Parameter | Type | Default | Description |
|---|---|---|---|
skill_level | string | intermediate | Your current level: beginner, intermediate, advanced |
known_languages | array | [] | Languages you are comfortable with for analogy-based teaching |
learning_language | string | required | The language or technology you are learning |
teaching_style | string | socratic | Approach: socratic (questions), direct (explanations), visual (diagrams) |
focus_areas | array | [] | Specific topics to prioritize in explanations and exercises |
exercise_difficulty | string | medium | Difficulty of generated practice exercises |
explain_with_analogies | boolean | true | Use real-world analogies to explain abstract concepts |
compare_to_known | boolean | true | Compare new concepts to equivalents in known languages |
max_hints_before_answer | integer | 3 | Number of progressive hints before revealing solution |
include_tests | boolean | true | Generate test cases with exercises |
explain_errors | boolean | true | When reviewing code, explain compiler/runtime errors in plain language |
Core Concepts
| Concept | Description |
|---|---|
| Skill Calibration | The agent continuously assesses your level based on your questions and code. It adjusts explanation depth, vocabulary complexity, and exercise difficulty automatically. |
| Socratic Method | Instead of giving answers directly, the agent asks guiding questions that lead you to discover the answer yourself. This builds deeper understanding than passive reading. |
| Progressive Hints | When you are stuck, hints escalate from vague nudges to specific guidance over 3 stages. You control when to ask for more help, preserving the learning opportunity. |
| Cross-Language Analogies | Concepts are explained by mapping to equivalent features in languages you already know. Rust ownership is explained through JavaScript references; Python decorators through Java annotations. |
| Spaced Repetition | The agent tracks concepts you have learned and revisits them in later exercises to reinforce retention. Concepts you struggled with appear more frequently. |
Code Mentor Interaction Loop
+------------------+
| Student Input |----> Question? ---> Explain with analogies
| (code, question,| and cross-language
| or exercise | comparisons
| attempt) |
+------------------+
| |
v v
Code submitted? Stuck on exercise?
| |
v v
Review with Progressive hints:
educational Hint 1: Direction
commentary: Hint 2: Approach
- What works Hint 3: Near-solution
- What to improve (then full explanation)
- Why it matters
- Alternatives
| |
+--------+ +---------+
v v
Generate next
exercise based
on weak areas
Workflow Examples
Scenario 1: Learning a new language concept
Input: "I'm a Python developer. Explain TypeScript generics to me.
I understand Python type hints but haven't used generics."
Output: TypeScript Generics for Python Developers
You know Python type hints like:
def first(items: list[str]) -> str: # works only for strings
What if you want it to work for any type?
def first(items: list[T]) -> T: # Python uses TypeVar
TypeScript generics are the same idea, cleaner syntax:
function first<T>(items: T[]): T { ... }
The <T> declares a type variable. When you call first<number>([1,2,3]),
TypeScript knows the return type is number.
Quick comparison:
Python: T = TypeVar('T')
TypeScript: <T> (inline, no separate declaration)
Exercise: Write a generic function 'last' that returns the last
element of any array. Then write 'zip' that takes two arrays
of different types and returns pairs.
Scenario 2: Code review for learning
Input: "Review my React component. I'm intermediate level."
[provides component code]
Output: Code Review — Learning Focus
What's working well:
- Clean component structure with props destructuring
- Good use of useState for form state
- Proper key usage in list rendering
Learning opportunities:
1. useEffect dependency array (line 15)
You have: useEffect(() => { fetchData() }, [])
Question: What happens if userId changes after mount?
Think about: Should userId be in the dependency array?
Pattern name: This relates to "stale closure" — a common
React pitfall worth understanding deeply.
2. Inline function creation (line 28)
You have: onClick={() => handleDelete(item.id)}
This creates a new function every render. For a list of 5
items, it's fine. For 500? Let's discuss useCallback.
Question: Can you think of when this optimization matters
and when it's premature?
3. Error handling (missing)
Your fetchData has no try/catch. Question: What does
the user see if the API call fails right now?
Scenario 3: Guided debugging session
Input: "My function returns undefined sometimes. Help me debug it
but don't just give me the fix."
[provides code]
Output: Let's debug this together.
Step 1 — Reproduce the problem:
Question: Can you identify which input values cause the
undefined return? Try these test cases:
fn(5) -> ?
fn(0) -> ?
fn(-3) -> ?
fn(null) -> ?
Step 2 — Trace the execution:
Look at line 8: your if/else chain.
Question: What happens when the input is exactly 0?
Does it match any of your conditions?
Hint (if needed): There's a gap in your conditional logic.
The conditions handle > 0 and < 0. What about === 0?
This is a common bug pattern called "incomplete case handling."
A good practice is to always have a default/else clause
or explicitly handle edge cases at the top of the function.
Try fixing it yourself, then I'll review your solution.
Best Practices
-
State what you already know: The more context you provide about your current understanding, the better the explanations will be calibrated. Saying "I understand closures but not generators" is more useful than "I know some JavaScript."
-
Try before asking for hints: When working on exercises, make at least one genuine attempt before requesting a hint. The struggle itself is where learning happens — the mentor is most valuable when you have specific confusion, not general uncertainty.
-
Ask why, not just how: When you receive a code review suggestion, ask "why does this matter?" or "what happens if I don't do this?" Understanding the reasoning behind best practices creates transferable knowledge, not just recipe-following.
-
Practice in your own projects: Apply concepts immediately to your real projects, not just isolated exercises. The context of your own codebase provides motivation and reveals practical nuances that exercises cannot.
-
Review previous sessions before starting new ones: Revisit concepts from earlier mentoring sessions to reinforce retention. If you do not remember why ownership matters in Rust, revisit that explanation before moving to lifetimes.
Common Issues
Explanations feel too basic or too advanced
Explicitly set your skill_level and list known_concepts in the configuration. The auto-calibration works best after several interactions, but initial configuration prevents the first few exchanges from being misaligned.
Exercises are not challenging enough
Increase exercise_difficulty to hard and add specific focus areas. Hard exercises require combining multiple concepts and handling edge cases. You can also request "production-style" exercises that involve refactoring real-world code patterns.
Getting stuck in hint loops without progressing If you have exhausted all 3 progressive hints and still cannot solve the exercise, ask for the full solution with explanation. There is no shame in seeing the answer when you have genuinely tried — the detailed walkthrough of the solution is itself a valuable learning experience.
Privacy & Data Handling
- Code stays local: All code you share for review is processed in the current session only. Your code files are read from your local filesystem and are not stored or transmitted to third parties.
- No progress tracking externally: Skill calibration and learning progress are maintained within your local configuration and session context. No learning analytics are sent to external services.
- Exercise solutions are not stored: When you complete exercises, your solutions are reviewed in-session only. There is no persistent database of your attempts.
- Safe for proprietary code: You can review work code without concern — the mentor operates entirely locally with no data leaving your machine.
- Session isolation: Each mentoring session starts fresh unless you explicitly provide context from previous sessions via your configuration file.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
API Endpoint Builder
Agent that scaffolds complete REST API endpoints with controller, service, route, types, and tests. Supports Express, Fastify, and NestJS.
Documentation Auto-Generator
Agent that reads your codebase and generates comprehensive documentation including API docs, architecture guides, and setup instructions.
Ai Ethics Advisor Partner
All-in-one agent covering ethics, responsible, development, specialist. Includes structured workflows, validation checks, and reusable patterns for ai specialists.