Agent Skillsanymouschina/TapCanvas › code-review

code-review

GitHub

提供结构化代码审查能力,覆盖安全、正确性、性能与可维护性。通过检查清单和常见模式示例,协助发现潜在Bug并评估代码质量,输出标准化评审报告。

apps/agents-cli/skills/code-review/SKILL.md anymouschina/TapCanvas

Trigger Scenarios

用户要求审查代码 排查潜在Bug 审计代码库

Install

npx skills add anymouschina/TapCanvas --skill code-review -g -y
More Options

Non-standard path

npx skills add https://github.com/anymouschina/TapCanvas/tree/main/apps/agents-cli/skills/code-review -g -y

Use without installing

npx skills use anymouschina/TapCanvas@code-review

指定 Agent (Claude Code)

npx skills add anymouschina/TapCanvas --skill code-review -a claude-code -g -y

安装 repo 全部 skill

npx skills add anymouschina/TapCanvas --all -g -y

预览 repo 内 skill

npx skills add anymouschina/TapCanvas --list

SKILL.md

Frontmatter
{
    "name": "code-review",
    "description": "进行全面代码审查,覆盖安全、正确性、性能与可维护性;适用于用户要求 review、排查潜在 bug 或审计代码库。"
}

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

Version History

  • 1.0.0 Current 2026-07-24 20:45

Same Skill Collection

apps/agents-cli/skills/aesthetic-audit/SKILL.md
apps/agents-cli/skills/agent-builder/SKILL.md
apps/agents-cli/skills/agents-team-book-metadata/SKILL.md
apps/agents-cli/skills/agents-team/SKILL.md
apps/agents-cli/skills/cognitive-memory/SKILL.md
apps/agents-cli/skills/evolver/SKILL.md
apps/agents-cli/skills/generate-media/SKILL.md
apps/agents-cli/skills/khazix-writer/SKILL.md
apps/agents-cli/skills/long-running-app-harness/SKILL.md
apps/agents-cli/skills/mcp-builder/SKILL.md
apps/agents-cli/skills/pdf/SKILL.md
apps/agents-cli/skills/skill-creator/SKILL.md
apps/agents-cli/skills/tapcanvas-api/SKILL.md
apps/agents-cli/skills/tapcanvas-collage-local/SKILL.md
apps/agents-cli/skills/tapcanvas-continuity/SKILL.md
apps/agents-cli/skills/tapcanvas-demo-patterns/SKILL.md
apps/agents-cli/skills/tapcanvas-design-to-web/SKILL.md
apps/agents-cli/skills/tapcanvas-prompt-specialists/SKILL.md
apps/agents-cli/skills/tapcanvas-public-chat/SKILL.md
apps/agents-cli/skills/tapcanvas-storyboard-expert/SKILL.md
apps/agents-cli/skills/tapcanvas-video-prompting/SKILL.md
apps/agents-cli/skills/tapcanvas-visual-focus/SKILL.md
apps/agents-cli/skills/tapcanvas-workflow-orchestrator/SKILL.md
apps/agents-cli/skills/tapcanvas-replicate/SKILL.md

Metadata

Files
0
Version
1.0.0
Hash
0db11266
Indexed
2026-07-24 20:45

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-22 06:30
浙ICP备14020137号-1 $Гость$