swift-code-reviewer-skill 1.2.1 → 1.3.0
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.
- package/CHANGELOG.md +8 -0
- package/SKILL.md +122 -4
- package/package.json +1 -1
- package/references/agent-loop-feedback.md +148 -0
- package/references/spec-adherence.md +157 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.3.0] - 2026-05-07
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Spec adherence review** (`references/spec-adherence.md`) — validates implementation against PR description and linked issues, flagging scope drift and unimplemented requirements
|
|
15
|
+
- **Agent-loop feedback** (`references/agent-loop-feedback.md`) — meta-review layer that identifies recurring patterns suggesting gaps in the agent's own instructions, improving future AI-generated code quality
|
|
16
|
+
|
|
10
17
|
## [1.2.1] - 2026-04-21
|
|
11
18
|
|
|
12
19
|
### Fixed
|
|
@@ -113,6 +120,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
113
120
|
|
|
114
121
|
## Version History Summary
|
|
115
122
|
|
|
123
|
+
- **1.3.0** (2026-05-07): Add spec adherence review and agent-loop meta-feedback layer
|
|
116
124
|
- **1.2.1** (2026-04-21): Fix installer not copying `skills/` and `templates/` directories
|
|
117
125
|
- **1.2.0** (2026-04-21): Bundle five companion Swift skills, add `init` scaffolding command, skill-review CI action, SKILL.md condensed 71%
|
|
118
126
|
- **1.1.1** (2026-03-24): Fix incorrect `install-skill.sh` (was XcodeBuildMCP installer)
|
package/SKILL.md
CHANGED
|
@@ -1,26 +1,68 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: swift-code-reviewer
|
|
3
|
-
description: "
|
|
3
|
+
description: "Perform thorough code reviews for Swift/SwiftUI code, including spec adherence (PR description + linked issues), code quality, architecture, performance, security, Swift 6+ best practices, project standards from .claude/CLAUDE.md, and meta-feedback on recurring patterns that suggest gaps in the agent's instructions. Use when reviewing PRs/MRs (especially AI-generated ones), performing quality audits, validating against original spec, or providing structured feedback with severity levels and improvement suggestions for both the code and the agent loop that produced it."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Swift/SwiftUI Code Review Skill
|
|
7
7
|
|
|
8
8
|
Multi-layer review covering Swift 6+ concurrency, SwiftUI patterns, performance, security, architecture, and project-specific standards. Reads `.claude/CLAUDE.md` and outputs Critical/High/Medium/Low severity findings with `file:line` references and before/after code examples.
|
|
9
9
|
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
- "Review this PR"
|
|
13
|
+
- "Review my code" / "Review my changes" / "Review uncommitted changes"
|
|
14
|
+
- "Code review for [component]"
|
|
15
|
+
- "Audit this codebase" / "Check code quality"
|
|
16
|
+
- "Review against .claude/CLAUDE.md" / "Check if this follows our coding standards"
|
|
17
|
+
- "Architecture review" / "Performance audit" / "Security review"
|
|
18
|
+
- "Review this PR against the spec"
|
|
19
|
+
- "Did the agent miss anything from issue #123?"
|
|
20
|
+
- "What rules am I missing in CLAUDE.md based on this PR?"
|
|
21
|
+
- "Review this AI-generated PR"
|
|
22
|
+
|
|
10
23
|
## Workflow
|
|
11
24
|
|
|
12
25
|
### Phase 1 — Context Gathering
|
|
13
26
|
|
|
14
|
-
1.
|
|
27
|
+
1. **Read the Spec**
|
|
28
|
+
- For PRs: `gh pr view <num> --json title,body,closingIssuesReferences,labels`
|
|
29
|
+
- For linked issues: `gh issue view <num> --json title,body,labels`
|
|
30
|
+
- For MRs: `glab mr view <num>` and `glab issue view <num>`
|
|
31
|
+
- Extract:
|
|
32
|
+
- Stated goal / problem being solved
|
|
33
|
+
- Explicit acceptance criteria (look for checkboxes, "should", "must", "Given/When/Then")
|
|
34
|
+
- Edge cases or non-goals mentioned
|
|
35
|
+
- Out-of-scope items
|
|
36
|
+
- If no PR/issue context is available, note this and fall back to inferring intent from the diff.
|
|
37
|
+
2. Try to load `.claude/CLAUDE.md`.
|
|
15
38
|
- **If missing**: add a note to the report — _"No project standards file found — review uses default Apple guidelines"_ — then continue.
|
|
16
|
-
|
|
39
|
+
3. Obtain the changeset: `git diff`, `git diff --cached`, or `gh pr diff <n>`.
|
|
17
40
|
- **If diff is empty**: stop and ask the user to specify files, a PR number, or a directory.
|
|
18
|
-
|
|
41
|
+
4. Read each changed file plus key related files (imports, protocols it conforms to, corresponding test file if present).
|
|
19
42
|
|
|
20
43
|
### Phase 2 — Analysis
|
|
21
44
|
|
|
22
45
|
For each category, load the reference file before writing findings:
|
|
23
46
|
|
|
47
|
+
#### 0. Spec Adherence
|
|
48
|
+
|
|
49
|
+
Reference: `references/spec-adherence.md`
|
|
50
|
+
|
|
51
|
+
- **Requirement Coverage**
|
|
52
|
+
- Does each acceptance criterion map to a concrete code change?
|
|
53
|
+
- Are edge cases mentioned in the spec handled?
|
|
54
|
+
- Are tests covering the scenarios described?
|
|
55
|
+
- **Scope Discipline**
|
|
56
|
+
- Flag changes outside the stated scope (scope creep)
|
|
57
|
+
- Flag unrelated refactors bundled into the PR
|
|
58
|
+
- **Missing Work**
|
|
59
|
+
- TODOs, `fatalError("not implemented")`, empty function bodies
|
|
60
|
+
- Stubbed mocks that should be real implementations
|
|
61
|
+
- Acceptance criteria with no corresponding diff
|
|
62
|
+
- **Intent Drift**
|
|
63
|
+
- Code solves a *similar* but different problem than stated
|
|
64
|
+
- Naming/structure suggests a different mental model than the spec
|
|
65
|
+
|
|
24
66
|
1. **Swift Quality** — concurrency, error handling, optionals, naming → `references/swift-quality-checklist.md`; for concurrency findings also read `skills/swift-concurrency/references/sendable.md` and `actors.md`
|
|
25
67
|
2. **SwiftUI Patterns** — property wrappers, state management, deprecated APIs → `references/swiftui-review-checklist.md`; for wrapper selection read `skills/swiftui-expert-skill/references/state-management.md`
|
|
26
68
|
3. **Performance** — view body cost, ForEach identity, lazy loading, retain cycles → `references/performance-review.md`
|
|
@@ -31,6 +73,28 @@ For each category, load the reference file before writing findings:
|
|
|
31
73
|
For test file findings, consult `skills/swift-testing/references/test-organization.md`.
|
|
32
74
|
For navigation/routing findings, consult `skills/swiftui-ui-patterns/references/navigationstack.md`.
|
|
33
75
|
|
|
76
|
+
### Phase 2.5 — Pattern Detection (for Agent Loop Feedback)
|
|
77
|
+
|
|
78
|
+
**Objective**: Identify recurring issues that point to gaps in the agent's
|
|
79
|
+
instructions, not just the code.
|
|
80
|
+
|
|
81
|
+
After collecting per-file findings, aggregate them:
|
|
82
|
+
|
|
83
|
+
1. Group findings by rule (e.g., "force-unwrap", "deprecated NavigationView",
|
|
84
|
+
"missing @MainActor on UI mutation").
|
|
85
|
+
2. Mark any rule that fires **≥2 times across the diff** as a recurring pattern.
|
|
86
|
+
3. For each recurring pattern, draft a one-line rule suitable for
|
|
87
|
+
`.claude/CLAUDE.md` or an agent system prompt — written as a directive,
|
|
88
|
+
not a description.
|
|
89
|
+
4. If the same recurring pattern appeared in past reviews (check git log of
|
|
90
|
+
`.claude/CLAUDE.md`), escalate priority — the existing rule isn't strong
|
|
91
|
+
enough or isn't being read.
|
|
92
|
+
|
|
93
|
+
Threshold rationale: one occurrence is a slip; two is a pattern; three+ means
|
|
94
|
+
the agent's instructions are silent on this and need an explicit rule.
|
|
95
|
+
|
|
96
|
+
Reference: `references/agent-loop-feedback.md`.
|
|
97
|
+
|
|
34
98
|
### Phase 3 — Report
|
|
35
99
|
|
|
36
100
|
Group findings by file → sort by severity within each file → write prioritized action items.
|
|
@@ -102,6 +166,22 @@ Also migrate from `ObservableObject`/`@Published` to `@Observable` (iOS 17+) —
|
|
|
102
166
|
## Summary
|
|
103
167
|
Files: N | Critical: N | High: N | Medium: N | Low: N
|
|
104
168
|
|
|
169
|
+
## Spec Adherence
|
|
170
|
+
|
|
171
|
+
**Source**: PR #123 / Issue #456
|
|
172
|
+
|
|
173
|
+
| Requirement | Status | Location |
|
|
174
|
+
|-------------|--------|----------|
|
|
175
|
+
| User can log in with email | ✅ Implemented | LoginView.swift:23 |
|
|
176
|
+
| Show error on invalid credentials | ⚠️ Partial — missing 401 case | LoginViewModel.swift:67 |
|
|
177
|
+
| Persist session in Keychain | ❌ Not implemented | — |
|
|
178
|
+
| Rate limit retries | ❌ Not implemented | — |
|
|
179
|
+
|
|
180
|
+
**Scope creep**: 1 unrelated change (UserSettings.swift refactor) — recommend
|
|
181
|
+
splitting into a separate PR.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
105
185
|
## <Filename.swift>
|
|
106
186
|
|
|
107
187
|
[Severity] **<Category>** (line N)
|
|
@@ -115,6 +195,33 @@ Fix: <explanation + corrected snippet>
|
|
|
115
195
|
- [Must fix] ...
|
|
116
196
|
- [Should fix] ...
|
|
117
197
|
- [Consider] ...
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Agent Loop Feedback
|
|
202
|
+
|
|
203
|
+
Recurring patterns suggest the following rules are missing or under-emphasized
|
|
204
|
+
in `.claude/CLAUDE.md`:
|
|
205
|
+
|
|
206
|
+
### Pattern: Force-unwraps (4 occurrences)
|
|
207
|
+
**Files**: LoginView.swift:89, NetworkService.swift:34, UserRepo.swift:12,78
|
|
208
|
+
|
|
209
|
+
**Suggested rule**:
|
|
210
|
+
> Never use `!`, `try!`, or `as!`. Use `guard let` with explicit early return,
|
|
211
|
+
> typed throws, or `as?` with handling. Force-unwraps are crashes waiting to happen.
|
|
212
|
+
|
|
213
|
+
### Pattern: Deprecated NavigationView (2 occurrences)
|
|
214
|
+
**Files**: ProfileView.swift:15, SettingsView.swift:22
|
|
215
|
+
|
|
216
|
+
**Suggested rule**:
|
|
217
|
+
> Use `NavigationStack` exclusively. `NavigationView` is deprecated as of iOS 16.
|
|
218
|
+
|
|
219
|
+
### Pattern: Business logic in View body (3 occurrences)
|
|
220
|
+
**Files**: LoginView.swift:45, ProfileView.swift:78, FeedView.swift:34
|
|
221
|
+
|
|
222
|
+
**Suggested rule**:
|
|
223
|
+
> Views must not contain business logic, network calls, or data transformations.
|
|
224
|
+
> Move all such work into the @Observable view model.
|
|
118
225
|
```
|
|
119
226
|
|
|
120
227
|
Full templates and severity classification: `references/feedback-templates.md`.
|
|
@@ -149,10 +256,21 @@ git diff HEAD~1 # last commit
|
|
|
149
256
|
git diff -- path/to/file.swift
|
|
150
257
|
```
|
|
151
258
|
|
|
259
|
+
## Limitations
|
|
260
|
+
|
|
261
|
+
- Spec adherence checks require an accessible PR description or linked issue.
|
|
262
|
+
When reviewing local changes with no PR context, mark spec adherence as
|
|
263
|
+
"not assessed" rather than guessing intent.
|
|
264
|
+
- Agent loop feedback assumes the code was AI-generated or AI-assisted. For
|
|
265
|
+
fully human-written code, recurring patterns are still useful but should be
|
|
266
|
+
framed as team coding standards rather than agent instructions.
|
|
267
|
+
|
|
152
268
|
## Reference Files
|
|
153
269
|
|
|
154
270
|
- `references/review-workflow.md` — detailed process, diff parsing, git commands
|
|
155
271
|
- `references/feedback-templates.md` — output templates, severity classification
|
|
272
|
+
- `references/spec-adherence.md` — parsing PR/issue specs, requirement coverage tables, scope creep classification
|
|
273
|
+
- `references/agent-loop-feedback.md` — recurring-pattern threshold, directive phrasing, suggested-rule template
|
|
156
274
|
- `references/swift-quality-checklist.md` — Swift 6+, concurrency, optionals, naming
|
|
157
275
|
- `references/swiftui-review-checklist.md` — property wrappers, state, modern APIs
|
|
158
276
|
- `references/performance-review.md` — view optimization, ForEach, resource management
|
package/package.json
CHANGED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Agent Loop Feedback Reference
|
|
2
|
+
|
|
3
|
+
When the code under review was generated by an AI agent, recurring mistakes
|
|
4
|
+
are not just *code* problems — they are *instruction* problems. This document
|
|
5
|
+
defines how the reviewer aggregates per-finding signals into rule suggestions
|
|
6
|
+
that can be added to `.claude/CLAUDE.md` or an agent system prompt to prevent
|
|
7
|
+
the same class of issue next time.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. The ≥2 Threshold
|
|
12
|
+
|
|
13
|
+
A single instance of a mistake is a slip. Two is a pattern. Three or more
|
|
14
|
+
means the agent's instructions are silent on the topic and need an explicit
|
|
15
|
+
rule.
|
|
16
|
+
|
|
17
|
+
Rules of thumb:
|
|
18
|
+
|
|
19
|
+
| Occurrences in diff | Treatment |
|
|
20
|
+
| ------------------- | --------------------------------------------------------------------------------- |
|
|
21
|
+
| 1 | Per-file finding only. Do not surface in Agent Loop Feedback. |
|
|
22
|
+
| 2 | Recurring pattern. Suggest a rule. Mark priority **medium**. |
|
|
23
|
+
| 3+ | Strong signal. Suggest a rule. Mark priority **high**. |
|
|
24
|
+
| 2+ across PRs | If the same rule has been suggested before (see §3), escalate to **high**. |
|
|
25
|
+
|
|
26
|
+
Count occurrences by **rule**, not by raw findings. For example, four force-unwrap
|
|
27
|
+
findings in different files count as four occurrences of the rule
|
|
28
|
+
*"never force-unwrap"*, not four separate rules.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 2. Phrasing Rules as Directives
|
|
33
|
+
|
|
34
|
+
Rules go in an instruction file the agent will *read*. Write them so the
|
|
35
|
+
reader knows what to do without further interpretation.
|
|
36
|
+
|
|
37
|
+
### Strong forms
|
|
38
|
+
|
|
39
|
+
- **Never X.** — bans an action outright. Best for safety/security/crashes.
|
|
40
|
+
- **Always Y.** — mandates an action. Best for required patterns.
|
|
41
|
+
- **Prefer X over Y.** — gives a default with an implicit escape hatch. Best
|
|
42
|
+
for stylistic or modernization rules.
|
|
43
|
+
- **Use X. Y is deprecated / forbidden.** — adds the *why* in five words.
|
|
44
|
+
|
|
45
|
+
### Weak forms (avoid)
|
|
46
|
+
|
|
47
|
+
- **"Try to..."** — agents will skip it under pressure.
|
|
48
|
+
- **"It's a good idea to..."** — descriptive, not directive.
|
|
49
|
+
- **"Consider..."** — fine in code review prose, useless as a rule.
|
|
50
|
+
- **"X is bad"** — diagnostic, not prescriptive. Doesn't tell the agent what
|
|
51
|
+
to do instead.
|
|
52
|
+
|
|
53
|
+
### Examples
|
|
54
|
+
|
|
55
|
+
| Weak | Strong |
|
|
56
|
+
| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
|
|
57
|
+
| Force unwraps are dangerous. | Never use `!`, `try!`, or `as!`. Use `guard let` with an early return, typed throws, or `as?`. |
|
|
58
|
+
| It's better to use `NavigationStack`. | Use `NavigationStack` exclusively. `NavigationView` is deprecated as of iOS 16. |
|
|
59
|
+
| Try to keep views simple. | Views must not contain business logic, network calls, or data transformations. Move all such work into the `@Observable` view model. |
|
|
60
|
+
| Make sure UI updates happen on the main thread. | Always annotate types that mutate `@Observable`/`@Published` state with `@MainActor`. |
|
|
61
|
+
| Don't put secrets in logs. | Never log values from `KeychainService`, `URLRequest.httpBody`, or types annotated `@Sensitive`. |
|
|
62
|
+
|
|
63
|
+
A good rule answers three questions in one sentence: *what is forbidden*,
|
|
64
|
+
*what is the alternative*, and (briefly) *why*.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 3. Checking Past Reviews
|
|
69
|
+
|
|
70
|
+
Before suggesting a rule, check whether something similar was already
|
|
71
|
+
suggested. If yes, the existing wording is not landing — escalate priority
|
|
72
|
+
and consider strengthening the wording rather than restating it.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Has anyone touched the rules file recently, and how?
|
|
76
|
+
git log --oneline --follow .claude/CLAUDE.md
|
|
77
|
+
git log -p --follow .claude/CLAUDE.md | grep -i "<keyword from new rule>"
|
|
78
|
+
|
|
79
|
+
# Search for existing wording on the topic
|
|
80
|
+
grep -in "force.unwrap\|navigationview\|mainactor" .claude/CLAUDE.md
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If a rule on the same topic exists:
|
|
84
|
+
|
|
85
|
+
1. Quote the current rule in the suggestion block.
|
|
86
|
+
2. Explain why it is not preventing the pattern (too soft, too narrow,
|
|
87
|
+
buried, conditional).
|
|
88
|
+
3. Propose a replacement, not an addition.
|
|
89
|
+
|
|
90
|
+
If no rule exists, propose adding one in the most relevant section
|
|
91
|
+
(`Concurrency`, `SwiftUI`, `Security`, `Architecture`, etc.).
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 4. Suggested-Rule Block — Template
|
|
96
|
+
|
|
97
|
+
One block per recurring pattern. Place all blocks under a single
|
|
98
|
+
`## Agent Loop Feedback` heading at the bottom of the report.
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
### Pattern: <short name> (<N> occurrences)
|
|
102
|
+
**Files**: <file:line>, <file:line>, ...
|
|
103
|
+
|
|
104
|
+
**Suggested rule**:
|
|
105
|
+
> <One-sentence directive in strong form. What is forbidden, what to do
|
|
106
|
+
> instead, and one-clause why.>
|
|
107
|
+
|
|
108
|
+
**Existing rule** (if any): <quote, with line reference into `.claude/CLAUDE.md`>
|
|
109
|
+
|
|
110
|
+
**Why it's not landing** (only if existing rule): <too soft / too narrow / buried / etc.>
|
|
111
|
+
|
|
112
|
+
**Priority**: <medium | high>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Worked example:
|
|
116
|
+
|
|
117
|
+
```markdown
|
|
118
|
+
### Pattern: Force-unwraps (4 occurrences)
|
|
119
|
+
**Files**: LoginView.swift:89, NetworkService.swift:34, UserRepo.swift:12, UserRepo.swift:78
|
|
120
|
+
|
|
121
|
+
**Suggested rule**:
|
|
122
|
+
> Never use `!`, `try!`, or `as!`. Use `guard let` with explicit early return,
|
|
123
|
+
> typed throws, or `as?` with handling. Force-unwraps are crashes waiting to happen.
|
|
124
|
+
|
|
125
|
+
**Existing rule**: _.claude/CLAUDE.md:42_ — "Avoid force unwrapping when possible."
|
|
126
|
+
|
|
127
|
+
**Why it's not landing**: "When possible" gives the agent a built-in opt-out.
|
|
128
|
+
The replacement above bans the syntax outright and names the alternatives.
|
|
129
|
+
|
|
130
|
+
**Priority**: high
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 5. Human-Authored Code
|
|
136
|
+
|
|
137
|
+
If the PR was written by a human (no AI assistance disclosed, no agent
|
|
138
|
+
session metadata in commit messages), the same recurring patterns are still
|
|
139
|
+
useful — but frame them as **team coding standards**, not agent instructions:
|
|
140
|
+
|
|
141
|
+
- Replace "Suggested rule for the agent" with "Suggested team standard".
|
|
142
|
+
- Drop the "Why it's not landing" clause; humans benefit more from a short
|
|
143
|
+
rationale than from instruction-tuning analysis.
|
|
144
|
+
- Leave the directive phrasing intact — strong forms read better in human
|
|
145
|
+
style guides too.
|
|
146
|
+
|
|
147
|
+
When unsure whether the code is AI-generated, default to the team-standards
|
|
148
|
+
framing.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Spec Adherence Reference
|
|
2
|
+
|
|
3
|
+
This document describes how the reviewer extracts the *intent* of a change from
|
|
4
|
+
its PR description and linked issues, and how it then judges whether the code
|
|
5
|
+
delivers on that intent. Spec adherence runs before the language- and
|
|
6
|
+
framework-level checks: a clean diff that misses the point shouldn't pass.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. Parsing `gh` / `glab` JSON Output
|
|
11
|
+
|
|
12
|
+
Always prefer the JSON output of the platform CLI over scraping the web UI —
|
|
13
|
+
it is stable, scriptable, and includes linked-issue metadata.
|
|
14
|
+
|
|
15
|
+
### GitHub
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# PR body, title, labels, and the issues this PR closes
|
|
19
|
+
gh pr view <num> --json title,body,closingIssuesReferences,labels
|
|
20
|
+
|
|
21
|
+
# Linked issue (one per closing reference)
|
|
22
|
+
gh issue view <num> --json title,body,labels
|
|
23
|
+
|
|
24
|
+
# Reviewer-friendly summary in one shot
|
|
25
|
+
gh pr view <num> --json title,body,closingIssuesReferences \
|
|
26
|
+
--jq '{title, body, issues: [.closingIssuesReferences[].number]}'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Fields to read:
|
|
30
|
+
|
|
31
|
+
| Field | Use |
|
|
32
|
+
| --------------------------- | ------------------------------------------------- |
|
|
33
|
+
| `title` | Short statement of intent — start here. |
|
|
34
|
+
| `body` | Acceptance criteria, scope, non-goals. |
|
|
35
|
+
| `closingIssuesReferences` | Numbers of issues that this PR will close. |
|
|
36
|
+
| `labels` | `bug`, `feature`, `tech-debt` shape expectations. |
|
|
37
|
+
|
|
38
|
+
### GitLab
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
glab mr view <num> # human-readable; pipe to less
|
|
42
|
+
glab mr view <num> --output json
|
|
43
|
+
glab issue view <num> --output json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
GitLab's MR description and linked issues serve the same role as GitHub's PR
|
|
47
|
+
body and `closingIssuesReferences`.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 2. Finding Acceptance Criteria
|
|
52
|
+
|
|
53
|
+
Acceptance criteria are rarely labeled as such. Look for these patterns, in
|
|
54
|
+
roughly this order:
|
|
55
|
+
|
|
56
|
+
1. **Markdown checkboxes** — `- [ ] ...` or `- [x] ...`. The most reliable
|
|
57
|
+
signal. Each box is a discrete requirement.
|
|
58
|
+
2. **Gherkin / Given-When-Then** — phrases starting with `Given`, `When`,
|
|
59
|
+
`Then`, or `And`. Common in BDD-flavored teams.
|
|
60
|
+
3. **Modal verbs** — `must`, `should`, `shall`, `will`, `needs to`. Each
|
|
61
|
+
sentence is a candidate requirement; `must`/`shall` outrank `should`.
|
|
62
|
+
4. **Numbered or bulleted lists** under headings like `Acceptance Criteria`,
|
|
63
|
+
`Requirements`, `Scope`, `Goals`, `What this PR does`.
|
|
64
|
+
5. **"Closes #N" / "Fixes #N"** — pull the linked issue and repeat 1–4 there.
|
|
65
|
+
|
|
66
|
+
If the PR has none of the above, treat the **title** as the single requirement
|
|
67
|
+
and note the lack of explicit criteria in the report.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 3. Handling PRs With No Description
|
|
72
|
+
|
|
73
|
+
A blank or near-blank description is itself a finding. Do not invent intent.
|
|
74
|
+
|
|
75
|
+
1. Note in the report: _"PR description is empty / minimal — spec adherence
|
|
76
|
+
inferred from diff and commit messages, may be incomplete."_
|
|
77
|
+
2. Use, in order: linked issues, commit messages (`git log <base>..HEAD`),
|
|
78
|
+
branch name, file paths touched.
|
|
79
|
+
3. List every inferred requirement explicitly so the author can correct any
|
|
80
|
+
misreading, prefixed with `(inferred)`.
|
|
81
|
+
4. Do not penalize the diff for failing to satisfy a requirement that was
|
|
82
|
+
only inferred — flag the missing description instead.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 4. Scope Creep vs. Legitimate Adjacent Fixes
|
|
87
|
+
|
|
88
|
+
Not every out-of-spec change is scope creep. Use this rubric:
|
|
89
|
+
|
|
90
|
+
| Change type | Verdict |
|
|
91
|
+
| ---------------------------------------------------------------------------- | ------------------------------------- |
|
|
92
|
+
| Touches a file required by the spec, fixes an obvious nearby bug, < ~10 LOC | **Allow** — note it; don't flag. |
|
|
93
|
+
| Renames or restructures a file the spec requires editing | **Allow if minimal**, otherwise flag. |
|
|
94
|
+
| Drive-by formatting / style changes across many files | **Flag** — recommend separate PR. |
|
|
95
|
+
| Refactor of a module unrelated to the spec | **Flag** — scope creep. |
|
|
96
|
+
| New feature not mentioned anywhere in spec | **Flag** — scope creep, must justify. |
|
|
97
|
+
| Dependency version bumps | **Flag** — separate PR by convention. |
|
|
98
|
+
| Test additions for the spec'd code | **Allow** — expected. |
|
|
99
|
+
| Test additions for unrelated existing code | **Allow but note** — usually welcome. |
|
|
100
|
+
|
|
101
|
+
When flagging scope creep, always recommend the concrete remediation
|
|
102
|
+
("split out into a follow-up PR" or "move to a separate commit if the team
|
|
103
|
+
allows partial review").
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 5. Intent Drift
|
|
108
|
+
|
|
109
|
+
The trickier failure mode: the diff *runs* but solves a subtly different
|
|
110
|
+
problem than the spec. Symptoms:
|
|
111
|
+
|
|
112
|
+
- Naming uses different domain terms than the spec (e.g., spec says
|
|
113
|
+
"session", code says "token").
|
|
114
|
+
- Data flow contradicts the spec's mental model (e.g., spec says the server
|
|
115
|
+
is the source of truth, code caches and treats local as authoritative).
|
|
116
|
+
- Edge cases the spec called out are silently excluded by an early `return`.
|
|
117
|
+
- The PR title says "fix" but the diff is a rewrite, or vice versa.
|
|
118
|
+
|
|
119
|
+
When you suspect intent drift, quote both the spec sentence and the code
|
|
120
|
+
location side-by-side in the finding.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 6. Requirement Coverage Table — Template
|
|
125
|
+
|
|
126
|
+
Drop this into the Spec Adherence section of the report, one row per
|
|
127
|
+
requirement extracted in step 2.
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
## Spec Adherence
|
|
131
|
+
|
|
132
|
+
**Source**: PR #<num> / Issue #<num>
|
|
133
|
+
|
|
134
|
+
| Requirement | Status | Location |
|
|
135
|
+
|------------------------------------------|-------------------------------------|--------------------------------|
|
|
136
|
+
| <verbatim or paraphrased criterion> | ✅ Implemented | `<file>:<line>` |
|
|
137
|
+
| <criterion with edge case> | ⚠️ Partial — <what's missing> | `<file>:<line>` |
|
|
138
|
+
| <criterion> | ❌ Not implemented | — |
|
|
139
|
+
| <inferred criterion> | ✅ Implemented (inferred) | `<file>:<line>` |
|
|
140
|
+
|
|
141
|
+
**Scope creep**: <count> unrelated change(s) — <one-line summary, recommend split>.
|
|
142
|
+
|
|
143
|
+
**Spec gaps**: <count> criterion/criteria not addressed — see "Must fix" in
|
|
144
|
+
prioritized action items.
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Status legend (use these exact glyphs for greppability):
|
|
148
|
+
|
|
149
|
+
- ✅ Implemented — code satisfies the criterion and tests, if any, cover it.
|
|
150
|
+
- ⚠️ Partial — happy path works, but at least one edge case or branch is
|
|
151
|
+
missing. Always say *what* is missing.
|
|
152
|
+
- ❌ Not implemented — no code addresses the criterion.
|
|
153
|
+
- ➖ Not assessed — no spec context available; do not guess.
|
|
154
|
+
|
|
155
|
+
If `status` is anything other than ✅, the corresponding action item belongs
|
|
156
|
+
in **Must fix** or **Should fix** depending on whether the criterion was
|
|
157
|
+
flagged `must`/`shall` versus `should`.
|