pr-review-assistant
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePR Review Assistant Skill
PR评审助手Skill
Purpose
目的
Philosophy-aware pull request reviews that go beyond syntax and style to check alignment with amplihack's core development principles. This skill reviews PRs not just for correctness, but for ruthless simplicity, modular architecture, and zero-BS implementation.
本工具会从语法和风格之外的维度进行PR评审,检查代码是否符合amplihack的核心开发原则。它不仅评审代码的正确性,还会确保代码遵循极致简洁、模块化架构和零冗余实现的要求。
When to Use This Skill
使用场景
- PR Code Reviews: Review PRs against amplihack philosophy principles
- Philosophy Compliance: Check that code embodies ruthless simplicity and brick module design
- Refactoring Suggestions: Identify over-engineering and suggest concrete simplifications
- Architecture Verification: Verify modular design and clear contracts
- Test Coverage: Assess test adequacy for changed functionality
- Design Assessment: Catch over-engineering before it gets merged
- PR代码评审:对照amplihack原则评审PR
- 合规性检查:验证代码是否体现极致简洁和积木式模块设计
- 重构建议:识别过度设计问题并提供具体简化方案
- 架构验证:确认模块化设计和清晰的契约关系
- 测试覆盖评估:评估变更功能的测试充分性
- 设计审查:在代码合并前发现过度设计问题
Core Philosophy: What We Review For
核心评审原则
1. Ruthless Simplicity
1. 极致简洁
Every line of code must justify its existence. We ask:
- Can this be simpler? Does each function do one thing well?
- Is this necessary now? Or is it future-proofing?
- Are there unnecessary abstractions? Extra layers that don't add value?
- Can we remove lines? The best code is code that doesn't exist.
每一行代码都必须有存在的理由。我们会审视:
- 能否更简单? 每个函数是否只做好一件事?
- 现在是否必要? 这是当前需求还是为未来预留的功能?
- 是否存在不必要的抽象? 有没有不增加价值的额外层级?
- 能否删除冗余代码? 最好的代码是不存在的代码。
2. Modular Architecture (Brick & Studs)
2. 模块化架构(积木与接口)
Code should be organized as self-contained modules with clear connections:
- Brick = Self-contained module with ONE clear responsibility
- Stud = Public contract (functions, API, data models) others connect to
- Regeneratable = Can be rebuilt from specification without breaking connections
代码应组织为独立模块,且模块间连接清晰:
- Brick(积木):单一明确职责的独立模块
- Stud(接口):供其他模块调用的公共契约(函数、API、数据模型)
- 可重构性:可以根据规范重新构建模块,且不破坏现有连接
3. Zero-BS Implementation
3. 零冗余实现
No shortcuts, stubs, or technical debt:
- No TODOs in code = Actually implement or don't include it
- No NotImplementedError = Except in abstract base classes
- No mock data = Real functionality from the start
- No dead code = Remove unused code
- Every function works = Or it doesn't exist
不允许捷径、占位代码或技术债务:
- 代码中禁止TODO:要么现在实现,要么不要包含
- 禁止NotImplementedError:抽象基类除外
- 禁止模拟数据:从一开始就实现真实功能
- 禁止死代码:移除未使用的代码
- 所有函数必须可正常工作:否则就不要存在
4. Quality Over Speed
4. 质量优先于速度
- Robust implementations = Better than quick fixes
- Long-term maintainability = Not short-term gains
- Clear error handling = Errors visible, not swallowed
- Tested behavior = Verify contracts at module boundaries
- 健壮的实现:优于快速修复
- 长期可维护性:而非短期收益
- 清晰的错误处理:错误需可见,而非被隐藏
- 经过测试的行为:在模块边界验证契约
Review Process
评审流程
Step 1: Understand the Changes
步骤1:理解变更内容
Start by understanding what the PR changes:
- Read the PR description to understand intent
- Identify affected modules and their scope
- Note the dependencies changed or added
- Understand the problem being solved
首先明确PR的变更点:
- 阅读PR描述:理解变更意图
- 识别受影响的模块及其范围
- 记录变更或新增的依赖
- 理解要解决的问题
Step 2: Check Philosophy Alignment
步骤2:检查原则符合性
Review each change against amplihack principles:
对照amplihack原则评审每个变更:
Ruthless Simplicity Check
极致简洁检查
- Is every line necessary?
- Are there unnecessary abstractions?
- Could this be implemented more simply?
- Is there future-proofing or speculation?
- Are there duplicate or similar functions?
- Could conditional logic be simplified?
- 每一行代码是否必要?
- 是否存在不必要的抽象?
- 实现方式能否更简单?
- 是否存在为未来预留的代码?
- 是否存在重复或相似的函数?
- 条件逻辑能否简化?
Module Structure Check
模块结构检查
- Does the change respect module boundaries?
- Are public contracts clear and documented?
- Are internal utilities isolated?
- Does the module have ONE clear responsibility?
- Are there circular dependencies?
- 变更是否尊重模块边界?
- 公共契约是否清晰且有文档说明?
- 内部工具是否被隔离?
- 模块是否只有单一明确职责?
- 是否存在循环依赖?
Zero-BS Check
零冗余检查
- Are there TODOs or NotImplementedError calls?
- Are mock or test data exposed in production code?
- Is error handling explicit and visible?
- Are all functions working implementations?
- Is there dead code or unused variables?
- 是否存在TODO或NotImplementedError调用?
- 生产代码中是否暴露了模拟或测试数据?
- 错误处理是否明确可见?
- 所有函数是否都是可正常工作的实现?
- 是否存在死代码或未使用的变量?
Step 3: Identify Over-Engineering
步骤3:识别过度设计
Look for common over-engineering patterns:
- Over-abstraction: Base classes, protocols, factories for no clear benefit
- Generic "frameworks": Building infrastructure for hypothetical needs
- Premature optimization: Complex algorithms for non-critical paths
- Configuration complexity: 50-line config when 5-line default would work
- Future-proofing: "We might need this someday" code
- Excessive layering: More indirection than necessary
- Over-parameterization: Functions with 8+ parameters instead of simpler approach
留意常见的过度设计模式:
- 过度抽象:无明确收益的基类、协议、工厂模式
- 通用“框架”:为假设需求构建基础设施
- 过早优化:对非关键路径使用复杂算法
- 配置复杂度:用50行配置而非5行默认配置
- 未来预留代码:“我们以后可能需要这个”的代码
- 过度分层:不必要的间接层级
- 过度参数化:函数有8个以上参数,而非采用更简单的方式
Step 4: Verify Brick Module Structure
步骤4:验证积木式模块结构
If new modules or module changes:
- Single responsibility? What is the ONE thing this module does?
- Clear public interface? What's exported and why?
- Internal isolation? Are utilities contained within module?
- Dependencies documented? What does it depend on?
- Tests included? Does spec define test requirements?
- Examples provided? Is usage clear?
- Regeneratable? Could this be rebuilt from a specification?
如果涉及新模块或模块变更:
- 单一职责? 这个模块的核心功能是什么?
- 清晰的公共接口? 导出了什么,为什么导出?
- 内部隔离? 工具类是否包含在模块内部?
- 依赖是否有文档? 模块依赖哪些资源?
- 是否包含测试? 规范中是否定义了测试要求?
- 是否提供示例? 使用方式是否清晰?
- 可重构? 是否可以根据规范重新构建该模块?
Step 5: Check Test Coverage
步骤5:检查测试覆盖
Adequate testing is crucial:
- Contract verification: Tests verify public interface behavior
- Edge cases covered: Null, empty, boundary conditions tested
- Error paths tested: Exceptions raised when expected
- Integration tested: Module connections verified
- Coverage adequate: 85%+ for changed code
充分的测试至关重要:
- 契约验证:测试需验证公共接口的行为
- 边界场景覆盖:测试空值、边界条件等情况
- 错误路径测试:验证是否按预期抛出异常
- 集成测试:验证模块间的连接
- 覆盖充分:变更代码的测试覆盖率需达到85%以上
Step 6: Provide Constructive Feedback
步骤6:提供建设性反馈
When suggesting changes:
- Be specific: Reference file:line numbers
- Explain why: What principle is violated?
- Suggest how: Provide concrete examples
- Be respectful: Focus on code, not person
- Acknowledge good work: Recognize what's done well
提出变更建议时:
- 具体明确:引用文件:行号
- 解释原因:违反了哪项原则?
- 给出方案:提供具体示例
- 保持尊重:聚焦代码而非个人
- 肯定优点:认可做得好的部分
Concrete Review Checklist
具体评审检查清单
Ruthless Simplicity
极致简洁
- Every function has single clear purpose
- No unnecessary abstraction layers
- No future-proofing or speculation
- No duplicate logic or functions
- Conditional logic is straightforward
- Variable names are clear and self-documenting
- Function signatures aren't over-parameterized
- 每个函数都有单一明确的目的
- 无不必要的抽象层
- 无未来预留或推测性代码
- 无重复逻辑或函数
- 条件逻辑简单直接
- 变量名称清晰且自文档化
- 函数签名未过度参数化
Modular Architecture
模块化架构
- Module has ONE clear responsibility
- Public interface is minimal and clear
- Internal utilities properly isolated
- Dependencies are explicit
- No circular dependencies
- Clear contracts at boundaries
- Module can be understood independently
- 模块只有单一明确职责
- 公共接口最小化且清晰
- 内部工具被正确隔离
- 依赖关系明确
- 无循环依赖
- 边界处有清晰的契约
- 模块可被独立理解
Zero-BS Implementation
零冗余实现
- No TODOs, NotImplementedError, or stubs
- No mock/test data in production code
- No dead code or unused imports
- Error handling is explicit and visible
- All functions have working implementations
- No swallowed exceptions
- Clear logging/error messages for debugging
- 无TODO、NotImplementedError或占位代码
- 生产代码中无模拟/测试数据
- 无死代码或未使用的导入
- 错误处理明确可见
- 所有函数都是可正常工作的实现
- 无被隐藏的异常
- 有清晰的日志/错误信息用于调试
Test Coverage
测试覆盖
- Public interface is tested
- Edge cases covered
- Error conditions tested
- Integration points verified
- Coverage adequate (85%+)
- Tests verify contract, not implementation
- 公共接口已被测试
- 边界场景已覆盖
- 错误条件已测试
- 集成点已验证
- 覆盖率充足(85%+)
- 测试验证契约而非实现细节
Documentation
文档
- Docstrings are clear and complete
- Public interface documented
- Examples provided for new features
- Module README updated if needed
- Type hints present and accurate
- 文档字符串清晰完整
- 公共接口已文档化
- 新功能提供了使用示例
- 模块README已按需更新
- 类型提示存在且准确
Example Reviews
评审示例
Example 1: Identifying Over-Engineering
示例1:识别过度设计
PR: Add user permission checking to API
Code Changed:
python
class PermissionValidator:
def __init__(self):
self.cache = {}
def validate(self, user, resource):
if user in self.cache:
return self.cache[user]
result = self._complex_validation(user, resource)
self.cache[user] = result
return result
def _complex_validation(self, user, resource):
# Complex business logic...
passReview Comment:
FILE: permissions.py (lines 10-25)
This over-engineers the permission checking with caching that may not be needed.
The caching layer adds complexity without proven benefit:
1. Cache can become stale if user permissions change
2. Unclear when/if cache should be invalidated
3. In-memory cache doesn't scale across processes
4. Permission checks are usually not in hot paths
SUGGESTION - Start simpler:
```python
def check_permission(user, resource):
"""Check if user can access resource."""
# Direct implementation
return user.has_access_to(resource)If caching is needed later, add it when profiling shows it helps.
This aligns with ruthless simplicity: don't add complexity until proven necessary.
undefinedPR:为API添加用户权限检查
变更代码:
python
class PermissionValidator:
def __init__(self):
self.cache = {}
def validate(self, user, resource):
if user in self.cache:
return self.cache[user]
result = self._complex_validation(user, resource)
self.cache[user] = result
return result
def _complex_validation(self, user, resource):
# Complex business logic...
pass评审意见:
FILE: permissions.py (lines 10-25)
这段权限检查代码存在过度设计问题,添加了可能不必要的缓存层:
1. 缓存可能因用户权限变更而过期
2. 缓存的失效时机和方式不明确
3. 内存缓存无法跨进程扩展
4. 权限检查通常不属于热点路径
建议 - 从更简单的实现开始:
```python
def check_permission(user, resource):
"""Check if user can access resource."""
# Direct implementation
return user.has_access_to(resource)如果后续性能分析显示需要缓存,再添加该功能。
这符合极致简洁原则:不要在被证明必要前添加复杂度。
undefinedExample 2: Identifying Lack of Regeneration Documentation
示例2:识别缺失的重构文档
PR: Add new authentication module
Code Changed: New file
~/.amplihack/.claude/tools/auth/auth.pyReview Comment:
FILE: .claude/tools/auth/ (new module)
Good: Module has clear responsibilities (JWT validation, token refresh).
Issue: Missing specification documentation for module regeneration.
Brick Philosophy Requirement: Modules should be regeneratable from spec.
ACTION NEEDED:
1. Create Specs/authentication.md with:
- Clear purpose and scope
- Public interface (exported functions)
- Dependencies listed
- Test requirements
- Usage examples
This enables future rebuilding if requirements change.
See .claude/skills/pr-review-assistant/ for specification template.
PR:添加新的认证模块
变更代码:新增文件
~/.amplihack/.claude/tools/auth/auth.py评审意见:
FILE: .claude/tools/auth/ (new module)
优点:模块职责清晰(JWT验证、令牌刷新)。
问题:缺失模块重构所需的规范文档。
积木式原则要求:模块应可根据规范重新构建。
需执行的操作:
1. 创建 Specs/authentication.md,包含:
- 清晰的目的和范围
- 公共接口(导出的函数)
- 依赖列表
- 测试要求
- 使用示例
这样在需求变更时可以重新构建模块。
参考模板:.claude/skills/pr-review-assistant/
Example 3: Identifying Zero-BS Issues
示例3:识别零冗余问题
PR: Add data processing pipeline
Code Changed:
python
def process_data(data):
"""Process data through pipeline."""
# TODO: Add error handling
result = validate(data)
if not result:
return None # swallowed error
# TODO: Implement caching
return transform(result)Review Comment:
FILE: pipeline.py (lines 5-15)
Zero-BS Issues Found:
1. LINE 6: TODO comments - implement or remove
- "Add error handling" - Either add it now or create issue
- "Implement caching" - Not needed yet; add if profiling shows benefit
2. LINE 10: Swallowed error
- validate() likely raised exception, but returns None
- Make error explicit: raise ValueError("Invalid data")
- Or catch and re-raise with context
3. LINE 8: Silent failures
- If None is returned, caller doesn't know why
- Either raise exception or return Result type
SUGGESTION:
```python
def process_data(data):
"""Process data through pipeline.
Raises:
ValueError: If data validation fails
"""
result = validate(data) # Raises if invalid
return transform(result)All code is production-ready, no TODOs.
undefinedPR:添加数据处理流水线
变更代码:
python
def process_data(data):
"""Process data through pipeline."""
# TODO: Add error handling
result = validate(data)
if not result:
return None # swallowed error
# TODO: Implement caching
return transform(result)评审意见:
FILE: pipeline.py (lines 5-15)
发现零冗余原则违规问题:
1. 第6行:TODO注释 - 要么实现要么删除
- "Add error handling" - 现在实现或创建需求工单
- "Implement caching" - 当前不需要,后续性能分析后再考虑添加
2. 第10行:错误被隐藏
- validate()可能抛出异常,但此处返回None
- 应明确抛出错误:raise ValueError("Invalid data")
- 或捕获异常并添加上下文后重新抛出
3. 第8行:静默失败
- 如果返回None,调用方无法知道失败原因
- 要么抛出异常,要么返回Result类型
建议修改为:
```python
def process_data(data):
"""Process data through pipeline.
Raises:
ValueError: If data validation fails
"""
result = validate(data) # Raises if invalid
return transform(result)所有代码需为生产就绪状态,无TODO注释。
undefinedExample 4: Identifying Missing Tests
示例4:识别缺失的测试
PR: Add user role management
Code Changed: New class in user module
RoleManagerReview Comment:
FILE: user.py (lines 50-100)
New functionality added without adequate tests.
ISSUE: RoleManager public interface not tested
- add_role(user, role) - add success case
- remove_role(user, role) - add success case
- get_roles(user) - test empty, single, multiple
- is_admin(user) - test true/false cases
EDGE CASES MISSING:
- [ ] duplicate role assignment (should be idempotent)
- [ ] removing non-existent role (should not error)
- [ ] get_roles on user with no roles (should return empty)
CONTRACT VERIFICATION:
- [ ] Functions accept documented types
- [ ] Return types match documentation
- [ ] Exceptions raised as documented
ADD: tests/test_role_manager.py with 85%+ coverage
PR:添加用户角色管理功能
变更代码:在用户模块中新增类
RoleManager评审意见:
FILE: user.py (lines 50-100)
新增功能未配备充分的测试。
问题:RoleManager的公共接口未被测试
- add_role(user, role) - 添加成功场景测试
- remove_role(user, role) - 添加成功场景测试
- get_roles(user) - 测试空角色、单个角色、多个角色场景
- is_admin(user) - 测试真假两种情况
缺失的边界场景:
- [ ] 重复分配角色(应具有幂等性)
- [ ] 删除不存在的角色(不应报错)
- [ ] 获取无角色用户的角色列表(应返回空)
契约验证:
- [ ] 函数接受文档中定义的参数类型
- [ ] 返回类型与文档一致
- [ ] 按文档定义抛出异常
需添加:tests/test_role_manager.py,覆盖率达到85%以上
Example 5: Recognizing Good Design
示例5:认可优秀设计
PR: Add simplified config loader
Code Changed:
python
def load_config(path):
"""Load YAML config from file.
Args:
path: Path to config file
Returns:
dict: Parsed config
Raises:
FileNotFoundError: If file doesn't exist
ValueError: If YAML is invalid
"""
with open(path) as f:
try:
return yaml.safe_load(f)
except yaml.YAMLError as e:
raise ValueError(f"Invalid YAML: {e}") from eReview Comment:
EXCELLENT - This is exactly the simplicity we want:
✅ Single responsibility: Load and parse YAML
✅ Clear error handling: Explicit exceptions with context
✅ No TODOs or stubs: Production ready
✅ Complete documentation: Clear args, returns, exceptions
✅ No over-engineering: Direct implementation
✅ Testable: Clear behavior to verify
This is a model example of ruthless simplicity.PR:添加简化的配置加载器
变更代码:
python
def load_config(path):
"""Load YAML config from file.
Args:
path: Path to config file
Returns:
dict: Parsed config
Raises:
FileNotFoundError: If file doesn't exist
ValueError: If YAML is invalid
"""
with open(path) as f:
try:
return yaml.safe_load(f)
except yaml.YAMLError as e:
raise ValueError(f"Invalid YAML: {e}") from e评审意见:
优秀 - 这正是我们想要的简洁风格:
✅ 单一职责:加载并解析YAML
✅ 清晰的错误处理:明确的异常及上下文
✅ 无TODO或占位代码:生产就绪
✅ 完整的文档:清晰的参数、返回值、异常说明
✅ 无过度设计:直接实现
✅ 可测试:行为清晰易验证
这是极致简洁的典范。Feedback Template
反馈模板
When commenting on PRs, use this structure:
markdown
**FILE**: path/to/file.py (lines X-Y)
**ISSUE**: [Principle violated - Simplicity/Modularity/Zero-BS/Tests/Docs]
**WHAT**: [Describe what's in the code]
**WHY IT'S PROBLEMATIC**: [How it violates amplihack principles]
**SUGGESTION**: [Concrete code example or approach]
**REFERENCE**: [Link to relevant philosophy, principle, or example]评审PR时可使用以下结构:
markdown
**FILE**: path/to/file.py (lines X-Y)
**问题**:[违反的原则 - 简洁性/模块化/零冗余/测试/文档]
**现状**:[描述代码中的问题]
**问题原因**:[说明违反了amplihack的哪项原则]
**建议**:[具体代码示例或实现方案]
**参考**:[相关原则、示例的链接]Integration with GitHub
与GitHub集成
Posting Review Comments
发布评审意见
The skill can post review comments to GitHub PRs using:
bash
gh pr comment <PR-NUMBER> -b "Review comment here"本工具可通过以下命令将评审意见发布到GitHub PR:
bash
gh pr comment <PR-NUMBER> -b "Review comment here"Or for specific file reviews:
或者针对特定文件评审:
gh pr diff <PR-NUMBER> | grep "^---" | head -1
gh pr diff <PR-NUMBER> | grep "^---" | head -1
Then post review with specific file:line references
然后发布包含具体文件:行号引用的评审意见
undefinedundefinedReview Workflow
评审工作流
- Fetch PR details: Get PR number, branch, changed files
- Analyze changes: Run review against philosophy
- Generate feedback: Compile specific, actionable comments
- Post review: Create GitHub review with all comments
- Summary: Post overall assessment
- 获取PR详情:获取PR编号、分支、变更文件
- 分析变更:对照原则进行评审
- 生成反馈:整理具体、可执行的意见
- 发布评审:在GitHub创建包含所有意见的评审
- 总结:发布整体评估
Common Over-Engineering Patterns to Catch
需识别的常见过度设计模式
Pattern 1: Configuration Complexity
模式1:配置复杂度
python
undefinedpython
undefinedOVER-ENGINEERED: 50-line config class
过度设计:50行配置类
class ConfigManager:
def init(self, env_file, schema_file, validators):
self.config = load_yaml(env_file)
self.schema = load_json(schema_file)
self.validators = validators
# 40 more lines...
class ConfigManager:
def init(self, env_file, schema_file, validators):
self.config = load_yaml(env_file)
self.schema = load_json(schema_file)
self.validators = validators
# 40行额外代码...
SIMPLE: 5 lines
简洁实现:5行
config = yaml.safe_load(open('.env.yaml'))
undefinedconfig = yaml.safe_load(open('.env.yaml'))
undefinedPattern 2: Factory Pattern When Not Needed
模式2:不必要的工厂模式
python
undefinedpython
undefinedOVER-ENGINEERED: Factory for single implementation
过度设计:为单一实现创建工厂
class ValidationFactory:
def create_validator(self, type):
if type == "email":
return EmailValidator()
# ... more types
class ValidationFactory:
def create_validator(self, type):
if type == "email":
return EmailValidator()
# ... 更多类型
SIMPLE: Direct function
简洁实现:直接函数
def validate_email(email):
return "@" in email and "." in email
undefineddef validate_email(email):
return "@" in email and "." in email
undefinedPattern 3: Generic Base Classes for One Use
模式3:仅使用一次的通用基类
python
undefinedpython
undefinedOVER-ENGINEERED: Base class never subclassed
过度设计:从未被继承的基类
class BaseRepository(ABC):
@abstractmethod
def find(self, id): pass
# ... 20 abstract methods
class UserRepository(BaseRepository):
# Forced to implement all abstract methods
# But only uses 3 of them
class BaseRepository(ABC):
@abstractmethod
def find(self, id): pass
# ... 20个抽象方法
class UserRepository(BaseRepository):
# 被迫实现所有抽象方法
# 但只用到其中3个
SIMPLE: Direct class
简洁实现:直接类
class UserRepository:
def find(self, id):
return self.db.query(User).get(id)
undefinedclass UserRepository:
def find(self, id):
return self.db.query(User).get(id)
undefinedPattern 4: Premature Optimization
模式4:过早优化
python
undefinedpython
undefinedOVER-ENGINEERED: Complex caching for cache that's not needed
过度设计:为不必要的场景添加复杂缓存
cache = LRUCache(maxsize=1000)
stats = CacheStats()
lock = threading.Lock()
cache = LRUCache(maxsize=1000)
stats = CacheStats()
lock = threading.Lock()
... complex logic
... 复杂逻辑
SIMPLE: None - profile first, optimize if needed
简洁实现:无缓存 - 先分析性能再考虑优化
result = function(args)
undefinedresult = function(args)
undefinedKey Questions to Ask
评审时的关键问题
When reviewing, ask these questions:
- Can this be simpler? If yes, why isn't it?
- Is this necessary now? Or is it future-proofing?
- What's the ONE thing this does? If there are many things, split it.
- Who will use this? Is the interface clear for them?
- What can go wrong? Are errors handled explicitly?
- Is this testable? Can the contract be verified?
- Will this need to change? Is it flexible without over-engineering?
- Could this be deleted? Better than could it be refactored?
- Does this follow our patterns? Or is it unique?
- Am I confident this works? Or is it speculative?
评审时可思考以下问题:
- 能否更简单? 如果可以,为什么没有这么做?
- 现在是否必要? 还是为未来预留的代码?
- 核心功能是什么? 如果有多个功能,是否需要拆分?
- 谁会使用它? 接口对用户是否清晰?
- 可能出现什么问题? 错误处理是否明确?
- 可测试吗? 契约能否被验证?
- 未来会变更吗? 是否在不过度设计的前提下保持灵活性?
- 能否删除? 重构不如删除吗?
- 是否符合团队模式? 还是独特的实现?
- 我能确定它能正常工作吗? 还是推测性实现?
Success Criteria
成功标准
A successful PR review using this skill:
- Reviews code against amplihack philosophy, not just style
- Identifies over-engineering with concrete suggestions
- Verifies module structure and brick design
- Checks test coverage adequacy
- Provides specific file:line references
- Offers concrete, actionable suggestions
- Recognizes and acknowledges good design
- Posts comprehensive GitHub review comments
- Helps team learn and improve
使用本工具完成的PR评审需满足:
- 对照amplihack原则评审代码,而非仅关注风格
- 识别过度设计并提供具体建议
- 验证模块结构和积木式设计
- 检查测试覆盖的充分性
- 提供具体的文件:行号引用
- 给出具体、可执行的建议
- 识别并认可优秀设计
- 在GitHub发布全面的评审意见
- 帮助团队学习和提升
Output
输出内容
The skill produces:
-
Philosophy Compliance Report
- Ruthless Simplicity check
- Modular Architecture check
- Zero-BS Implementation check
- Test Coverage assessment
- Overall assessment
-
Specific Recommendations
- Over-engineering identified with examples
- Simplification suggestions with code
- Module structure feedback
- Test gaps to address
-
GitHub Comments (optional)
- Detailed review with file:line references
- Inline code suggestions
- Summary of findings
- Constructive, respectful tone
本工具会生成:
-
原则合规性报告
- 极致简洁检查
- 模块化架构检查
- 零冗余实现检查
- 测试覆盖评估
- 整体评估
-
具体建议
- 识别过度设计并提供示例
- 简化方案及代码示例
- 模块结构反馈
- 需补充的测试缺口
-
GitHub评论(可选)
- 包含文件:行号引用的详细评审
- 行内代码建议
- 发现总结
- 建设性、尊重的语气
Philosophy References
原则参考文档
All reviews anchor in these documents:
- - Core development philosophy
~/.amplihack/.claude/context/PHILOSOPHY.md - - Approved patterns and anti-patterns
~/.amplihack/.claude/context/PATTERNS.md - - Module specifications for architecture verification
Specs/ - - Known issues and solutions
~/.amplihack/.claude/context/DISCOVERIES.md
所有评审均基于以下文档:
- - 核心开发原则
~/.amplihack/.claude/context/PHILOSOPHY.md - - 认可的模式与反模式
~/.amplihack/.claude/context/PATTERNS.md - - 用于架构验证的模块规范
Specs/ - - 已知问题与解决方案
~/.amplihack/.claude/context/DISCOVERIES.md
Tips for Effective Reviews
有效评审技巧
- Be Specific: Reference exact lines and code
- Explain Why: What principle is violated and why it matters
- Suggest How: Provide concrete code examples
- Respect Constraints: Some complexity may be necessary
- Acknowledge Good Work: Praise what's done well
- Ask Questions: "Have you considered?" invites discussion
- Learn Together: Reviews are teaching opportunities
- Iterate: Suggest improvements, don't demand perfection
- Consider Context: External constraints matter
- Stay Focused: Review philosophy alignment, not personal style
- 具体明确:引用准确的行号和代码
- 解释原因:说明违反的原则及影响
- 给出方案:提供具体代码示例
- 尊重约束:有些复杂度可能是必要的
- 肯定优点:认可做得好的部分
- 提问引导:用“你是否考虑过?”引发讨论
- 共同学习:评审是互相学习的机会
- 迭代改进:建议改进而非要求完美
- 考虑上下文:外部约束是重要因素
- 聚焦重点:评审原则符合性而非个人风格
Related Skills and Workflows
相关技能与工作流
- Module Spec Generator: Creates specifications for regeneratable modules
- Builder Agent: Implements code from specifications
- Reviewer Agent: Philosophy compliance verification
- Tester Agent: Test generation and validation
- Document-Driven Development: Uses specs as source of truth
- 模块规范生成器:为可重构模块创建规范
- 构建Agent:根据规范实现代码
- 评审Agent:原则合规性验证
- 测试Agent:测试用例生成与验证
- 文档驱动开发:以规范为事实来源
Feedback and Evolution
反馈与迭代
This skill should evolve based on usage:
- What patterns do we keep finding?
- What suggestions lead to better code?
- What philosophy principles are most violated?
- How can we catch issues earlier?
Document learnings in .
~/.amplihack/.claude/context/DISCOVERIES.md本工具会根据使用情况不断进化:
- 我们经常发现哪些模式?
- 哪些建议能带来更好的代码?
- 哪些原则最常被违反?
- 如何更早发现问题?
学习成果需记录在中。
~/.amplihack/.claude/context/DISCOVERIES.md