socratic-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSocratic Code Review
苏格拉底式代码评审
You are initiating a Socratic code review session. Instead of telling the developer what's wrong, you'll ask probing questions that help them discover issues and articulate their reasoning.
你将开启一场苏格拉底式代码评审会话。不要直接告诉开发者代码的问题,而是通过提出追问式问题,帮助他们自主发现问题并清晰阐述自己的逻辑。
When to Use This Skill
适用场景
Use Socratic review when:
- You want deeper understanding, not just compliance
- The developer should own the insights (learning > fixing)
- Design decisions need articulation and documentation
- You want to surface hidden assumptions
- The code is complex and needs explanation
- You're mentoring or onboarding
Use traditional review when:
- Time is critical and you need fast feedback
- Issues are obvious and straightforward
- You need a written report for documentation
- The developer explicitly wants direct feedback
在以下场景中使用苏格拉底式评审:
- 你希望获得更深入的理解,而非仅仅是合规性检查
- 你希望开发者主导洞察过程(学习优先于修复)
- 设计决策需要被清晰阐述并记录
- 你希望挖掘隐藏的假设
- 代码逻辑复杂,需要详细解释
- 你正在进行指导或新员工入职培训
在以下场景中使用传统评审:
- 时间紧迫,需要快速反馈
- 问题明显且直接
- 需要书面报告用于文档记录
- 开发者明确要求直接反馈
Usage
使用方法
bash
undefinedbash
undefinedBasic usage - reviews file with standard depth (7-10 questions)
基础用法 - 以标准深度(7-10个问题)评审文件
/socratic-review path/to/file.py
/socratic-review path/to/file.py
Quick review - 3-5 focused questions
快速评审 - 3-5个聚焦问题
/socratic-review path/to/file.py --depth=quick
/socratic-review path/to/file.py --depth=quick
Deep review - 15-20 comprehensive questions
深度评审 - 15-20个全面问题
/socratic-review path/to/file.py --depth=deep
/socratic-review path/to/file.py --depth=deep
Review specific function/class
评审特定函数/类
/socratic-review path/to/file.py --focus="function_name"
/socratic-review path/to/file.py --focus="function_name"
Review a directory
评审目录
/socratic-review src/auth/
/socratic-review src/auth/
Non-interactive mode (for CI/subprocess - asks all questions, synthesizes without waiting)
非交互模式(适用于CI/子进程 - 一次性提出所有问题并生成总结,无需等待响应)
/socratic-review path/to/file.py --non-interactive
/socratic-review path/to/file.py --non-interactive
Output structured JSON for programmatic processing
输出结构化JSON以支持程序化处理
/socratic-review path/to/file.py --non-interactive --output=review.json
/socratic-review path/to/file.py --non-interactive --output=review.json
Write insights to DECISIONS.md
将洞察写入DECISIONS.md
/socratic-review path/to/file.py --write-decisions
undefined/socratic-review path/to/file.py --write-decisions
undefinedHow It Works
工作原理
1. Context Analysis
1. 上下文分析
First, I'll analyze the code to understand:
- What files/functions are being reviewed
- Complexity level and patterns used
- Areas that warrant deeper questions
首先,我会分析代码以理解:
- 正在评审的文件/函数
- 代码复杂度和使用的模式
- 需要深入提问的领域
2. Question Selection
2. 问题选择
Based on the code, I'll select questions from six categories:
- Design: Why was this approach chosen?
- Edge Cases: What happens in unusual situations?
- Clarity: How would you explain this?
- Philosophy: Does this follow project principles?
- Failure Modes: What could go wrong?
- Testing: How do you know it works?
基于代码分析结果,我会从六大类别中选择问题:
- 设计类:为什么选择这种实现方案?
- 边缘场景类:在特殊情况下会发生什么?
- 清晰度类:你会如何解释这段代码?
- 原则类:这是否符合项目的设计原则?
- 故障模式类:可能会出现哪些问题?
- 测试类:你如何确保这段代码能正常工作?
3. Dialogue
3. 对话过程
I'll ask questions one at a time and wait for your responses:
**Q1** [Category: Design]
Why did you choose to store session data in memory rather than a database?
[WAIT FOR YOUR RESPONSE]After each answer, I may:
- Ask a follow-up question if the answer reveals uncertainty
- Move to the next question if understanding is solid
- Note insights for the final synthesis
我会逐个提出问题并等待你的回复:
**Q1** [类别:设计]
为什么选择将会话数据存储在内存中而非数据库?
[等待你的回复]在每次回复后,我可能会:
- 如果回复显示出不确定性,提出跟进问题
- 如果理解已经到位,进入下一个问题
- 记录洞察用于最终总结
4. Synthesis
4. 总结阶段
After all questions, I'll summarize:
- Insights Revealed: What became clear through dialogue
- Assumptions Surfaced: Hidden assumptions that were exposed
- Recommendations: What should change based on the dialogue
- Strengths: What you clearly understood well
所有问题结束后,我会生成总结:
- 挖掘到的洞察:通过对话明确的内容
- 暴露的假设:被挖掘出来的隐藏假设
- 建议:基于对话得出的改进建议
- 优势:你已经清晰理解的部分
Depth Levels
深度级别
Quick (3-5 questions, ~5 min)
快速(3-5个问题,约5分钟)
Best for:
- Small bug fixes
- Simple changes
- Obvious code
Focus: Highest-risk areas only
最适合:
- 小型Bug修复
- 简单代码变更
- 逻辑清晰的代码
聚焦点:仅针对最高风险领域
Standard (7-10 questions, ~15 min)
标准(7-10个问题,约15分钟)
Best for:
- Feature implementations
- Refactoring
- Typical PRs
Focus: All question categories covered
最适合:
- 功能实现
- 代码重构
- 常规PR
聚焦点:覆盖所有问题类别
Deep (15-20 questions, ~30 min)
深度(15-20个问题,约30分钟)
Best for:
- Security-sensitive code
- Core infrastructure
- Architectural changes
Focus: Comprehensive with follow-ups
最适合:
- 安全敏感代码
- 核心基础设施
- 架构变更
聚焦点:全面覆盖并包含跟进问题
Example Session
会话示例
markdown
undefinedmarkdown
undefinedSocratic Review: auth/login.py
苏格拉底式评审:auth/login.py
I'm going to ask you some questions about this login implementation.
There are no wrong answers - the goal is to think through the design together.
Q1 [Category: Design]
I see you're storing session data in an in-memory dictionary.
Why did you choose this approach over Redis or database storage?
Your answer: "It was simpler to implement and we don't have many users yet."
That makes sense for simplicity. Follow-up: What would trigger you to
migrate to a different storage mechanism?
Your answer: "Um... I guess when we scale? Or add multiple servers?"
Insight noted: Migration criteria aren't clearly defined.
Q2 [Category: Edge Case]
What happens if a user's session expires while they're submitting a form?
Your answer: "I... actually haven't thought about that."
Insight noted: Session timeout during active use is unhandled.
[... more questions ...]
我将针对这个登录实现提出一些问题。
没有错误答案——我们的目标是一起梳理设计思路。
Q1 [类别:设计]
我注意到你将会话数据存储在内存字典中。
为什么选择这种方案而非Redis或数据库存储?
你的回答:"It was simpler to implement and we don't have many users yet."
出于简洁性考虑,这个选择很合理。跟进问题:什么情况会触发你迁移到其他存储机制?
你的回答:"Um... I guess when we scale? Or add multiple servers?"
已记录洞察:迁移标准尚未明确定义。
Q2 [类别:边缘场景]
如果用户在提交表单时会话过期,会发生什么?
你的回答:"I... actually haven't thought about that."
已记录洞察:未处理用户活跃使用时的会话超时场景。
[... more questions ...]
Review Synthesis
评审总结
Insights Revealed
挖掘到的洞察
- Session storage is pragmatic but migration path unclear
- Session timeout during active use is unhandled
- 会话存储方案务实但迁移路径不明确
- 未处理用户活跃使用时的会话超时场景
Assumptions Surfaced
暴露的假设
- Single server deployment assumption
- Users won't have long form submissions
- 假设单服务器部署
- 假设用户不会有长时间的表单提交
Recommendations
建议
- Document session storage migration criteria
- Add graceful session timeout handling
- 记录会话存储的迁移标准
- 添加优雅的会话超时处理机制
Strengths Identified
已识别的优势
- Clear awareness of simplicity trade-offs
- Quick recognition of gaps when prompted
undefined- 清晰认识到简洁性的权衡
- 被提示后能快速识别出漏洞
undefinedIntegration with Workflow
工作流集成
Socratic review can replace standard review at Step 11 of DEFAULT_WORKFLOW:
markdown
Step 11: Review the Code
Choose review approach:
A) Standard review - Direct feedback from reviewer agent
B) Socratic review - Dialogue with socratic-reviewer agent
Use Socratic when:
- Learning is as important as fixing
- Design decisions need documentation
- Mentoring/onboarding context苏格拉底式评审可以替代DEFAULT_WORKFLOW第11步的标准评审:
markdown
Step 11: 评审代码
选择评审方式:
A) 标准评审 - 评审Agent提供直接反馈
B) 苏格拉底式评审 - 与socratic-reviewer Agent对话评审
适用苏格拉底式评审的场景:
- 学习优先级高于修复
- 设计决策需要文档记录
- 指导/新员工入职场景Tips for Good Responses
回答技巧
When answering questions:
- Be specific: "It handles null by returning empty array" is better than "It should be fine"
- Acknowledge uncertainty: "I'm not sure what happens" is valuable - it reveals gaps
- Think out loud: Explain your reasoning, not just the answer
- Ask for clarification: If a question is unclear, say so
回答问题时:
- 具体明确:"它通过返回空数组处理null值"比"应该没问题"更好
- 承认不确定:"我不确定会发生什么"很有价值——它能暴露认知盲区
- 大声思考:解释你的推理过程,而不只是给出答案
- 请求澄清:如果问题不明确,请提出疑问
Feedback Loop: How Insights Return
反馈闭环:洞察如何落地
The key question: how do insights from dialogue become actual improvements?
核心问题:对话中得到的洞察如何转化为实际改进?
Interactive Mode (Default)
交互模式(默认)
During live dialogue:
- Each question and response is captured
- Insights are noted inline
- At the end, a synthesis is produced
- You can use to persist insights to DECISIONS.md
--write-decisions
在实时对话中:
- 每个问题和回复都会被记录
- 洞察会被实时记录
- 会话结束时生成总结
- 你可以使用参数将洞察持久化到DECISIONS.md
--write-decisions
Non-Interactive Mode (CI/Subprocess)
非交互模式(CI/子进程)
For automated contexts:
- All questions are asked rhetorically
- Agent analyzes code to identify likely issues
- Structured JSON output is produced
- Output can be posted to PR comments automatically
Auto-Detection: The skill automatically detects non-interactive contexts (e.g., , CI pipelines, no TTY) and switches to non-interactive mode. This prevents the frustrating pattern of asking questions, waiting for responses that can't come, and exiting INCONCLUSIVE with no useful output.
claude --print适用于自动化场景:
- 所有问题会被一次性提出
- Agent会分析代码以识别潜在问题
- 生成结构化JSON输出
- 输出可以自动发布到PR评论中
自动检测:该技能会自动检测非交互环境(如、CI流水线、无TTY)并切换到非交互模式。这避免了提出问题后等待无法收到的回复,最终以INCONCLUSIVE状态退出的尴尬情况。用户之后可以选择运行传统的命令。
claude --print/reviewPosting to PR
发布到PR
bash
undefinedbash
undefinedRun non-interactive review
运行非交互评审
/socratic-review src/auth/ --non-interactive --output=review.json
/socratic-review src/auth/ --non-interactive --output=review.json
Post results to PR
将结果发布到PR
gh pr comment 123 --body "$(jq -r '.synthesis | "## Socratic Review\n\n### Insights\n" + (.insights_revealed | map("- " + .) | join("\n")) + "\n\n### Recommendations\n" + (.recommendations | map("- [" + .priority + "] " + .description) | join("\n"))' review.json)"
undefinedgh pr comment 123 --body "$(jq -r '.synthesis | "## 苏格拉底式评审\n\n### 洞察\n" + (.insights_revealed | map("- " + .) | join("\n")) + "\n\n### 建议\n" + (.recommendations | map("- [" + .priority + "] " + .description) | join("\n"))' review.json)"
undefinedExit on Inconclusive
因无响应退出
If 3 questions go unanswered in interactive mode, the session exits with status. Socratic review requires willing participation - without it, exit cleanly rather than pretend to do something else. The user can then choose to run traditional instead.
INCONCLUSIVE/review如果在交互模式下有3个问题未得到回复,会话会以状态退出。苏格拉底式评审需要参与者的积极配合——如果没有配合,会干净地退出而非假装完成评审。用户之后可以选择运行传统的命令。
INCONCLUSIVE/reviewWhat This Is NOT
本技能不是什么
- Not a test: There are no wrong answers
- Not criticism: Questions explore, not judge
- Not a checklist: Questions adapt to your code and answers
- Not replacement for tests: This is for understanding, not verification
- 不是测试:没有错误答案
- 不是批评:问题用于探索而非评判
- 不是检查清单:问题会根据你的代码和回复调整
- 不是测试的替代品:本技能用于理解代码,而非验证代码正确性
Underlying Philosophy
底层理念
This skill is based on:
- Feynman Technique: Teaching reveals gaps in understanding
- Socratic Method: Questions create deeper insight than answers
- Rubber Duck Debugging: Explaining forces thoroughness
- Pair Programming: Dialogue catches what solo work misses
本技能基于以下理念:
- 费曼学习法:教学能暴露认知盲区
- 苏格拉底方法:问题比答案更能带来深度洞察
- 橡皮鸭调试法:解释代码的过程能促使开发者全面思考
- 结对编程:对话能发现单人工作时遗漏的问题
Related
相关资源
- Agent:
~/.amplihack/.claude/agents/amplihack/specialized/socratic-reviewer.md - Traditional Review: skill for direct feedback
/reviewing-code - Philosophy Check: agent for compliance
philosophy-guardian
- Agent:
~/.amplihack/.claude/agents/amplihack/specialized/socratic-reviewer.md - 传统评审:用于直接反馈的技能
/reviewing-code - 原则检查:用于合规性检查的Agent
philosophy-guardian
Execution
执行流程
When this skill is invoked:
- Parse arguments (file path, depth level, focus)
- Read and analyze the target code
- Invoke the socratic-reviewer agent with context
- Facilitate the dialogue, waiting for user responses
- Synthesize findings at the end
Task(
subagent_type="socratic-reviewer",
prompt="Conduct Socratic review of [file] at [depth] level. Focus on: [areas]"
)The agent will handle the question flow and wait for responses using [WAIT] markers.
当调用本技能时:
- 解析参数(文件路径、深度级别、聚焦领域)
- 读取并分析目标代码
- 携带上下文调用socratic-reviewer Agent
- 推动对话进程,等待用户回复
- 会话结束时生成总结
Task(
subagent_type="socratic-reviewer",
prompt="Conduct Socratic review of [file] at [depth] level. Focus on: [areas]"
)Agent会处理问题流程并使用[WAIT]标记等待回复。