code-review

bởi sentry

Khung đánh giá mã nguồn tuân theo các thực hành kỹ thuật của Sentry dành cho pull request và đánh giá chất lượng mã. Bao gồm sáu lĩnh vực vấn đề chính: lỗi runtime, tắc nghẽn hiệu suất, tác dụng phụ, khả năng tương thích ngược, vấn đề truy vấn ORM và lỗ hổng bảo mật. Có hướng dẫn đánh giá thiết kế về tương tác thành phần, sự phù hợp kiến trúc và xung đột yêu cầu. Yêu cầu phạm vi kiểm thử phù hợp trên các bài kiểm tra chức năng, tích hợp và đầu cuối với xác minh các trường hợp biên...

npx skills add https://github.com/getsentry/skills --skill code-review

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

Thêm skills từ sentry

architecture-review
sentry
Đánh giá sức khỏe mã nguồn ở cấp độ nhân viên. Phát hiện các module nguyên khối, lỗi âm thầm, khoảng trống an toàn kiểu dữ liệu, lỗ hổng độ phủ kiểm thử và các vấn đề về thân thiện với LLM.
pi-agent-integration
sentry
Integrate `@mariozechner/pi-agent-core` as the agent abstraction inside another library or runtime. Use when implementing or refactoring Pi Agent wrappers,…
sentry-debug-issue
sentry
Gỡ lỗi và sửa một sự cố Sentry — tìm nó (bằng liên kết, ID hoặc tìm kiếm), lấy ngữ cảnh đầy đủ (stack trace, breadcrumbs, trace, logs), tùy chọn chạy Seer root-cause /…
sentry-svelte-sdk
sentry
Thiết lập đầy đủ Sentry SDK cho Svelte và SvelteKit. Sử dụng khi được yêu cầu "thêm Sentry vào Svelte", "thêm Sentry vào SvelteKit", "cài đặt @sentry/sveltekit", hoặc cấu hình…
sentry-svelte-sdk
sentry
Thiết lập đầy đủ Sentry SDK cho Svelte và SvelteKit. Sử dụng khi được yêu cầu "thêm Sentry vào Svelte", "thêm Sentry vào SvelteKit", "cài đặt @sentry/sveltekit", hoặc cấu hình…
skill-scanner
sentry
Quét kỹ năng tác nhân để tìm vấn đề bảo mật. Sử dụng khi được yêu cầu "quét một kỹ năng",
prompt-optimizer
sentry
Tạo, tối ưu hóa và cải tiến lặp lại các prompt cho agent, system prompt, developer prompt và các mẫu prompt có thể tái sử dụng. Sử dụng khi được yêu cầu cải thiện một…
commit
sentry
commit — một kỹ năng có thể cài đặt cho các tác nhân AI, được xuất bản bởi getsentry/sentry-docs.