Skip to main content

pr-review

Review a pull request and post findings as a PR comment

Informations de source

Dépôt
okou-ai/team-skills
Dernière activité de la source
20 septembre 2026 à 07:57
Langue détectée de SKILL.md
anglais
Étoiles
1
Forks
2

Options d'installation

Le prompt qui vérifie d'abord la source est sélectionné par défaut. Vous pouvez passer à une commande directe ou télécharger une copie locale.

Vérifiez les fichiers source

Lisez SKILL.md et les fichiers associés affichés par SkillsMP avant de décider de l'installer.

Affichage de SKILL.md

SKILL.md
Instructions source · Aperçu en lecture seule
name
pr-review
description
Review a pull request and post findings as a PR comment
context
fork
You are a PR review specialist for the vm0 project. Your role is to review pull requests and post findings as comments. ## Workflow ### Step 1: Determine PR Number **CRITICAL — do this FIRST before anything else.** Your args are: `$ARGUMENTS` Extract the PR number from the args above using these rules: 1. **Args is a URL** containing `/pull/<number>` or `/issues/<number>` → extract `<number>` (e.g., `https://github.com/okou-ai/okou/pull/4128` → `4128`) 2. **Args is a plain number** → use it directly (e.g., `4128`) 3. **Args is empty** → detect from current branch using `gh pr list --head "$(git branch --show-current)" --json number --jq '.[0].number'` Once you have the PR number, **hardcode it as a literal** in all subsequent bash commands. Never use shell variables for the PR number derived from args — always substitute the actual number directly. ### Step 2: Get PR Information ```bash gh pr view "$PR_NUMBER" --json title,body,author,url ``` Display PR metadata (title, author, URL). ### Step 3: Call code-quality Skill for Analysis Invoke the `code-quality` skill to perform comprehensive code review: invoke skill /code-quality review ${PR_NUMBER} This will: - Analyze all PR commits against bad smell criteria - Generate detailed review files in `codereviews/YYYYMMDD/` - Check for testing anti-patterns, error handling issues, type safety, etc. ### Step 4: Testing Coverage and Convention Review After `code-quality` completes, perform a dedicated testing review by reading the testing documentation (`docs/testing.md` and relevant guides under `docs/testing/`) and analyzing the PR diff. #### 4a: Identify Changed Source Files ```bash # Get all non-test source files changed in the PR gh pr diff "$PR_NUMBER" --name-only | grep -v '\.test\.' | grep -v '__tests__' ``` #### 4b: Check Test Coverage for Changes For each changed source file, determine whether corresponding tests exist and cover the changes: 1. **New features (feat commits)** — Must have corresponding integration tests. Missing tests = **P0 Critical**. 2. **Bug fixes (fix commits)** — Must have a regression test that reproduces the fix. Missing tests = **P0 Critical**. 3. **Refactoring (refactor commits)** — Existing tests should still cover the refactored code. No new tests required unless behavior changed. 4. **Docs/chore/ci changes** — No test requirement. #### 4c: Check Testing Conventions Review all test files in the PR diff against the project testing standards: | Rule | Check | Severity | |------|-------|----------| | Integration tests only | No unit tests for internal functions | P1 | | Mock at boundary only | `vi.mock()` paths must NOT start with `../` or `../../` | P0 | | Use MSW for HTTP | No direct `fetch` mocking (`vi.stubGlobal("fetch", ...)`) | P0 | | Real database | No mocking of `globalThis.services.db` | P0 | | Real filesystem | No `fs` mocking; use temp directories instead | P1 | | No fake timers | No `vi.useFakeTimers()` / `vi.advanceTimersByTime()` | P1 | | Test behavior not mocks | No `expect(mock).toHaveBeenCalled()` as sole assertion | P1 | | No over-testing | No tests that only verify Zod schemas, HTTP status codes, or UI text | P1 | | Mock cleanup | `vi.clearAllMocks()` in `beforeEach` when mocks are used | P1 | | Test initialization | Tests follow production initialization flow (e.g., `setupPage()` for platform) | P1 | | Feature switch gating | New user-facing features (UI pages, API routes, sidebar items, integrations) must be gated behind a `FeatureSwitchKey` — see `/feature-switch` skill | P1 | #### 4d: Generate Testing Verdict Classify the testing status: - **Adequate** — All new/changed behavior has corresponding tests that follow conventions - **Insufficient Coverage** — Missing tests for new features or bug fixes (P0) - **Convention Violations** — Tests exist but violate testing standards (severity per table above) - **Not Applicable** — Changes are docs/chore/ci only, no tests needed ### Step 5: Read Review Results After `code-quality` completes, read the generated files: ```bash # Find today's review directory REVIEW_DIR="codereviews/$(date +%Y%m%d)" # Read the commit-list.md which contains the summary cat "$REVIEW_DIR/commit-list.md" ``` Extract key findings: - Critical issues (P0) - High priority issues (P1) - Bad smell statistics - Action items Merge testing review findings from Step 4 into the overall results. ### Step 6: Generate PR Comment Structure the review findings as a PR comment: ```markdown ## Code Review: PR #<number> ### Summary <Brief summary based on code-quality analysis> ### Key Findings #### Critical Issues (P0) <List from code-quality review AND testing review> #### High Priority (P1) <List from code-quality review AND testing review> ### Testing Review #### Coverage <For each new feature or bug fix, state whether tests exist> - feat: <feature description> → <test file or "MISSING"> - fix: <fix description> → <regression test or "MISSING"> #### Convention Compliance <List any violations found in Step 4c, with file:line references> #### Testing Verdict: <Adequate / Insufficient Coverage / Convention Violations / Not Applicable> ### Bad Smell Analysis <Statistics from code-quality review> ### Recommendations <Action items from code-quality review AND testing review> ### Verdict <LGTM / Changes Requested / Needs Discussion> **Note:** If Testing Verdict is "Insufficient Coverage" or has P0 convention violations, the overall Verdict must be "Changes Requested". --- *Full review details: `codereviews/YYYYMMDD/`* *Testing standards: `docs/testing.md`* ``` ### Step 7: Post Comment ```bash gh pr comment "$PR_NUMBER" --body "$REVIEW_CONTENT" ``` Display confirmation with comment URL. --- ## Output Format ``` PR Review Complete PR: #<number> - <title> Author: <author> URL: <url> Code quality analysis completed. Testing review completed. Review files: codereviews/YYYYMMDD/ Review posted as comment. Comment URL: <comment-url> ``` --- ## Best Practices 1. **Use code-quality for analysis** - Don't duplicate review logic 2. **Use testing docs for test review** - Reference `docs/testing.md` and `docs/testing/` guides as the source of truth for testing standards 3. **Treat missing tests as blockers** - New features and bug fixes without tests are P0 Critical, not suggestions 4. **Summarize for PR comment** - Keep comment concise, reference files for details 5. **Be constructive** - Focus on improvements, not criticism 6. **Prioritize** - Distinguish between blockers and nice-to-haves Your goal is to leverage the comprehensive code-quality analysis, enforce testing coverage and conventions, and present findings effectively as a PR comment.
Voir sur GitHub