بنقرة واحدة
review-pr
Perform a structured code review of an E2SAR GitHub PR and post inline + summary comments
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Perform a structured code review of an E2SAR GitHub PR and post inline + summary comments
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | review-pr |
| description | Perform a structured code review of an E2SAR GitHub PR and post inline + summary comments |
| user-invocable | true |
| argument-hint | <PR-number> |
| allowed-tools | Bash, Read, Glob, Grep |
Perform a thorough, structured code review of E2SAR pull request $ARGUMENTS and post actionable GitHub comments.
gh pr view $ARGUMENTS --json number,title,body,author,baseRefName,headRefName
gh repo view --json nameWithOwner --jq '.nameWithOwner' # capture as REPO
gh api repos/REPO/pulls/$ARGUMENTS/files --jq '.[].filename'
Display a summary to the user: PR title, author, base branch, files changed.
To read the actual changed lines for a file, use the per-file patch from the API — do not parse gh pr diff with awk, as range patterns silently drop content when the next diff --git header is adjacent:
# All patches at once (good for small PRs)
gh api repos/REPO/pulls/$ARGUMENTS/files --jq '.[] | {path: .filename, patch: .patch}'
# One file at a time
gh api repos/REPO/pulls/$ARGUMENTS/files \
--jq '.[] | select(.filename == "path/to/file.cpp") | .patch'
Group the changed files by type and apply the matching checklist in Step 3:
| Pattern | Checklist |
|---|---|
include/*.hpp, src/*.cpp | C++ style + docs |
src/pybind/py_*.cpp | pybind11 bindings |
test/py_test/test_*.py | pytest conventions |
test/*.cpp | Boost.Test conventions |
meson.build | Build system |
RELEASE-NOTES.md, VERSION.txt | Version hygiene |
For context on project conventions, read the relevant reference files as needed:
include/e2sarError.hpp — E2SARErrorc enum and E2SARErrorInfoinclude/e2sarURI.hpp — naming/docs conventionsinclude/e2sarDPSegmenter.hpp — Flags struct, thread state, atomicsinclude/e2sarCP.hpp — gRPC result<T> patternsrc/pybind/py_e2sarDP.cpp — pybind11 patternstest/py_test/test_b2b_DP.py — pytest helper/marker conventionstest/py_test/pytest.ini — official list of valid pytest markersinclude/*.hpp, src/*.cpp)Naming conventions
Segmenter, LBManager)openAndStart(), sendEvent()); private helpers prefixed with _ (_open(), _threadBody())get_ prefix; setters: set_ prefix; boolean queries: has_ / is prefix_t suffix (EventNum_t, UnixTimeNano_t)Documentation
/** ... */ block with @param per parameter and @returnnoexcept methods must be declared as such in the signature/** Don't want to copy... */ commentError handling
E2SARException on failure — must not silently swallow errorsresult<T> must be marked noexceptresult<T> must check has_error() before .value(); direct .value() without check is a bugE2SARErrorc enum in include/e2sarError.hpp; never return raw -1Memory and thread safety
std::atomic<> or a mutexstd::unique_ptr; shared ownership uses std::shared_ptrstd::move; never pass by copy if avoidablenew without a corresponding delete or RAII wrapper is a memory leak; use std::unique_ptr<T> or pool allocatorHeader structure
#ifndef E2SAR<NAME>HPP / #define E2SAR<NAME>HPPusing namespace declarations inside namespace e2sar {} only; never at global scope in headers"string"s literals require using namespace std::string_literals; in scopesrc/pybind/py_*.cpp).def()get_instance_token, set_instance_token).value("admin", ...))py::gil_scoped_acquire)py::buffer_info and cast through buf_info.ptrtest/py_test/test_*.py)"""Test <thing being tested>.""" docstringpytest.ini: @pytest.mark.unit, @pytest.mark.b2b, @pytest.mark.cp, or @pytest.mark.lb-b2bresult<T> return values must be checked: assert res.has_error() is False, f"{res.error().message}"test_ prefixtest/*.cpp)BOOST_AUTO_TEST_CASE should test one logical thingBOOST_CHECK_* / BOOST_REQUIRE_* macros, not raw asserttest/meson.build with suite: 'unit' or suite: 'live'meson.build)meson.build sources: array (silently excluded otherwise)test('Name', exe, suite: 'unit|live')dependency('name', version: '>=x.y.z') patterncompiler.has_header() / compiler.compiles() guardslink_args: linker_flags must be included for all executables/libraries that link e2sarRELEASE-NOTES.md, VERSION.txt)VERSION.txt must be updated if the PR introduces a new releaseRELEASE-NOTES.md entry must match the version in VERSION.txta1, b1) must be removed before a final release commitFor each issue found, post an inline brief comment using the GitHub API. Determine the commit SHA and file path from the diff.
First, get the latest commit SHA on the PR head:
gh pr view $ARGUMENTS --json headRefOid --jq '.headRefOid'
Then post each inline comment:
gh api repos/{owner}/{repo} --method GET --jq '.full_name'
# Use the returned full_name as REPO below
gh api repos/REPO/pulls/$ARGUMENTS/comments \
--method POST \
--field body='COMMENT_TEXT' \
--field commit_id='HEAD_SHA' \
--field path='FILE_PATH' \
--field line=LINE_NUMBER \
--field side='RIGHT'
Get REPO once with:
gh repo view --json nameWithOwner --jq '.nameWithOwner'
Use this comment templates (adapt the specific details):
C++ naming (private helper):
parseFromStringshould be_parseFromString— private helpers use the_prefix. SeeSegmenter::_open()for the convention.
Missing Doxygen:
Public method
computeChecksum()is missing a/** ... */Doxygen block. Add@paramfor each argument and@returndescribing the result.
result misuse:
res.value()is called without checkingres.has_error()first. This will throw if the call fails. Wrap inif (!res.has_error()) { ... }or assert.
noexcept missing:
This method returns
result<T>but isn't markednoexcept. Allresult<T>-returning methods should benoexcept— exceptions are encoded in the result type.
Thread safety:
This counter is incremented from multiple threads without synchronization. Use
std::atomic<uint64_t>as done inSegmenter::AtomicStats::errCnt.
Missing test marker:
This test function has no pytest marker. Add
@pytest.mark.unit(or the appropriate category) so it's included in the right test suite.
Binding docstring missing:
.def("methodName", ...)is missing a docstring. Add a brief description as the last string argument.
Build file omission:
new_module.cppis not listed insrc/meson.build's source list. It will be silently excluded from the build.
Error code missing:
This failure path returns a raw value instead of
E2SARErrorInfo{E2SARErrorc::SocketError, "..."}. Use the proper error type.
Memory leak risk:
Raw
newwithout a correspondingdeleteor RAII wrapper. Usestd::unique_ptr<T>or the existing pool allocator.
After all inline comments, post one top-level PR comment with the overall assessment. Use a heredoc to avoid quoting failures when the body contains single quotes or backticks:
gh pr comment $ARGUMENTS --body "$(cat <<'EOF'
SUMMARY
EOF
)"
The summary must include:
> Review generated by /review-pr skill — verify all inline comments before merging.gh repo view — never hardcode it$ARGUMENTS is empty or not a valid PR number, ask the user for the PR number before proceeding