code-review
Skill này làm gì
Skill này hướng dẫn một đợt rà soát mã cẩn thận. Nó dành cho lập trình viên muốn rà soát theo danh sách kiểm tra về bảo mật, tính đúng đắn, hiệu năng và khả năng bảo trì.
Khi nào nên dùng
- ✓Khi bạn yêu cầu agent rà soát mã hoặc kiểm tra lỗi.
- ✓Khi bạn muốn kiểm toán một codebase về vấn đề bảo mật.
- ✓Khi bạn muốn một đợt rà soát có cấu trúc, ưu tiên bảo mật trước, rồi đến tính đúng đắn và hiệu năng.
Liên kết skill
https://github.com/shareAI-lab/learn-claude-code/blob/main/skills/code-review/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy rà soát mã này tìm lỗi và vấn đề bảo mật, rồi cho tôi biết nên sửa cái gì trước.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent đi qua danh sách kiểm tra gồm bảo mật, tính đúng đắn, hiệu năng và khả năng bảo trì. Nó cũng có thể gợi ý các công cụ kiểm toán như npm audit hoặc pip-audit để kiểm tra các phụ thuộc.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Code Review Skill
You now have expertise in conducting comprehensive code reviews. Follow this structured approach:
Review Checklist
1. Security (Critical)
Check for:
- Injection vulnerabilities: SQL, command, XSS, template injection
- Authentication issues: Hardcoded credentials, weak auth
- Authorization flaws: Missing access controls, IDOR
- Data exposure: Sensitive data in logs, error messages
- Cryptography: Weak algorithms, improper key management
- Dependencies: Known vulnerabilities (check with
npm audit,pip-audit)
# Quick security scans
npm audit # Node.js
pip-audit # Python
cargo audit # Rust
grep -r "password\|secret\|api_key" --include="*.py" --include="*.js"
2. Correctness
Check for:
- Logic errors: Off-by-one, null handling, edge cases
- Race conditions: Concurrent access without synchronization
- Resource leaks: Unclosed files, connections, memory
- Error handling: Swallowed exceptions, missing error paths
- Type safety: Implicit conversions, any types
3. Performance
Check for:
- N+1 queries: Database calls in loops
- Memory issues: Large allocations, retained references
- Blocking operations: Sync I/O in async code
- Inefficient algorithms: O(n^2) when O(n) possible
- Missing caching: Repeated expensive computations
4. Maintainability
Check for:
- Naming: Clear, consistent, descriptive
- Complexity: Functions > 50 lines, deep nesting > 3 levels
- Duplication: Copy-pasted code blocks
- Dead code: Unused imports, unreachable branches
- Comments: Outdated, redundant, or missing where needed
5. Testing
Check for:
- Coverage: Critical paths tested
- Edge cases: Null, empty, boundary values
- Mocking: External dependencies isolated
- Assertions: Meaningful, specific checks
Review Output Format
## Code Review: [file/component name]
### Summary
[1-2 sentence overview]
### Critical Issues
1. **[Issue]** (line X): [Description]
- Impact: [What could go wrong]
- Fix: [Suggested solution]
### Improvements
1. **[Suggestion]** (line X): [Description]
### Positive Notes
- [What was done well]
### Verdict
[ ] Ready to merge
[ ] Needs minor changes
[ ] Needs major revision
Common Patterns to Flag
Python
# Bad: SQL injection
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
# Good:
cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))
# Bad: Command injection
os.system(f"ls {user_input}")
# Good:
subprocess.run(["ls", user_input], check=True)
# Bad: Mutable default argument
def append(item, lst=[]): # Bug: shared mutable default
# Good:
def append(item, lst=None):
lst = lst or []
JavaScript/TypeScript
// Bad: Prototype pollution
Object.assign(target, userInput)
// Good:
Object.assign(target, sanitize(userInput))
// Bad: eval usage
eval(userCode)
// Good: Never use eval with user input
// Bad: Callback hell
getData(x => process(x, y => save(y, z => done(z))))
// Good:
const data = await getData();
const processed = await process(data);
await save(processed);
Review Commands
# Show recent changes
git diff HEAD~5 --stat
git log --oneline -10
# Find potential issues
grep -rn "TODO\|FIXME\|HACK\|XXX" .
grep -rn "password\|secret\|token" . --include="*.py"
# Check complexity (Python)
pip install radon && radon cc . -a
# Check dependencies
npm outdated # Node
pip list --outdated # Python
Review Workflow
- Understand context: Read PR description, linked issues
- Run the code: Build, test, run locally if possible
- Read top-down: Start with main entry points
- Check tests: Are changes tested? Do tests pass?
- Security scan: Run automated tools
- Manual review: Use checklist above
- Write feedback: Be specific, suggest fixes, be kind
Câu hỏi thường gặp
Đợt rà soát kiểm tra điều gì trước?
Bảo mật được liệt kê là khu vực quan trọng nhất, tiếp theo là tính đúng đắn, hiệu năng và khả năng bảo trì.
Skill có chạy công cụ bảo mật không?
Nó gợi ý các công cụ như npm audit và pip-audit để kiểm tra các vấn đề đã biết trong phụ thuộc.
Nó có tự sửa mã cho tôi không?
Skill tập trung vào việc tìm và giải thích vấn đề trong rà soát. Nó không mô tả việc tự thực hiện thay đổi.
Chi tiết
Mô tả gốc của tác giả
Perform thorough code reviews with security, performance, and maintainability analysis. Use when user asks to review code, check for bugs, or audit a codebase.
Độ phổ biến
- Sao GitHub
- 80k
- Vị trí xếp hạng
- #1716
- Giấy phép
- MIT
- Cập nhật
- 27/10/2026
Bình luận
- …
Thêm skill từ kho mã này
agent-builder
80kDạy agent của bạn cách thiết kế và xây dựng trợ lý AI riêng cho một công việc, từ công cụ và kiến thức đến các bước lặp lại.
mcp-builder
80kDạy agent của bạn xây dựng máy chủ MCP cung cấp cho Claude các công cụ, nguồn dữ liệu và prompt mới để kết nối với dịch vụ bên ngoài.
Giúp agent của bạn đọc file PDF, trích xuất văn bản, tạo PDF mới và gộp nhiều tài liệu thành một file.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.