本文へ移動
cccskills
無料GitHub で公開

pr-review

Review PR changes against project standards and post feedback

インストール方法を見る

含まれるファイル(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

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

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 のスキルをすべて見る

このスキルの問題を報告する