跳到正文
cccskills
免费在 GitHub 公开

code-review

Review code for security flaws, bugs, performance problems, maintainability, and test quality. Produce structured feedback with issue locations, likely impact, suggested fixes, positive observations, and a recommendation on whether changes are ready to merge.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Perform thorough code reviews with security, performance, and maintainability analysis. Use when user asks to review code, check for bugs, or audit a codebase.

查看安装方法

适用场景

  • Reviewing a pull request before merging
  • Investigating bugs and edge cases
  • Checking security flaws and dependencies
  • Assessing performance and maintainability

包含的文件(1)

  • SKILL.md4.2 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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

  1. Understand context: Read PR description, linked issues
  2. Run the code: Build, test, run locally if possible
  3. Read top-down: Start with main entry points
  4. Check tests: Are changes tested? Do tests pass?
  5. Security scan: Run automated tools
  6. Manual review: Use checklist above
  7. Write feedback: Be specific, suggest fixes, be kind

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Design and build AI agents for business, research, operations, or creative work. Define essential actions and knowledge, start with a simple execution loop, and add progress tracking or separate child agents as needs emerge.

中文简介正在准备中。当前显示英语简介。

  • Designing an assistant for business tasks
  • Building a research agent
  • Choosing essential actions and knowledge
shareAI-lab/learn-claude-code7.9万2026年9月28日 更新

Build MCP servers, which let Claude call external tools and read data through a shared protocol. Follow Python or TypeScript examples to implement tools, connect services, configure Claude, and test server behavior.

中文简介正在准备中。当前显示英语简介。

  • Adding custom tools to Claude
  • Connecting an external API
  • Reading database records or settings
shareAI-lab/learn-claude-code7.9万2026年9月28日 更新

pdf

免费

Extract text from PDFs, inspect page counts and document metadata, merge files, or split them into individual pages. Create PDFs from Markdown, HTML, or Python code, using the tools suited to each task.

中文简介正在准备中。当前显示英语简介。

  • Extracting text from a PDF
  • Combining several PDFs into one
  • Splitting a PDF into individual pages
shareAI-lab/learn-claude-code7.9万2026年9月28日 更新

查看 shareAI-lab 的全部技能

报告此技能的问题