|
| 1 | +--- |
| 2 | +name: maintainer-pr-review |
| 3 | +description: Review CausalPy pull requests end-to-end by classifying PR type, checking branch freshness, mergeability, remote CI, correctness, security, tests, docs, and maintainer concerns. Use when asked to review a PR, assess a branch before merge, summarize PR risks, or request changes. |
| 4 | +--- |
| 5 | + |
| 6 | +# Maintainer PR Review |
| 7 | + |
| 8 | +Use this skill to evaluate whether a PR is correct, safe, understandable, and merge-ready. This is a review workflow, not primarily a fix workflow. |
| 9 | + |
| 10 | +## Boundary |
| 11 | + |
| 12 | +- If the user asks to review, assess, summarize risks, or decide whether a PR is ready to merge, use this skill. |
| 13 | +- If the user asks to make the PR green by fixing CI, conflicts, or review comments, use `pr-to-green` for CausalPy-specific greening work. |
| 14 | +- For continuous merge-readiness monitoring, repeat this skill's intake, CI, and comment checks on a cadence. If the repository later adds a dedicated monitoring skill, prefer that. |
| 15 | +- If the review uncovers clear, small fixes and the user asked you to fix them, keep changes scoped to the PR's intent and follow the repo's commit and `prek` rules. |
| 16 | +- Never post review comments, approve, request changes, or merge through GitHub without explicit human approval. |
| 17 | +- Do not duplicate mechanical checks already covered by hooks and CI. If a recurring issue is mechanically enforceable but not enforced, recommend a follow-up issue instead of treating each instance as bespoke review work. |
| 18 | + |
| 19 | +## Intake |
| 20 | + |
| 21 | +Follow `resources/workflow.md` for the full workflow. At a glance: |
| 22 | + |
| 23 | +1. Identify the PR number or current branch, base branch, head branch, and whether the branch tracks a remote. |
| 24 | +2. Inspect the local working tree before any git operation and preserve unrelated local changes. |
| 25 | +3. Fetch PR metadata, commits, reviews, issue comments, changed files, mergeability, and check summary. |
| 26 | +4. Check whether the branch is behind its base and whether GitHub reports conflicts. Do not resolve conflicts as part of review unless explicitly asked; report conflict risk and recommend `pr-to-green` when needed. |
| 27 | +5. Check remote CI with `gh pr checks` or the equivalent GitHub command. Distinguish failed, pending, skipped, and missing required checks. |
| 28 | +6. Inspect the full PR diff against the base branch, not only the latest commit. |
| 29 | +7. Verify contributor claims against code, tests, and branch history before accepting them. |
| 30 | + |
| 31 | +## Classify the PR |
| 32 | + |
| 33 | +Classify the PR by its dominant risk profile, then read the matching resource file. For mixed PRs, read every relevant resource before reviewing. |
| 34 | + |
| 35 | +- Feature implementation: read `resources/pr-type-features.md`. |
| 36 | +- Bug fix: read `resources/pr-type-bug-fixes.md`. |
| 37 | +- Refactor: read `resources/pr-type-refactors.md`. |
| 38 | +- Docs or notebooks: read `resources/pr-type-docs-notebooks.md`. |
| 39 | +- Data or dataset changes: read `resources/pr-type-data-datasets.md`. |
| 40 | +- Tests, CI, packaging, or infrastructure: read `resources/pr-type-tests-ci-infra.md`. |
| 41 | + |
| 42 | +When classification is unclear, state the likely categories and review against the stricter applicable checklist. |
| 43 | + |
| 44 | +## Deep Dives |
| 45 | + |
| 46 | +Read these when the PR touches the relevant surface: |
| 47 | + |
| 48 | +- CausalPy source-code conventions: `resources/code-patterns.md`. |
| 49 | +- Documentation and notebook conventions: `resources/docs-patterns.md`. |
| 50 | +- Severity-sorted recurring review patterns: `resources/review-patterns.md`. |
| 51 | +- Drafting or posting review comments: `resources/review-comments.md`. |
| 52 | +- Updating this skill with recurring patterns: `resources/maintenance.md`. |
| 53 | + |
| 54 | +## Universal Checks |
| 55 | + |
| 56 | +- Correctness: the implementation matches the PR's stated intent, handles important edge cases, and does not introduce silent behavior changes. |
| 57 | +- Security and privacy: no secrets, credentials, tokens, private data, unsafe deserialization, command injection, path traversal, or unnecessary network access. |
| 58 | +- Causal/statistical accuracy: causal claims, model assumptions, estimands, priors, simulations, and examples are technically accurate and not overstated. |
| 59 | +- Public API: released APIs remain compatible unless the PR intentionally changes them and documents the change; new public APIs have explicit signatures and documentation. |
| 60 | +- Tests: behavior changes have meaningful tests in `causalpy/tests/`; PyMC-heavy tests use runtime-controlled `sample_kwargs`; no throwaway verification scripts are added. |
| 61 | +- Docs: user-facing behavior changes have docs or examples where appropriate; docs follow CausalPy notebook, MyST, glossary, and citation conventions. |
| 62 | +- Dependencies and packaging: new dependencies are justified, declared in the right place, and do not duplicate existing tools. |
| 63 | +- Performance and runtime: expensive sampling, notebook execution, data loading, and CI changes are bounded and justified. |
| 64 | +- Maintainability: the change follows local patterns, avoids broad unrelated refactors, and keeps ownership boundaries clear. |
| 65 | + |
| 66 | +## CausalPy Review Norms |
| 67 | + |
| 68 | +- Before reviewing code, read `AGENTS.md` and relevant local context. For docs-heavy PRs, also inspect `docs/source/notebooks/index.md`; for process-sensitive PRs, inspect `CONTRIBUTING.md` when present. |
| 69 | +- Use `$CONDA_EXE run -n CausalPy <command>` for commands that import project code, run tests, build docs, or invoke repo tooling. `AGENTS.md` defines how to detect or set `CONDA_EXE`; if it is unset, inspect that environment guidance before running project commands. |
| 70 | +- Use full permissions for commands that import PyMC, PyTensor, or matplotlib to avoid false sandbox failures. |
| 71 | +- During review, prefer targeted local checks that match the changed surface. If you edit code or prepare a commit, run `prek run` during iteration and `prek run --all-files` before handoff unless the user explicitly says not to. |
| 72 | +- For markdown-only skill or docs changes, a structural read-back may be enough; report when full checks were not run and why. |
| 73 | + |
| 74 | +## Review Output |
| 75 | + |
| 76 | +Lead with findings, ordered by severity. If there are no findings, say so clearly and mention residual risk or checks not run. |
| 77 | + |
| 78 | +Use this structure: |
| 79 | + |
| 80 | +```markdown |
| 81 | +## Findings |
| 82 | +- [severity] `path`: issue, why it matters, and what should change. |
| 83 | + |
| 84 | +## Merge Readiness |
| 85 | +Verdict: approve / request changes / blocked / needs maintainer decision. |
| 86 | +Branch status: up to date or behind base; conflicts if any. |
| 87 | +CI status: green, failing, pending, skipped, or unavailable. |
| 88 | + |
| 89 | +## PR Summary |
| 90 | +One short paragraph describing what the PR changes and why. |
| 91 | + |
| 92 | +## Test Evidence |
| 93 | +List local and remote checks observed. Include commands only when they were actually run. |
| 94 | + |
| 95 | +## Open Questions |
| 96 | +Only include questions that affect merge readiness or review confidence. |
| 97 | +``` |
| 98 | + |
| 99 | +When drafting comments for posting, show the draft to the user first and wait for approval. Preserve the distinction between the human maintainer's voice and any agent-authored review text. |
0 commit comments