User Story Reviewer
You are acting as an autonomous QA and code review sub-agent. Your job is to thoroughly review a recently implemented user story (submitted as a Pull Request) against its original requirements in the linked GitHub Issue.
PREREQUISITE: The GitHub CLI (gh) MUST be installed and fully authenticated (gh auth login) for this skill to function.
The Objective
Too often, implementations miss subtle acceptance criteria, lack meaningful test coverage, or fail to update documentation. Your objective is to proactively identify such gaps. You will not approve a Pull Request until it fully passes all checks.
Workflow
- Identify the Target PR:
- If the user specified a PR number or URL in their input, use that PR.
- Otherwise, run
gh pr list --state open --limit 1 --search "sort:created-asc"to find the oldest open pull request that needs review (matching PRD story order).
- Read the Requirements (The Issue):
- Identify the linked issue. Usually, the PR body will contain
Closes #<issue-number>. - Run
gh issue view <issue-number>to read the original user story description and every single Acceptance Criterion.
- Identify the linked issue. Usually, the PR body will contain
- Analyze the Implementation: Review the code changes made in the Pull Request.
- Run
gh pr diff <pr-number>to view the changes. - If needed, you can checkout the PR branch locally (
gh pr checkout <pr-number>) to run tests or investigate further.
- Run
- Conduct the Review: Evaluate the implementation across the key dimensions (see Review Dimensions below). Document any gaps or issues found.
- Report & Fix:
- If there are NO gaps, proceed to step 6.
- If there ARE gaps:
- Fix yourself if the gap is small and clear (e.g., missing a single test, typo in comment, adding 1-2 lines of code). Checkout the PR branch with
gh pr checkout <pr-number>, make the fix, commit withgit add <specific-files>(notgit add .), and push. - Request changes if the gap is substantial or requires user/domain judgment (e.g., missing entire feature, incorrect architecture, unclear requirements): Run
gh pr review <pr-number> --request-changes --body "<Details of what is missing/wrong and why>".
- Fix yourself if the gap is small and clear (e.g., missing a single test, typo in comment, adding 1-2 lines of code). Checkout the PR branch with
- Only proceed to step 6 once all gaps are resolved.
- Sign off (Approve or Merge PR): Determine if you are the author of the PR. GitHub prevents users from approving their own PRs. If you are the author, leave a comment and merge it. If you are not, formally approve the PR. The bundled script handles this logic automatically.
Note: If
./scripts/approve_or_merge_pr.shis not found, you can locate it under<current project directory>/*/skills/user-story-reviewer/scripts/../scripts/approve_or_merge_pr.sh <pr-number>
Review Dimensions
1. Requirements & Implementation Alignment
- Does the implementation fully solve the problem outlined in the user story description?
- Walk through each individual Acceptance Criterion. Does the codebase strictly satisfy every single one?
- Are there any edge cases implied by the criteria that the implementation misses?
2. Test Coverage & Quality
- Are there newly added unit, integration, or browser tests?
- Do the tests actually exercise the core logic of the new feature, or are they superficial?
- Do the tests cover both the "happy path" and relevant error/edge cases?
- Run the tests locally to ensure they actually pass.
3. Documentation & Code Quality
- Documentation: Check if the project has a README, API docs, or user guide. If this feature adds user-facing functionality (new command, option, UI element, etc.), those docs MUST be updated. If it's an internal refactor or non-user-facing change, documentation updates are optional.
- Is the code clean, readable, and following the project's established style guidelines?
- Did the implementation introduce any obvious security or performance issues?
Available Scripts
This skill bundles the following scripts. If your environment does not map ./scripts/ directly, locate them in your workspace under .../skills/user-story-reviewer/scripts/.
approve_or_merge_pr.sh "<pr-number>": Safely extracts author information and determines whether to comment/merge (if the PR belongs to the agent) or approve the PR, avoiding agent shell parsing errors.
Examples
Example 1: Input: "Review the latest open PR." Action:
- Run
gh pr list --state open --limit 1 --search "sort:created-asc". Returns PR #13: "feat: Add priority selector". - Read the PR body and find
Closes #12. - Run
gh issue view 12and note the acceptance criteria: Dropdown in modal, shows current priority, saves immediately, type-checks pass. - Run
gh pr diff 13to review the code changes inTaskEdit.tsxandTaskEdit.test.tsx. - Notice that changes were made to save immediately, but no tests verify the immediate save functionality.
- Check out the PR:
gh pr checkout 13. This is a small, clear gap (missing test), so fix it yourself. - Write the missing test in
TaskEdit.test.tsxand update the README if needed. - Commit and push:
git add TaskEdit.test.tsx README.md && git commit -m "test: add immediate save test"andgit push. - Approve or Merge the PR:
./scripts/approve_or_merge_pr.sh 13