본문으로 건너뛰기
cccskills
무료GitHub에 공개

pr-review

Review PR changes against project standards and post feedback

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구GitHub
설치 방법 보기

포함된 파일(1)

  • SKILL.md6.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

/pr-review - Pull Request Review

Review PR changes against project standards for this user-agent parsing library.

Usage

/pr-review              # Review current branch's PR
/pr-review 123          # Review PR #123
/pr-review --comment    # Post review as PR comment

Workflow

Step 1: Get PR Context (run in parallel)

# Detect repo
REPO=$(git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/' | sed 's/.*github.com[:/]\(.*\)/\1/')

gh pr view --json number,title,baseRefName,headRefName,files
git diff origin/main...HEAD --name-only
git diff origin/main...HEAD --stat

If a PR number was provided, use gh pr view <number> and gh pr diff <number> instead.

Step 2: Categorize Changed Files

CategoryPatterns
Parser Coreuser_agent_parser/parser.py
Advanced Engineuser_agent_parser/advanced_engine.py
Analyticsuser_agent_parser/analytics.py
Public APIuser_agent_parser/__init__.py
Constants/Devicesuser_agent_parser/constants.py, user_agent_parser/modern_devices.py
Teststests/**/*.py
CI/Config.github/workflows/*, pyproject.toml, poetry.lock
Docs*.md, CHANGELOG.md

Step 3: Apply Review Checks

Read changed files and verify against these standards:

Regex & Parser Correctness

CheckStandard
Regex testedEvery new/changed regex has real UA string test cases
browser_rules orderNew entries don't break priority (Edge before Chrome, Chrome before Safari, etc.)
_token boundsEvery self._token[n] access has len() guard
Compiled patternsHot-path regex uses cached compiled patterns, not re.compile() per call
ReDoS safetyNo nested quantifiers or overlapping alternations that cause catastrophic backtracking

Backward Compatibility

CheckStandard
parse() 7-tupleparse() still returns (browser, browser_version, os, os_version, device_type, device_name, device_host)
Public API stableFunctions in __init__.py / __all__ unchanged in signature
AdvancedResult fieldsNo removed/renamed fields in AdvancedResult, BrowserCapabilities, SecurityFingerprint
DeviceCategory enumNo removed/renamed enum values, only additions
Constants immutableOS, DeviceType, DeviceName attributes not changed, only extended

Python 3.8+ Compatibility

CheckStandard
No match/casematch/case requires 3.10+ — use if/elif
No union syntaxX | Y in types requires 3.10+ — use Union[X, Y]
No TypeAliasRequires 3.10+ — use plain assignment
No ParamSpecRequires 3.10+ — use typing_extensions if needed

Cache Safety

CheckStandard
lru_cache returns immutableCached functions return tuples, not lists/dicts/sets
Cache key hashableAll arguments to cached functions are hashable
No cache side effectsCached functions are pure (no mutations, no I/O)

Test Coverage

CheckStandard
New features testedNew parser/engine features have parametrized test cases
Real UA stringsTests use real-world user agent strings, not fabricated ones
Edge cases coveredEmpty string, None, very long strings, missing parentheses
New source filesNew .py files in user_agent_parser/ have test coverage

Thread Safety

CheckStandard
Batch processingThreadPoolExecutor usage includes proper cleanup (with statement)
No shared mutationBatch operations don't share mutable state across threads

Code Quality

CheckStandard
Type hintsPublic functions have parameter and return type hints
CHANGELOGNon-trivial changes have CHANGELOG.md entry
Device code formatMOBILE_DEVICE_CODE_NAME entries follow key→name format, no duplicates
Consistent namingNew methods/constants follow existing naming patterns

Step 4: Generate Report

Structure findings by severity:

## PR Review: #<number> - <title>

**Files Changed:** N | **Additions:** +N | **Deletions:** -N

### 🔴 Critical (blocks merge)
- [ ] `user_agent_parser/parser.py:78` - `self._token[3]` accessed without bounds check
- [ ] `user_agent_parser/__init__.py:15` - `parse()` return changed from 7-tuple to 8-tuple — breaks all consumers
- [ ] `user_agent_parser/parser.py:45` - New browser regex `(Chrome|CriOS)(\d+)*` has nested quantifier — ReDoS risk

### 🟡 Standards (should fix)
- [ ] `user_agent_parser/advanced_engine.py:120` - Uses `match/case` — Python 3.10+ only, project supports 3.8+
- [ ] `tests/test_user_agent_parser.py` - New Brave detection has no parametrized test cases
- [ ] Missing CHANGELOG.md entry for new feature

### 🟢 Suggestions (nice to have)
- [ ] `user_agent_parser/parser.py:90` - Add type hint to `get_device_name()` return
- [ ] `user_agent_parser/advanced_engine.py:45` - Browser detection duplicates logic from parser.py — consider reuse

---
**Verdict:** APPROVE | REQUEST_CHANGES | COMMENT
*Review based on project standards in CLAUDE.md*

Step 5: Determine Verdict

ConditionVerdict
No critical issues, 0-2 standards issuesAPPROVE
No critical issues, 3+ standards issuesCOMMENT
Any critical issuesREQUEST_CHANGES

Step 6: Post Comment (if --comment)

Based on verdict:

# Clean — approve
gh pr review <number> --approve --body "$(cat <<'EOF'
<review-report>
EOF
)"

# Suggestions only — comment
gh pr review <number> --comment --body "$(cat <<'EOF'
<review-report>
EOF
)"

# Critical issues — request changes
gh pr review <number> --request-changes --body "$(cat <<'EOF'
<review-report>
EOF
)"

Quick Reference: What to Check by File

FileKey Checks
parser.pyRegex correctness, browser_rules order, _token bounds, lru_cache mutation, compiled pattern caching
advanced_engine.pyAdvancedResult field stability, confidence bounds [0,1], DeviceCategory enum stability, ThreadPoolExecutor cleanup
analytics.pyThread safety in BatchProcessor, export format correctness
constants.pyNo changed existing values, consistent MOBILE_DEVICE_CODE_NAME format, no duplicate keys
modern_devices.pyDeviceSpec format consistency
__init__.pyPublic API unchanged, all consistent, parse() 7-tuple preserved
tests/*.pyParametrized with real UA strings, edge cases covered, backward compat verified
CHANGELOG.mdEntry exists for non-trivial changes
.github/workflows/*Python version matrix includes 3.8–3.15, codecov integration intact
pyproject.tomlPython requirement still >=3.8, no incompatible dependency versions

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

commit

무료

Create well-formatted git commits following project conventions with emoji, type, and scope

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Purushot14/user-agent-parser62026년 3월 18일 업데이트

pr

무료

Create or update a pull request from current branch to origin main with auto-generated title and description

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Purushot14/user-agent-parser62026년 3월 18일 업데이트

review

무료

Review working changes - code quality, security, library correctness, and standards auto-fix

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Purushot14/user-agent-parser62026년 3월 18일 업데이트

Purushot14의 스킬 모두 보기

이 스킬의 문제 신고