Get the FREE Ultimate OpenClaw Setup Guide →

learn-review

Scanned
npx machina-cli add skill charlesjones-dev/claude-code-plugins-dev/learn-review --openclaw
Files (1)
SKILL.md
4.1 KB

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.

Source

git clone https://github.com/charlesjones-dev/claude-code-plugins-dev/blob/main/plugins/ai-learn/skills/learn-review/SKILL.mdView on GitHub

Overview

This skill reviews your code using the Socratic method, with Claude guiding you through questions that surface issues, edge cases, and design decisions. It prioritizes learning and self-discovery over direct fixes, helping you reason about code changes more deeply.

How This Skill Works

You paste code and Claude responds with targeted questions aligned to intent, logic, edge cases, and design choices. Through structured prompts - understand intent, trace logic, probe edge cases, and assess decisions, you gradually reveal issues and learn how to improve the code.

When to Use It

  • When you want to learn from your code rather than receive fixes
  • When you need to verify intent and inputs/outputs before refactoring
  • When you’re preparing for a peer review and prefer a question-based critique
  • When you’re teaching debugging by fostering reflective reasoning
  • When you want to surface edge cases and failure modes without being told what’s wrong

Quick Start

  1. Step 1: Paste the code you want reviewed.
  2. Step 2: Claude asks guiding questions to surface issues.
  3. Step 3: Answer the questions and reflect on the rationale to surface improvements.

Best Practices

  • Start by clarifying intent and expected inputs/outputs
  • Ask open-ended questions before pointing out issues
  • Walk through concrete input scenarios to reveal edge cases
  • Explain the rationale behind design decisions and trade-offs
  • Use the outcomes to guide self-assessment and learning

Example Use Cases

  • Review a function that parses user input for special cases (empty input, malformed data)
  • Review an API handler that validates requests and handles error states
  • Review a data transformation that filters and maps records to a schema
  • Review a sorting/deduplication routine to ensure stability and performance
  • Review retry/backoff logic in a network client for concurrency and failure handling

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers