Chuyển đến nội dung
Skillpedia
Kiểm thử260k · #622

requesting-code-review

Skill này làm gì

Skill này giúp AI của bạn xác minh các thay đổi code trước khi chúng được commit hoặc push. Skill dành cho lập trình viên muốn có thêm một cặp mắt và các kiểm tra tự động trước khi công việc của họ đi vào dự án.

Khi nào nên dùng

  • ✓Khi bạn sắp commit, push hoặc phát hành các thay đổi code trong một kho git.
  • ✓Khi bạn hoàn thành một tính năng hoặc bản sửa lỗi chạm đến nhiều file và muốn nó được xác minh.
  • ✓Khi bạn muốn AI kiểm tra thay đổi của bạn xem có mật khẩu viết cứng và vấn đề chất lượng không.

Liên kết skill

https://github.com/NousResearch/hermes-agent/blob/main/skills/software-development/requesting-code-review/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/NousResearch/hermes-agent/blob/main/skills/software-development/requesting-code-review/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Trước khi tôi commit, kiểm tra các thay đổi đã stage của tôi xem có vấn đề bảo mật hoặc chất lượng không, và sửa mọi thứ đơn giản.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill đọc diff đã stage, quét các dòng được thêm để tìm mẫu rủi ro như mật khẩu viết cứng, chạy các cổng kiểm tra chất lượng và nhờ một agent review mới kiểm tra công việc. Sau đó nó có thể sửa các vấn đề tìm thấy.

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.

Pre-Commit Code Verification

Automated verification pipeline before code lands. Static scans, baseline-aware quality gates, an independent reviewer subagent, and an auto-fix loop.

Core principle: No agent should verify its own work. Fresh context finds what you miss.

When to Use

  • After implementing a feature or bug fix, before git commit or git push
  • When user says "commit", "push", "ship", "done", "verify", or "review before merge"
  • After completing a task with 2+ file edits in a git repo
  • After each task in subagent-driven-development (the two-stage review)

Skip for: documentation-only changes, pure config tweaks, or when user says "skip verification".

This skill vs github: This skill verifies YOUR changes before committing. github reviews OTHER people's PRs on GitHub with inline comments.

Step 1 — Get the diff

git diff --cached

If empty, try git diff then git diff HEAD~1 HEAD.

If git diff --cached is empty but git diff shows changes, tell the user to git add <files> first. If still empty, run git status — nothing to verify.

If the diff exceeds 15,000 characters, split by file:

git diff --name-only
git diff HEAD -- specific_file.py

Step 2 — Static security scan

Scan added lines only. Any match is a security concern fed into Step 5.

# Hardcoded secrets
git diff --cached | grep "^+" | grep -iE "(api_key|secret|password|token|passwd)\s*=\s*['\"][^'\"]{6,}['\"]"

# Shell injection
git diff --cached | grep "^+" | grep -E "os\.system\(|subprocess.*shell=True"

# Dangerous eval/exec
git diff --cached | grep "^+" | grep -E "\beval\(|\bexec\("

# Unsafe deserialization
git diff --cached | grep "^+" | grep -E "pickle\.loads?\("

# SQL injection (string formatting in queries)
git diff --cached | grep "^+" | grep -E "execute\(f\"|\.format\(.*SELECT|\.format\(.*INSERT"

Step 3 — Baseline tests and linting

Detect the project language and run the appropriate tools. Capture the failure count BEFORE your changes as baseline_failures (stash changes, run, pop). Only NEW failures introduced by your changes block the commit.

Test frameworks (auto-detect by project files):

# Python (pytest)
python -m pytest --tb=no -q 2>&1 | tail -5

# Node (npm test)
npm test -- --passWithNoTests 2>&1 | tail -5

# Rust
cargo test 2>&1 | tail -5

# Go
go test ./... 2>&1 | tail -5

Linting and type checking (run only if installed):

# Python
which ruff && ruff check . 2>&1 | tail -10
which mypy && mypy . --ignore-missing-imports 2>&1 | tail -10

# Node
which npx && npx eslint . 2>&1 | tail -10
which npx && npx tsc --noEmit 2>&1 | tail -10

# Rust
cargo clippy -- -D warnings 2>&1 | tail -10

# Go
which go && go vet ./... 2>&1 | tail -10

Baseline comparison: If baseline was clean and your changes introduce failures, that's a regression. If baseline already had failures, only count NEW ones.

Step 4 — Self-review checklist

Quick scan before dispatching the reviewer:

  • No hardcoded secrets, API keys, or credentials
  • Input validation on user-provided data
  • SQL queries use parameterized statements
  • File operations validate paths (no traversal)
  • External calls have error handling (try/catch)
  • No debug print/console.log left behind
  • No commented-out code
  • New code has tests (if test suite exists)

Step 5 — Independent reviewer subagent

Interactive sessions only. In a one-shot run (hermes chat -q, --oneshot, a benchmark harness) there is no one to hand the verdict to and a fresh subagent re-pays the whole system prompt plus a repo re-read: skip Steps 5 and 7, apply the Step 4 checklist to the diff yourself, run the tests, and go to Step 8.

Call delegate_task directly — it is NOT available inside execute_code or scripts.

The reviewer gets ONLY the diff and static scan results. No shared context with the implementer. Fail-closed: unparseable response = fail.

delegate_task(
    goal="""You are an independent code reviewer. You have no context about how
these changes were made. Review the git diff and return ONLY valid JSON.

FAIL-CLOSED RULES:
- security_concerns non-empty -> passed must be false
- logic_errors non-empty -> passed must be false
- Cannot parse diff -> passed must be false
- Only set passed=true when BOTH lists are empty

SECURITY (auto-FAIL): hardcoded secrets, backdoors, data exfiltration,
shell injection, SQL injection, path traversal, eval(
Câu hỏi thường gặp

Khi nào tôi có thể bỏ qua?

Skill cho biết nên bỏ qua với thay đổi chỉ là tài liệu hoặc chỉnh sửa cấu hình đơn giản, hoặc khi bạn yêu cầu bỏ qua.

Vì sao dùng một người review riêng?

Skill cho biết không agent nào nên tự kiểm tra công việc của mình, nên một ngữ cảnh mới sẽ tìm ra vấn đề mà tác giả có thể bỏ sót.

Nó có review pull request của người khác không?

Không. Skill cho biết skill github xử lý việc review pull request của người khác.

Chi tiết

Mô tả gốc của tác giả

Pre-commit review: security scan, quality gates, auto-fix.

repo: NousResearch/hermes-agent

Độ phổ biến

Sao GitHub
260k
Vị trí xếp hạng
#622
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự