跳到正文
Skillpedia
通用编程33k · #9082

code-review

它能做什么

这项技能指导你的智能体依据实用的检查清单审查拉取请求和代码改动。适合希望获得全面、有用代码反馈的开发人员。

适用场景

  • ✓合并前,想让智能体审查拉取请求(PR)的时候。
  • ✓想获得代码质量、性能和错误处理方面反馈的时候。
  • ✓需要检查某项改动是否有足够测试覆盖的时候。

技能链接

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/sentry/code-review/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/sentry/code-review/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请审查这个拉取请求,看看是否存在错误、安全问题和缺失的测试。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体阅读改动内容,对照代码审查清单进行检查,并就问题和测试给出反馈。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Sentry Code Review

Follow these guidelines when reviewing code for Sentry projects.

Review Checklist

Identifying Problems

Look for these issues in code changes:

  • Runtime errors: Potential exceptions, null pointer issues, out-of-bounds access
  • Performance: Unbounded O(n²) operations, N+1 queries, unnecessary allocations
  • Side effects: Unintended behavioral changes affecting other components
  • Backwards compatibility: Breaking API changes without migration path
  • ORM queries: Complex Django ORM with unexpected query performance
  • Security vulnerabilities: Injection, XSS, access control gaps, secrets exposure

Design Assessment

  • Do component interactions make logical sense?
  • Does the change align with existing project architecture?
  • Are there conflicts with current requirements or goals?

Test Coverage

Every PR should have appropriate test coverage:

  • Functional tests for business logic
  • Integration tests for component interactions
  • End-to-end tests for critical user paths

Verify tests cover actual requirements and edge cases. Avoid excessive branching or looping in test code.

Long-Term Impact

Flag for senior engineer review when changes involve:

  • Database schema modifications
  • API contract changes
  • New framework or library adoption
  • Performance-critical code paths
  • Security-sensitive functionality

Feedback Guidelines

Tone

  • Be polite and empathetic
  • Provide actionable suggestions, not vague criticism
  • Phrase as questions when uncertain: "Have you considered...?"

Approval

  • Approve when only minor issues remain
  • Don't block PRs for stylistic preferences
  • Remember: the goal is risk reduction, not perfect code

Common Patterns to Flag

Python/Django

# Bad: N+1 query
for user in users:
    print(user.profile.name)  # Separate query per user

# Good: Prefetch related
users = User.objects.prefetch_related('profile')

TypeScript/React

// Bad: Missing dependency in useEffect
useEffect(() => {
  fetchData(userId);
}, []);  // userId not in deps

// Good: Include all dependencies
useEffect(() => {
  fetchData(userId);
}, [userId]);

Security

# Bad: SQL injection risk
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")

# Good: Parameterized query
cursor.execute("SELECT * FROM users WHERE id = %s", [user_id])

References

常见问题

它检查哪些方面?

它检查运行时错误、性能问题、副作用、破坏性变更和安全问题。

重大改动会被标记出来交给资深工程师审查吗?

会。结构变更、接口变更和涉及安全的代码会被标记,交由资深工程师审查。

它只适用于 Sentry 项目吗?

该技能是依据 Sentry 的工程实践编写的,但其检查清单足够通用,适用于许多项目。

详情

作者的原始描述

Perform code reviews following Sentry engineering practices. Use when reviewing pull requests, examining code changes, or providing feedback on code quality. Covers security, performance, testing, and design review.

repo: davila7/claude-code-templates

热度

GitHub 星标
33k
排名
#9082
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能