@humanbased/crosscheck 1.2.0-beta.57 → 1.2.0-beta.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +26 -0
  2. package/assets/skills/code-review/.crosscheck-skill.json +9 -0
  3. package/assets/skills/code-review/LICENSE +21 -0
  4. package/assets/skills/code-review/SKILL.md +89 -0
  5. package/assets/skills/code-review/agents/openai.yaml +3 -0
  6. package/assets/skills/code-review-skill/.crosscheck-skill.json +9 -0
  7. package/assets/skills/code-review-skill/LICENSE +21 -0
  8. package/assets/skills/code-review-skill/SKILL.md +231 -0
  9. package/assets/skills/code-review-skill/assets/pr-review-template.md +137 -0
  10. package/assets/skills/code-review-skill/assets/review-checklist.md +123 -0
  11. package/assets/skills/code-review-skill/reference/angular.md +768 -0
  12. package/assets/skills/code-review-skill/reference/architecture-review-guide.md +472 -0
  13. package/assets/skills/code-review-skill/reference/c.md +890 -0
  14. package/assets/skills/code-review-skill/reference/code-quality-universal.md +488 -0
  15. package/assets/skills/code-review-skill/reference/code-review-best-practices.md +136 -0
  16. package/assets/skills/code-review-skill/reference/common-bugs-checklist.md +286 -0
  17. package/assets/skills/code-review-skill/reference/cpp.md +893 -0
  18. package/assets/skills/code-review-skill/reference/cross-cutting/async-concurrency-patterns.md +515 -0
  19. package/assets/skills/code-review-skill/reference/cross-cutting/error-handling-principles.md +492 -0
  20. package/assets/skills/code-review-skill/reference/cross-cutting/n-plus-one-queries.md +309 -0
  21. package/assets/skills/code-review-skill/reference/cross-cutting/sql-injection-prevention.md +308 -0
  22. package/assets/skills/code-review-skill/reference/cross-cutting/xss-prevention.md +264 -0
  23. package/assets/skills/code-review-skill/reference/csharp.md +525 -0
  24. package/assets/skills/code-review-skill/reference/css-less-sass.md +661 -0
  25. package/assets/skills/code-review-skill/reference/django.md +985 -0
  26. package/assets/skills/code-review-skill/reference/fastapi.md +580 -0
  27. package/assets/skills/code-review-skill/reference/go.md +993 -0
  28. package/assets/skills/code-review-skill/reference/java.md +409 -0
  29. package/assets/skills/code-review-skill/reference/java8.md +586 -0
  30. package/assets/skills/code-review-skill/reference/kotlin.md +1018 -0
  31. package/assets/skills/code-review-skill/reference/nestjs.md +593 -0
  32. package/assets/skills/code-review-skill/reference/performance-review-guide.md +816 -0
  33. package/assets/skills/code-review-skill/reference/php.md +684 -0
  34. package/assets/skills/code-review-skill/reference/python.md +1073 -0
  35. package/assets/skills/code-review-skill/reference/qt.md +757 -0
  36. package/assets/skills/code-review-skill/reference/react.md +871 -0
  37. package/assets/skills/code-review-skill/reference/ruby.md +964 -0
  38. package/assets/skills/code-review-skill/reference/rust.md +846 -0
  39. package/assets/skills/code-review-skill/reference/security-review-guide.md +494 -0
  40. package/assets/skills/code-review-skill/reference/svelte.md +1064 -0
  41. package/assets/skills/code-review-skill/reference/swift.md +936 -0
  42. package/assets/skills/code-review-skill/reference/typescript.md +1016 -0
  43. package/assets/skills/code-review-skill/reference/vue.md +924 -0
  44. package/assets/skills/code-review-skill/reference/zig.md +440 -0
  45. package/assets/skills/code-review-skill/scripts/pr-analyzer.py +435 -0
  46. package/assets/skills/code-review-skill/scripts/test_pr_analyzer.py +380 -0
  47. package/assets/skills/codebase-design/.crosscheck-skill.json +9 -0
  48. package/assets/skills/codebase-design/DEEPENING.md +37 -0
  49. package/assets/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
  50. package/assets/skills/codebase-design/LICENSE +21 -0
  51. package/assets/skills/codebase-design/SKILL.md +114 -0
  52. package/assets/skills/codebase-design/agents/openai.yaml +3 -0
  53. package/assets/skills/diagnosing-bugs/.crosscheck-skill.json +9 -0
  54. package/assets/skills/diagnosing-bugs/LICENSE +21 -0
  55. package/assets/skills/diagnosing-bugs/SKILL.md +134 -0
  56. package/assets/skills/diagnosing-bugs/agents/openai.yaml +3 -0
  57. package/assets/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
  58. package/crosscheck.config.example.yml +10 -0
  59. package/dist/__tests__/conflict-resolve.test.js +44 -1
  60. package/dist/__tests__/conflict-resolve.test.js.map +1 -1
  61. package/dist/__tests__/fix.test.js +31 -0
  62. package/dist/__tests__/fix.test.js.map +1 -1
  63. package/dist/__tests__/onboard-preservation.test.js +5 -0
  64. package/dist/__tests__/onboard-preservation.test.js.map +1 -1
  65. package/dist/__tests__/optimize.test.js +1 -0
  66. package/dist/__tests__/optimize.test.js.map +1 -1
  67. package/dist/__tests__/repository-guidance.test.d.ts +2 -0
  68. package/dist/__tests__/repository-guidance.test.d.ts.map +1 -0
  69. package/dist/__tests__/repository-guidance.test.js +88 -0
  70. package/dist/__tests__/repository-guidance.test.js.map +1 -0
  71. package/dist/__tests__/skill-attribution.test.d.ts +2 -0
  72. package/dist/__tests__/skill-attribution.test.d.ts.map +1 -0
  73. package/dist/__tests__/skill-attribution.test.js +37 -0
  74. package/dist/__tests__/skill-attribution.test.js.map +1 -0
  75. package/dist/__tests__/skill-broker.test.d.ts +2 -0
  76. package/dist/__tests__/skill-broker.test.d.ts.map +1 -0
  77. package/dist/__tests__/skill-broker.test.js +92 -0
  78. package/dist/__tests__/skill-broker.test.js.map +1 -0
  79. package/dist/__tests__/skill-catalog.test.d.ts +2 -0
  80. package/dist/__tests__/skill-catalog.test.d.ts.map +1 -0
  81. package/dist/__tests__/skill-catalog.test.js +35 -0
  82. package/dist/__tests__/skill-catalog.test.js.map +1 -0
  83. package/dist/__tests__/skill-installer.test.d.ts +2 -0
  84. package/dist/__tests__/skill-installer.test.d.ts.map +1 -0
  85. package/dist/__tests__/skill-installer.test.js +96 -0
  86. package/dist/__tests__/skill-installer.test.js.map +1 -0
  87. package/dist/__tests__/skills-config.test.d.ts +2 -0
  88. package/dist/__tests__/skills-config.test.d.ts.map +1 -0
  89. package/dist/__tests__/skills-config.test.js +12 -0
  90. package/dist/__tests__/skills-config.test.js.map +1 -0
  91. package/dist/cli.js +7 -0
  92. package/dist/cli.js.map +1 -1
  93. package/dist/commands/onboard.d.ts +1 -0
  94. package/dist/commands/onboard.d.ts.map +1 -1
  95. package/dist/commands/onboard.js +25 -1
  96. package/dist/commands/onboard.js.map +1 -1
  97. package/dist/commands/review.d.ts.map +1 -1
  98. package/dist/commands/review.js +15 -4
  99. package/dist/commands/review.js.map +1 -1
  100. package/dist/commands/skill.d.ts +2 -0
  101. package/dist/commands/skill.d.ts.map +1 -0
  102. package/dist/commands/skill.js +16 -0
  103. package/dist/commands/skill.js.map +1 -0
  104. package/dist/commands/status.d.ts.map +1 -1
  105. package/dist/commands/status.js +10 -0
  106. package/dist/commands/status.js.map +1 -1
  107. package/dist/config/schema.d.ts +21 -0
  108. package/dist/config/schema.d.ts.map +1 -1
  109. package/dist/config/schema.js +4 -0
  110. package/dist/config/schema.js.map +1 -1
  111. package/dist/lib/repository-guidance.d.ts +2 -0
  112. package/dist/lib/repository-guidance.d.ts.map +1 -0
  113. package/dist/lib/repository-guidance.js +55 -0
  114. package/dist/lib/repository-guidance.js.map +1 -0
  115. package/dist/lib/runner.d.ts.map +1 -1
  116. package/dist/lib/runner.js +50 -19
  117. package/dist/lib/runner.js.map +1 -1
  118. package/dist/reviewers/claude.d.ts +2 -1
  119. package/dist/reviewers/claude.d.ts.map +1 -1
  120. package/dist/reviewers/claude.js +21 -3
  121. package/dist/reviewers/claude.js.map +1 -1
  122. package/dist/reviewers/codex.d.ts +2 -1
  123. package/dist/reviewers/codex.d.ts.map +1 -1
  124. package/dist/reviewers/codex.js +7 -3
  125. package/dist/reviewers/codex.js.map +1 -1
  126. package/dist/reviewers/conflict-resolve.d.ts +2 -1
  127. package/dist/reviewers/conflict-resolve.d.ts.map +1 -1
  128. package/dist/reviewers/conflict-resolve.js +12 -3
  129. package/dist/reviewers/conflict-resolve.js.map +1 -1
  130. package/dist/reviewers/fix.d.ts +3 -2
  131. package/dist/reviewers/fix.d.ts.map +1 -1
  132. package/dist/reviewers/fix.js +15 -6
  133. package/dist/reviewers/fix.js.map +1 -1
  134. package/dist/skills/attribution.d.ts +4 -0
  135. package/dist/skills/attribution.d.ts.map +1 -0
  136. package/dist/skills/attribution.js +10 -0
  137. package/dist/skills/attribution.js.map +1 -0
  138. package/dist/skills/broker-server.d.ts +2 -0
  139. package/dist/skills/broker-server.d.ts.map +1 -0
  140. package/dist/skills/broker-server.js +30 -0
  141. package/dist/skills/broker-server.js.map +1 -0
  142. package/dist/skills/broker.d.ts +42 -0
  143. package/dist/skills/broker.d.ts.map +1 -0
  144. package/dist/skills/broker.js +173 -0
  145. package/dist/skills/broker.js.map +1 -0
  146. package/dist/skills/catalog.d.ts +26 -0
  147. package/dist/skills/catalog.d.ts.map +1 -0
  148. package/dist/skills/catalog.js +91 -0
  149. package/dist/skills/catalog.js.map +1 -0
  150. package/dist/skills/installer.d.ts +10 -0
  151. package/dist/skills/installer.d.ts.map +1 -0
  152. package/dist/skills/installer.js +136 -0
  153. package/dist/skills/installer.js.map +1 -0
  154. package/dist/skills/integrity.d.ts +4 -0
  155. package/dist/skills/integrity.d.ts.map +1 -0
  156. package/dist/skills/integrity.js +36 -0
  157. package/dist/skills/integrity.js.map +1 -0
  158. package/get-started.md +55 -1
  159. package/package.json +1 -1
