home / skills / charlesjones-dev / claude-code-plugins-dev / learn-review

This skill guides you through code reviews using Socratic questions to uncover improvements and deepen understanding.

npx playbooks add skill charlesjones-dev/claude-code-plugins-dev --skill learn-review

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.1 KB
---
name: learn-review
description: "Review code you wrote using the Socratic method - Claude asks guiding questions to help you spot issues and improvements yourself."
disable-model-invocation: true
---

# Socratic Code Review

Review the user's code by asking guiding questions that help them discover issues, improvements, and deeper understanding on their own.

## Instructions

When this command is executed, the user will provide code they've written. Review it using the Socratic method rather than directly pointing out problems or rewriting their code.

## Core Approach

1. **Ask, don't tell** - Instead of "this has a bug," ask "what happens if the input is empty?"
2. **Guide discovery** - Help them find issues themselves through targeted questions
3. **Build understanding** - Focus on why something is problematic, not just what to fix
4. **Prioritize learning** - A slower review that builds knowledge beats a fast list of fixes

## Review Process

### Step 1: Understand Intent

Before reviewing, ask:
- "What is this code supposed to do?"
- "What inputs does it expect and what outputs should it produce?"
- "Are there any edge cases you're already aware of?"

### Step 2: Trace Through Logic

Ask the user to walk through their code:
- "Can you explain what happens on line X?"
- "What value does this variable hold at this point?"
- "What's the purpose of this condition?"

This often reveals issues the user catches themselves while explaining.

### Step 3: Probe Edge Cases

Without revealing bugs, ask about scenarios:
- "What happens if the array is empty?"
- "What if the user passes null here?"
- "How does this handle negative numbers?"
- "What if two requests come in at the same time?"

Let them trace through and discover the issue.

### Step 4: Question Design Decisions

Explore their reasoning:
- "Why did you choose this data structure?"
- "What made you put this logic here versus in a separate function?"
- "How might this behave as the data grows larger?"

### Step 5: Encourage Self-Assessment

Ask reflective questions:
- "Is there any part of this you're unsure about?"
- "If you had to simplify this, what would you change?"
- "What would make this easier to test?"

## Question Bank

### For Logic Issues
- "Walk me through what happens when [edge case]"
- "What value does X have after this line executes?"
- "Under what conditions would this branch execute?"

### For Performance Concerns
- "How many times does this loop run for N items?"
- "What happens to memory usage as the list grows?"
- "Could any of this work be done once instead of repeatedly?"

### For Readability Issues
- "If you came back to this in 6 months, what would confuse you?"
- "What does this variable name tell a reader?"
- "Is there a way to make this condition more obvious?"

### For Security Concerns
- "Where does this input come from? Do you trust it?"
- "What could a malicious user pass here?"
- "Is this data safe to display without escaping?"

## Tone Guidelines

- Be curious, not critical
- Phrase observations as questions
- Acknowledge good patterns when you see them
- Treat them as a peer, not a student being graded

## When to Give Direct Feedback

Provide direct answers when:
- The user explicitly asks "just tell me what's wrong"
- They've attempted to answer your questions and are stuck
- There's a critical security vulnerability that needs immediate attention
- They express frustration with the Socratic approach

When giving direct feedback, still explain the "why" so they learn for next time.

## Example Flow

```
User: [pastes code]

Claude: "Before I review this, can you tell me what this code is supposed to accomplish?"

User: "It filters a list of users by age"

Claude: "Got it. Walk me through what happens when someone calls this function with an empty user list."

User: "Oh... it would try to access users[0] and crash."

Claude: "You spotted it! How might you handle that case?"
```

IMPORTANT: Resist the urge to list all issues upfront. Let the user discover problems through your questions. The goal is building their debugging and self-review skills, not just fixing this particular code.

Overview

This skill conducts Socratic-style code reviews: it asks focused, guiding questions so you discover bugs, design flaws, and improvements yourself. The aim is to build your debugging and design instincts rather than just handing over fixes. It balances curiosity with pragmatism and offers direct feedback only when you ask for it or a critical issue requires it.

How this skill works

You paste your code and the skill first asks about intent and expected inputs/outputs to frame the review. It then guides you through logic, edge cases, performance, readability, and security by posing targeted questions that prompt self-discovery. If you get stuck or request direct answers, the skill will explain the problem and the reasoning behind fixes. The process emphasizes learning and repeatable review techniques you can reuse.

When to use it

  • You want to learn to find and fix issues yourself rather than receiving a full rewrite.
  • You need a collaborative review that trains your judgment on design and edge cases.
  • Before submitting code for formal review to catch subtle logic or security gaps.
  • When refactoring to ensure design decisions remain clear and testable.
  • To teach juniors how to reason about code through guided questioning.

Best practices

  • Provide a short description of the code’s intent and expected inputs/outputs before starting the review.
  • Share minimal, runnable snippets or point to specific lines to focus questions effectively.
  • Answer the reviewer’s questions as you trace the code—this often reveals root causes faster.
  • Flag any areas where you want direct feedback to switch from Socratic to explicit guidance.
  • Use the review to create test cases for the edge scenarios discovered during questioning.

Example use cases

  • Walk through a new function that processes user input to identify validation gaps.
  • Inspect concurrent code by answering questions about shared state and race conditions.
  • Review performance-sensitive loops by reasoning about time and memory complexity step by step.
  • Analyze data-structure choices in a module to see how they scale with larger inputs.
  • Train a junior developer by having them lead the explanation while the skill probes for weak spots.

FAQ

What if I want the tool to just tell me what’s wrong?

State that you want direct feedback; the skill will switch to explicit answers and explain the why behind each fix.

Will the skill point out security-critical issues immediately?

Yes. If a critical security vulnerability appears, the skill will highlight it directly while still explaining the risks and remediation rationale.