|
1 | 1 | --- |
2 | | -description: Perform a local code review before pushing changes, ensuring alignment with design docs and best practices. |
| 2 | +description: Pre-push code review against design docs. |
3 | 3 | --- |
4 | 4 |
|
5 | | -# Local Code Review Assistant |
| 5 | +Perform a local code review **before** pushing changes. |
6 | 6 |
|
7 | | -You are helping me perform a local code review **before** I push changes. Please follow this structured workflow. |
8 | | - |
9 | | -## Step 1: Gather Context |
10 | | -Ask me for: |
11 | | -- Brief feature/branch description |
12 | | -- List of modified files (with optional summaries) |
13 | | -- Relevant design doc(s) (e.g., `docs/ai/design/feature-{name}.md` or project-level design) |
14 | | -- Any known constraints or risky areas |
15 | | -- Any open bugs or TODOs linked to this work |
16 | | -- Which tests have already been run |
17 | | - |
18 | | -If possible, request the latest diff: |
19 | | -```bash |
20 | | -git status -sb |
21 | | -git diff --stat |
22 | | -``` |
23 | | - |
24 | | -## Step 2: Understand Design Alignment |
25 | | -For each provided design doc: |
26 | | -- Summarize the architectural intent |
27 | | -- Note critical requirements, patterns, or constraints the design mandates |
28 | | - |
29 | | -## Step 3: File-by-File Review |
30 | | -For every modified file: |
31 | | -1. Highlight deviations from the referenced design or requirements |
32 | | -2. Spot potential logic or flow issues and edge cases |
33 | | -3. Identify redundant or duplicate code |
34 | | -4. Suggest simplifications or refactors (prefer clarity over cleverness) |
35 | | -5. Flag security concerns (input validation, secrets, auth, data handling) |
36 | | -6. Check for performance pitfalls or scalability risks |
37 | | -7. Ensure error handling, logging, and observability are appropriate |
38 | | -8. Note any missing comments or docs |
39 | | -9. Flag missing or outdated tests related to this file |
40 | | - |
41 | | -## Step 4: Cross-Cutting Concerns |
42 | | -- Verify naming consistency and adherence to project conventions |
43 | | -- Confirm documentation/comments are updated where the behavior changed |
44 | | -- Identify missing tests (unit, integration, E2E) needed to cover the changes |
45 | | -- Ensure configuration/migration updates are captured if applicable |
46 | | - |
47 | | -## Step 5: Summarize Findings |
48 | | -Provide results in this structure: |
49 | | -``` |
50 | | -### Summary |
51 | | -- Blocking issues: [count] |
52 | | -- Important follow-ups: [count] |
53 | | -- Nice-to-have improvements: [count] |
54 | | -
|
55 | | -### Detailed Notes |
56 | | -1. **[File or Component]** |
57 | | - - Issue/Observation: ... |
58 | | - - Impact: (e.g., blocking / important / nice-to-have) |
59 | | - - Recommendation: ... |
60 | | - - Design reference: [...] |
61 | | -
|
62 | | -2. ... (repeat per finding) |
63 | | -
|
64 | | -### Recommended Next Steps |
65 | | -- [ ] Address blocking issues |
66 | | -- [ ] Update design/implementation docs if needed |
67 | | -- [ ] Add/adjust tests: |
68 | | - - Unit: |
69 | | - - Integration: |
70 | | - - E2E: |
71 | | -- [ ] Rerun local test suite |
72 | | -- [ ] Re-run code review command after fixes |
73 | | -``` |
74 | | - |
75 | | -## Step 6: Final Checklist |
76 | | -Confirm whether each item is complete (yes/no/needs follow-up): |
77 | | -- Implementation matches design & requirements |
78 | | -- No obvious logic or edge-case gaps remain |
79 | | -- Redundant code removed or justified |
80 | | -- Security considerations addressed |
81 | | -- Tests cover new/changed behavior |
82 | | -- Documentation/design notes updated |
83 | | - |
84 | | ---- |
85 | | -Let me know when you're ready to begin the review. |
| 7 | +1. **Gather Context** — If not already provided, ask for: feature/branch description, list of modified files, relevant design doc(s) (e.g., `docs/ai/design/feature-{name}.md`), known constraints or risky areas, and which tests have been run. Also review the latest diff via `git status` and `git diff --stat`. |
| 8 | +2. **Understand Design Alignment** — For each design doc, summarize architectural intent and critical constraints. |
| 9 | +3. **File-by-File Review** — For every modified file: check alignment with design/requirements and flag deviations, spot logic issues/edge cases/redundant code, flag security concerns (input validation, secrets, auth, data handling), check error handling/performance/observability, and identify missing or outdated tests. |
| 10 | +4. **Cross-Cutting Concerns** — Verify naming consistency and project conventions. Confirm docs/comments updated where behavior changed. Identify missing tests (unit, integration, E2E). Check for needed configuration/migration updates. |
| 11 | +5. **Summarize Findings** — Categorize each finding as **blocking**, **important**, or **nice-to-have** with: file, issue, impact, recommendation, and design reference. |
0 commit comments