package/README.md CHANGED
@@ -43,6 +43,21 @@ Three properties make that practical:
43
43
  - **A loop, not a comment.** Findings return to the author agent for repair; a clean recheck follows. The PR moves forward instead of sideways.
44
44
  - **No new vendor.** Runs through the `claude` and `codex` CLIs you already pay for. No hosted service, no per-review API bill, no extra trust surface.
45
45
 
46
+ ## Same mission. Sharper skills.
47
+
48
+ Crosscheck stays focused on one job: making agent-authored PRs trustworthy. It now ships supercharged with preloaded, coding-specialized skills that every invoked coding agent can use during review, diagnosis, repair, recheck, and conflict resolution.
49
+
50
+ The recommended onboarding bundle combines a broad review baseline with rigorous bug diagnosis:
51
+
52
+ - `code-review-skill (by @awesome-skills, MIT)` — comprehensive review guidance across languages, architecture, security, and performance.
53
+ - `diagnosing-bugs (by @mattpocock, MIT)` — requires a reproducible signal, tested hypotheses, and regression evidence before declaring a fix complete.
54
+
55
+ Matt Pocock's `code-review` and `codebase-design` skills are also preloaded and available in `crosscheck onboard`, but remain off by default. Enable only the practices your team wants, or install your own skill with `crosscheck skill install <source>`.
56
+
57
+ Enabled skills are available, not blindly forced: the coding agent decides which are relevant to each operation. The terminal and PR comment then attribute only the skills actually activated for that step. Crosscheck also honors the target repository's `AGENTS.md` and `CLAUDE.md` guidance, so shared practices complement the codebase's own rules.
58
+
59
+ Setup and trust model: **[Agent skills](./get-started.md#crosscheck-skill-install-source)**.
60
+
46
61
  Built by [Humanbased](https://github.com/humanbased-ai). Field report: [What 295 Agentic PRs Taught Us About Code Review](https://blog.humanbased.ai/posts/agentic-pr-quality-crosscheck/).
47
62
 
48
63
  ---
@@ -153,6 +168,7 @@ Full walkthrough: **[docs/linear-identity.md](./docs/linear-identity.md)**.
153
168
  |---|---|
154
169
  | `crosscheck onboard` | Guided setup — repos, routing, pipeline depth, connection |
155
170
  | `crosscheck status` | Auth, config, Linear identity, logs, impact summary |
171
+ | `crosscheck skill install <source>` | Install an Agent Skill from Git or a local directory |
156
172
  | `crosscheck review <pr>` | One-shot review, posts a comment |
157
173
  | `crosscheck run <pr>` | Full pipeline for a PR — review, fix, recheck |
158
174
  | `crosscheck recheck` / `fix` / `resolve` | Run one step in isolation |
@@ -184,8 +200,18 @@ Config lives at `~/.crosscheck/config.yml`. A `./crosscheck.config.yml` in the w
184
200
  ```yaml
185
201
  quality:
186
202
  tier: balanced # fast | balanced | thorough
203
+
204
+ skills:
205
+ enabled:
206
+ - code-review-skill # recommended · @awesome-skills, MIT
207
+ - diagnosing-bugs # recommended · @mattpocock, MIT
187
208
  ```
188
209
 
210
+ Agents decide whether an enabled skill applies to each review, fix, recheck, or conflict-resolution step. PR comments attribute only skills actually activated for that step.
211
+ Existing configs keep skills disabled on upgrade; use `crosscheck onboard` to opt in. Installed packages are integrity-checked before agents can load them.
212
+
213
+ For review and recheck, Crosscheck also applies repository-defined review practices from `AGENTS.md` and `CLAUDE.md`. In monorepos it combines root guidance with the files scoped to changed paths, using the trusted base-branch versions so a PR cannot rewrite its own review rules.
214
+
189
215
  | Tier | Claude | Codex | Latency |
190
216
  |---|---|---|---|
191
217
  | `fast` | Haiku 4.5 | GPT-5.6 Luna | ~10s |
@@ -0,0 +1,9 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "name": "code-review",
4
+ "author": "mattpocock",
5
+ "license": "MIT",
6
+ "source": "https://github.com/mattpocock/skills",
7
+ "revision": "2ab958093e83e0ec752e6c1c5932da465bf23e0c",
8
+ "integrity": "sha256:59eecd403b82ae0823cad21aa585efa62ac6d00f800137dee4d673b6092c20c6"
9
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matt Pocock
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: code-review
3
+ description: Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes — Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/PRD asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".
4
+ ---
5
+
6
+ Two-axis review of the diff between `HEAD` and a fixed point the user supplies:
7
+
8
+ - **Standards** — does the code conform to this repo's documented coding standards?
9
+ - **Spec** — does the code faithfully implement the originating issue / PRD / spec?
10
+
11
+ Both axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.
12
+
13
+ The issue tracker should have been provided to you — run `/setup-matt-pocock-skills` if `docs/agents/issue-tracker.md` is missing.
14
+
15
+ ## Process
16
+
17
+ ### 1. Pin the fixed point
18
+
19
+ Whatever the user said is the fixed point — a commit SHA, branch name, tag, `main`, `HEAD~5`, etc. If they didn't specify one, ask for it.
20
+
21
+ Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.
22
+
23
+ Before going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here — not inside two parallel sub-agents.
24
+
25
+ ### 2. Identify the spec source
26
+
27
+ Look for the originating spec, in this order:
28
+
29
+ 1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.) — fetch via the workflow in `docs/agents/issue-tracker.md`.
30
+ 2. A path the user passed as an argument.
31
+ 3. A PRD/spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.
32
+ 4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report "no spec available".
33
+
34
+ ### 3. Identify the standards sources
35
+
36
+ Anything in the repo that documents how code should be written, such as `CODING_STANDARDS.md` or `CONTRIBUTING.md`.
37
+
38
+ On top of whatever the repo documents, the Standards axis always carries the **smell baseline** below — a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:
39
+
40
+ - **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.
41
+ - **Always a judgement call.** Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation — and, like any standard here, skip anything tooling already enforces.
42
+
43
+ Each smell reads *what it is* → *how to fix*; match it against the diff:
44
+
45
+ - **Mysterious Name** — a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.
46
+ - **Duplicated Code** — the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.
47
+ - **Feature Envy** — a method that reaches into another object's data more than its own. → move the method onto the data it envies.
48
+ - **Data Clumps** — the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.
49
+ - **Primitive Obsession** — a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.
50
+ - **Repeated Switches** — the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.
51
+ - **Shotgun Surgery** — one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.
52
+ - **Divergent Change** — one file or module is edited for several unrelated reasons. → split so each module changes for one reason.
53
+ - **Speculative Generality** — abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.
54
+ - **Message Chains** — long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.
55
+ - **Middle Man** — a class or function that mostly just delegates onward. → cut it, call the real target direct.
56
+ - **Refused Bequest** — a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.
57
+
58
+ ### 4. Spawn both sub-agents in parallel
59
+
60
+ Send a single message with two `Agent` tool calls. Use the `general-purpose` subagent for both.
61
+
62
+ **Standards sub-agent prompt** — include:
63
+
64
+ - The full diff command and commit list.
65
+ - The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full — the sub-agent has no other access to it.
66
+ - The brief: "Report — per file/hunk where relevant — (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls — documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
67
+
68
+ **Spec sub-agent prompt** — include:
69
+
70
+ - The diff command and commit list.
71
+ - The path or fetched contents of the spec.
72
+ - The brief: "Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words."
73
+
74
+ If the spec is missing, skip the Spec sub-agent and note this in the final report.
75
+
76
+ ### 5. Aggregate
77
+
78
+ Present the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings — the two axes are deliberately separate (see _Why two axes_).
79
+
80
+ End with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes — that's the reranking the separation exists to prevent.
81
+
82
+ ## Why two axes
83
+
84
+ A change can pass one axis and fail the other:
85
+
86
+ - Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**
87
+ - Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**
88
+
89
+ Reporting them separately stops one axis from masking the other.
@@ -0,0 +1,3 @@
1
+ interface:
2
+ display_name: "Code Review"
3
+ short_description: "Review a diff on standards and spec"
@@ -0,0 +1,9 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "name": "code-review-skill",
4
+ "author": "awesome-skills",
5
+ "license": "MIT",
6
+ "source": "https://github.com/awesome-skills/code-review-skill",
7
+ "revision": "95c707b999295f6c8ee2d0d3d1c61cc0c2e1a52c",
8
+ "integrity": "sha256:27a9e6b964e270ded1bb11c7bab31fccc7ed76c7a9a86fd80e330553c8677d75"
9
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 awesome-skills
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,231 @@
1
+ ---
2
+ name: code-review-skill
3
+ description: |
4
+ Provides comprehensive code review guidance for React 19, Vue 3, Angular 17+, Svelte 5,
5
+ Rust, TypeScript, Java, Java 8, PHP, Ruby, Rails, Python, Django, FastAPI, Go, C#/.NET, Kotlin, Swift,
6
+ NestJS, C/C++, Zig, CSS/Less/Sass, Qt, and more.
7
+ Covers architecture review, performance review, security audit, code quality anti-patterns,
8
+ and common bugs across all ecosystems.
9
+ Use when: reviewing pull requests, conducting PR reviews, code review, reviewing code changes,
10
+ establishing review standards, mentoring developers, architecture reviews, security audits,
11
+ performance reviews, checking code quality, finding bugs, giving feedback on code.
12
+ allowed-tools:
13
+ - Read
14
+ - Grep
15
+ - Glob
16
+ - Bash # 运行 lint/test/build 命令验证代码质量
17
+ - WebFetch # 查阅最新文档和最佳实践
18
+ ---
19
+
20
+ # Code Review Skill
21
+
22
+ Transform code reviews from gatekeeping to knowledge sharing through constructive feedback, systematic analysis, and collaborative improvement.
23
+
24
+ ## When to Use This Skill
25
+
26
+ - Reviewing pull requests and code changes
27
+ - Establishing code review standards for teams
28
+ - Mentoring junior developers through reviews
29
+ - Conducting architecture reviews
30
+ - Creating review checklists and guidelines
31
+ - Improving team collaboration
32
+ - Reducing code review cycle time
33
+ - Maintaining code quality standards
34
+
35
+ ## Core Principles
36
+
37
+ ### 1. The Review Mindset
38
+
39
+ **Goals of Code Review:**
40
+ - Catch bugs and edge cases
41
+ - Ensure code maintainability
42
+ - Share knowledge across team
43
+ - Enforce coding standards
44
+ - Improve design and architecture
45
+ - Build team culture
46
+
47
+ **Not the Goals:**
48
+ - Show off knowledge
49
+ - Nitpick formatting (use linters)
50
+ - Block progress unnecessarily
51
+ - Rewrite to your preference
52
+
53
+ ### 2. Effective Feedback
54
+
55
+ **Good Feedback is:**
56
+ - Specific and actionable
57
+ - Educational, not judgmental
58
+ - Focused on the code, not the person
59
+ - Balanced (praise good work too)
60
+ - Prioritized (critical vs nice-to-have)
61
+
62
+ ```markdown
63
+ ❌ Bad: "This is wrong."
64
+ ✅ Good: "This could cause a race condition when multiple users
65
+ access simultaneously. Consider using a mutex here."
66
+
67
+ ❌ Bad: "Why didn't you use X pattern?"
68
+ ✅ Good: "Have you considered the Repository pattern? It would
69
+ make this easier to test. Here's an example: [link]"
70
+
71
+ ❌ Bad: "Rename this variable."
72
+ ✅ Good: "[nit] Consider `userCount` instead of `uc` for
73
+ clarity. Not blocking if you prefer to keep it."
74
+ ```
75
+
76
+ ### 3. Review Scope
77
+
78
+ **What to Review:**
79
+ - Logic correctness and edge cases
80
+ - Security vulnerabilities
81
+ - Performance implications
82
+ - Test coverage and quality
83
+ - Error handling
84
+ - Documentation and comments
85
+ - API design and naming
86
+ - Architectural fit
87
+
88
+ **What Not to Review Manually:**
89
+ - Code formatting (use Prettier, Black, etc.)
90
+ - Import organization
91
+ - Linting violations
92
+ - Simple typos
93
+
94
+ ## Review Process
95
+
96
+ ### Phase 1: Context Gathering (2-3 minutes)
97
+
98
+ Before diving into code, understand:
99
+ 1. Read PR description and linked issue
100
+ 2. Check PR size (>400 lines? Ask to split)
101
+ 3. Review CI/CD status (tests passing?)
102
+ 4. Understand the business requirement
103
+ 5. Note any relevant architectural decisions
104
+
105
+ > For large diffs, pipe the diff through [`scripts/pr-analyzer.py`](scripts/pr-analyzer.py) (`git diff main...HEAD | python scripts/pr-analyzer.py`) to triage complexity and get a suggested review approach before reading.
106
+
107
+ ### Phase 2: High-Level Review (5-10 minutes)
108
+
109
+ 1. **Architecture & Design** - Does the solution fit the problem?
110
+ - For significant changes, consult [Architecture Review Guide](reference/architecture-review-guide.md)
111
+ - Check: SOLID principles, coupling/cohesion, anti-patterns
112
+ 2. **Performance Assessment** - Are there performance concerns?
113
+ - For performance-critical code, consult [Performance Review Guide](reference/performance-review-guide.md)
114
+ - Check: Algorithm complexity, N+1 queries, memory usage
115
+ 3. **File Organization** - Are new files in the right places?
116
+ 4. **Testing Strategy** - Are there tests covering edge cases?
117
+
118
+ ### Phase 3: Line-by-Line Review (10-20 minutes)
119
+
120
+ For each file, check:
121
+ - **Logic & Correctness** - Edge cases, off-by-one, null checks, race conditions
122
+ - **Security** - Input validation, injection risks, XSS, sensitive data
123
+ - **Performance** - N+1 queries, unnecessary loops, memory leaks
124
+ - **Maintainability** - Clear names, single responsibility, comments
125
+ - **Reuse** - Before accepting new code, search for existing utilities/helpers that could replace it. Check adjacent files and shared modules for similar patterns. See [Universal Quality Guide](reference/code-quality-universal.md) for anti-patterns like parameter sprawl, leaky abstractions, nested conditionals, stringly-typed code, TOCTOU, and no-op updates.
126
+
127
+ ### Phase 4: Summary & Decision (2-3 minutes)
128
+
129
+ 1. Summarize key concerns
130
+ 2. Highlight what you liked
131
+ 3. Make clear decision:
132
+ - ✅ Approve
133
+ - 💬 Comment (minor suggestions)
134
+ - 🔄 Request Changes (must address)
135
+ 4. Offer to pair if complex
136
+
137
+ ## Review Techniques
138
+
139
+ ### Technique 1: The Checklist Method
140
+
141
+ Use checklists for consistent reviews. See [Security Review Guide](reference/security-review-guide.md) for comprehensive security checklist.
142
+
143
+ ### Technique 2: The Question Approach
144
+
145
+ Instead of stating problems, ask questions:
146
+
147
+ ```markdown
148
+ ❌ "This will fail if the list is empty."
149
+ ✅ "What happens if `items` is an empty array?"
150
+
151
+ ❌ "You need error handling here."
152
+ ✅ "How should this behave if the API call fails?"
153
+ ```
154
+
155
+ ### Technique 3: Suggest, Don't Command
156
+
157
+ Use collaborative language:
158
+
159
+ ```markdown
160
+ ❌ "You must change this to use async/await"
161
+ ✅ "Suggestion: async/await might make this more readable. What do you think?"
162
+
163
+ ❌ "Extract this into a function"
164
+ ✅ "This logic appears in 3 places. Would it make sense to extract it?"
165
+ ```
166
+
167
+ ### Technique 4: Differentiate Severity
168
+
169
+ Use labels to indicate priority:
170
+
171
+ - 🔴 `[blocking]` - Must fix before merge
172
+ - 🟡 `[important]` - Should fix, discuss if disagree
173
+ - 🟢 `[nit]` - Nice to have, not blocking
174
+ - 💡 `[suggestion]` - Alternative approach to consider
175
+ - 📚 `[learning]` - Educational comment, no action needed
176
+ - 🎉 `[praise]` - Good work, keep it up!
177
+
178
+ **Severity levels:** 🔴 / 🟡 / 🟢 are the three severity tiers used as the standard across all guides in this skill — 🔴 blocks the merge, 🟡 should be addressed, 🟢 is optional. The remaining markers (💡 / 📚 / 🎉) are non-blocking annotations.
179
+
180
+ ## Language-Specific Guides
181
+
182
+ 根据审查的代码语言,查阅对应的详细指南:
183
+
184
+ | Language/Framework | Reference File | Key Topics |
185
+ |-------------------|----------------|------------|
186
+ | **React** | [React Guide](reference/react.md) | Hooks, useEffect, React 19 Actions, RSC, Suspense, TanStack Query v5 |
187
+ | **Vue 3** | [Vue Guide](reference/vue.md) | Composition API, 响应性系统, Props/Emits, Watchers, Composables |
188
+ | **Angular 17+** | [Angular Guide](reference/angular.md) | Signals, Standalone, RxJS, Zoneless, 模板优化, 测试, 路由守卫, HttpInterceptor |
189
+ | **Rust** | [Rust Guide](reference/rust.md) | 所有权/借用, Unsafe 审查, 异步代码, 取消安全性, 错误处理 |
190
+ | **TypeScript** | [TypeScript Guide](reference/typescript.md) | 类型安全, async/await, 不可变性, 测试, 模块解析, TS 5.x |
191
+ | **Python** | [Python Guide](reference/python.md) | 可变默认参数, 异常处理, 类属性 |
192
+ | **Django / DRF** | [Django Guide](reference/django.md) | 安全审查, N+1 查询, Serializer 反模式, ViewSet, 异步视图 |
193
+ | **FastAPI** | [FastAPI Guide](reference/fastapi.md) | Depends, Pydantic v2 validation, async correctness, sessions/N+1, auth vs authorization, test-driven verification |
194
+ | **Java** | [Java Guide](reference/java.md) | Java 17/21 新特性, Spring Boot 3, 虚拟线程, Stream/Optional |
195
+ | **Java 8 / Legacy** | [Java 8 Guide](reference/java8.md) | Java 8, Spring Boot 2, javax.*, Stream/Optional, java.time, CompletableFuture |
196
+ | **PHP** | [PHP Guide](reference/php.md) | PHP 8.x type system, PDO, security review, Composer, PHPUnit/PHPStan |
197
+ | **Ruby / Rails** | [Ruby Guide](reference/ruby.md) | Ruby semantics, Rails 8, Active Record, Active Job, security, testing |
198
+ | **C# / .NET** | [C# Guide](reference/csharp.md) | C# 12 特性, 异步编程, EF Core 性能, ASP.NET Core, LINQ |
199
+ | **Go** | [Go Guide](reference/go.md) | 错误处理, goroutine/channel, context, 接口设计 |
200
+ | **Kotlin / Android** | [Kotlin Guide](reference/kotlin.md) | 协程, Flow, Jetpack Compose, 空安全, 内存泄漏, 架构模式 |
201
+ | **Swift / SwiftUI** | [Swift Guide](reference/swift.md) | Optionals, Swift Concurrency, Sendable/actors, SwiftUI property wrappers, value vs reference types, API design |
202
+ | **NestJS** | [NestJS Guide](reference/nestjs.md) | 依赖注入, 分层架构, DTO 验证, Guard/Interceptor, 循环依赖 |
203
+ | **Svelte / SvelteKit** | [Svelte Guide](reference/svelte.md) | Runes, Load 函数, Form Actions, Store 迁移, SSR/CSR 边界 |
204
+ | **C** | [C Guide](reference/c.md) | 指针/缓冲区, 内存安全, UB, 安全编码, 可移植性, 测试 |
205
+ | **C++** | [C++ Guide](reference/cpp.md) | RAII, 智能指针, C++20/23, constexpr, 测试 |
206
+ | **Zig** | [Zig Guide](reference/zig.md) | Allocators, error unions, defer/errdefer, comptime, C interop |
207
+ | **CSS/Less/Sass** | [CSS Guide](reference/css-less-sass.md) | 变量规范, !important, 性能优化, 响应式, 兼容性 |
208
+ | **Qt** | [Qt Guide](reference/qt.md) | 对象模型, 信号/槽, Model/View, QML, Qt6 迁移, 测试 |
209
+
210
+ ## Cross-Cutting Guides
211
+
212
+ Language-agnostic patterns applicable to all code reviews:
213
+
214
+ | Topic | Reference File | Key Topics |
215
+ |-------|----------------|------------|
216
+ | **Architecture Review** | [Architecture Review Guide](reference/architecture-review-guide.md) | SOLID, anti-patterns, coupling/cohesion, dependency direction |
217
+ | **Performance Review** | [Performance Review Guide](reference/performance-review-guide.md) | Web Vitals, N+1, algorithm complexity, memory leaks, caching |
218
+ | **Security Review** | [Security Review Guide](reference/security-review-guide.md) | SQLi, XSS, CSRF, SSRF, IDOR, 命令注入, 跨语言示例 |
219
+ | **Universal Quality** | [Universal Quality Guide](reference/code-quality-universal.md) | Reuse audit, parameter sprawl, leaky abstractions, nested conditionals, stringly-typed code, TOCTOU, no-op updates, redundant state |
220
+ | **Common Bugs** | [Common Bugs Checklist](reference/common-bugs-checklist.md) | Language-specific bug patterns, common pitfalls |
221
+ | **SQL Injection Prevention** | [SQL Injection Guide](reference/cross-cutting/sql-injection-prevention.md) | Parameterized queries, ORM safety, 6 languages, dynamic identifiers, detection |
222
+ | **XSS Prevention** | [XSS Prevention Guide](reference/cross-cutting/xss-prevention.md) | Output encoding, CSP, 5 frameworks, input validation vs encoding, detection |
223
+ | **N+1 Queries** | [N+1 Queries Guide](reference/cross-cutting/n-plus-one-queries.md) | Eager loading, batch fetching, DataLoader, 5 languages, detection |
224
+ | **Error Handling** | [Error Handling Guide](reference/cross-cutting/error-handling-principles.md) | Fail fast, error hierarchy, 7 languages, anti-patterns, logging |
225
+ | **Async & Concurrency** | [Concurrency Guide](reference/cross-cutting/async-concurrency-patterns.md) | Goroutines, async/await, actors, structured concurrency, 7 languages |
226
+ | **Review Best Practices** | [Code Review Best Practices](reference/code-review-best-practices.md) | Communication, reviewer mindset, giving feedback, severity labels |
227
+
228
+ ## Additional Resources
229
+
230
+ - [PR Review Template](assets/pr-review-template.md) - PR 审查评论模板
231
+ - [Review Checklist](assets/review-checklist.md) - 快速参考清单
@@ -0,0 +1,137 @@
1
+ # PR Review Template
2
+
3
+ Copy and use this template for your code reviews.
4
+
5
+ ---
6
+
7
+ ## Summary
8
+
9
+ [Brief overview of what was reviewed - 1-2 sentences]
10
+
11
+ **PR Size:** [Small/Medium/Large] (~X lines)
12
+ **Review Time:** [X minutes]
13
+
14
+ ## Strengths
15
+
16
+ - [What was done well]
17
+ - [Good patterns or approaches used]
18
+ - [Improvements from previous code]
19
+
20
+ ## Architecture & Performance
21
+
22
+ **Architecture Assessment**
23
+ - [ ] Separation of concerns — are responsibilities clearly divided?
24
+ - [ ] Module responsibilities — does each module have a single purpose?
25
+ - [ ] Dependency direction — do dependencies flow toward stability?
26
+ - [ ] Consistent with existing patterns and conventions
27
+
28
+ > See [Architecture Review Guide](../reference/architecture-review-guide.md) for detailed SOLID, anti-pattern, and coupling analysis.
29
+
30
+ **Performance Assessment**
31
+ - [ ] Algorithm complexity — any O(n²) or worse on large inputs?
32
+ - [ ] Memory impact — large allocations, leaks, unbounded growth?
33
+ - [ ] I/O impact — excessive API calls, unbatched writes, missing caching?
34
+ - [ ] Database queries — N+1 risks, missing indexes, unoptimized joins?
35
+
36
+ > See [Performance Review Guide](../reference/performance-review-guide.md) for comprehensive Web Vitals, N+1, and caching guidance.
37
+
38
+ ## Required Changes
39
+
40
+ 🔴 **[blocking]** [Issue description]
41
+ > [Code location or example]
42
+ > [Suggested fix or explanation]
43
+
44
+ 🔴 **[blocking]** [Issue description]
45
+ > [Details]
46
+
47
+ ## Important Suggestions
48
+
49
+ 🟡 **[important]** [Issue description]
50
+ > [Why this matters]
51
+ > [Suggested approach]
52
+
53
+ ## Minor Suggestions
54
+
55
+ 🟢 **[nit]** [Minor improvement suggestion]
56
+
57
+ 💡 **[suggestion]** [Alternative approach to consider]
58
+
59
+ ## Learning Notes
60
+
61
+ 📚 [Educational context worth sharing about X]
62
+
63
+ 📚 [Background behind design decision Y]
64
+
65
+ ## Security Considerations
66
+
67
+ - [ ] No hardcoded secrets
68
+ - [ ] Input validation present
69
+ - [ ] Authorization checks in place
70
+ - [ ] No SQL/XSS injection risks
71
+ - [ ] CSRF protection for state-changing operations
72
+ - [ ] Sensitive data not leaked in logs/errors
73
+ - [ ] Dependency vulnerabilities checked (npm audit / pip audit / cargo audit)
74
+
75
+ > See [Security Review Guide](../reference/security-review-guide.md) for comprehensive injection, XSS, CSRF, secrets, and auth checklist.
76
+
77
+ ## Test Coverage
78
+
79
+ - [ ] Unit tests added/updated
80
+ - [ ] Edge cases covered
81
+ - [ ] Error cases tested
82
+
83
+ ## Verdict
84
+
85
+ **[ ] ✅ Approve** - Ready to merge
86
+ **[ ] 💬 Comment** - Minor suggestions, can merge
87
+ **[ ] 🔄 Request Changes** - Must address blocking issues
88
+
89
+ ---
90
+
91
+ ## Quick Copy Templates
92
+
93
+ ### Blocking Issue
94
+ ```
95
+ 🔴 **[blocking]** [Title]
96
+
97
+ [Description of the issue]
98
+
99
+ **Location:** `file.ts:123`
100
+
101
+ **Suggested fix:**
102
+ \`\`\`typescript
103
+ // Your suggested code
104
+ \`\`\`
105
+ ```
106
+
107
+ ### Important Suggestion
108
+ ```
109
+ 🟡 **[important]** [Title]
110
+
111
+ [Why this is important]
112
+
113
+ **Consider:**
114
+ - Option A: [description]
115
+ - Option B: [description]
116
+ ```
117
+
118
+ ### Minor Suggestion
119
+ ```
120
+ 🟢 **[nit]** [Suggestion]
121
+
122
+ Not blocking, but consider [improvement].
123
+ ```
124
+
125
+ ### Praise
126
+ ```
127
+ 🎉 **[praise]** Great work on [specific thing]!
128
+
129
+ [Why this is good]
130
+ ```
131
+
132
+ ### Learning
133
+ ```
134
+ 📚 **[learning]** [Educational note]
135
+
136
+ For context, [X] works this way because [Y]. No action needed — just sharing.
137
+ ```