Skill: aposd-verifying-correctness
STOP - Before "Done"
Design quality ≠ correctness. Well-designed code can still have bugs, missing requirements, or safety issues.
Run ALL dimension checks before claiming done. "I think I covered everything" without explicit mapping is a red flag.
Dimension Detection & Checks
For each dimension: detect if it applies, then verify.
1. Requirements Coverage
Detect: Were requirements stated? (explicit list, user request, spec)
If YES, verify:
Red flag: "I think I covered everything" without explicit mapping
2. Concurrency Safety
Detect: Any of these present?
- Multiple threads/processes accessing same data
- Async/await patterns
- Shared mutable state (class attributes, globals)
- "Thread-safe" in requirements or docstring
- Web handlers, queue workers, background tasks
If YES, verify:
Red flag: "It's probably fine" or "Python GIL handles it"
3. Error Handling
Detect: Can any operation fail?
- I/O (file, network, database)
- External calls (APIs, subprocesses)
- Resource acquisition (memory, connections)
- User input processing
- Parsing/deserialization
If YES, verify:
Red flag: "Errors are rare" or "caller handles it" without checking caller
4. Resource Management
Detect: Does code acquire resources?
- File handles, sockets, connections
- Locks, semaphores
- Memory allocations (large buffers, caches)
- External service handles
- Background threads/processes
If YES, verify:
Red flag: "It cleans up eventually" or daemon threads without shutdown
5. Boundary Conditions
Detect: Does code handle variable-size input?
- Collections (lists, dicts, sets)
- Strings, byte arrays
- Numeric ranges
- Optional/nullable values
If YES, verify:
Red flag: "Nobody would pass that" or "that's an edge case"
6. Security (if applicable)
Detect: Does code handle untrusted input?
- User-provided data (forms, API requests)
- File contents from external sources
- URLs, paths, identifiers from users
- Data that becomes SQL, shell, HTML, or code
If YES, verify:
Red flag: "It's internal only" (internals get exposed)
Quick Checklist (Minimum)
Before "done", answer YES to all that apply:
| Dimension |
Detection Trigger |
Verified? |
| Requirements |
Requirements were stated |
[ ] Each mapped to code |
| Concurrency |
Shared state exists |
[ ] All access protected |
| Errors |
Operations can fail |
[ ] All failures handled |
| Resources |
Resources acquired |
[ ] All released (incl. errors) |
| Boundaries |
Variable-size input |
[ ] Edge cases handled |
| Security |
Untrusted input |
[ ] Input validated |
Anti-Rationalization Table
| Thought |
Reality |
| "Design is good, so it works" |
Design ≠ correctness. Check anyway. |
| "It's simple code" |
Simple code has bugs too. Check anyway. |
| "I'll add error handling later" |
Later = never. Check now. |
| "Edge cases are rare" |
Edge cases cause production incidents. |
| "It's not user-facing" |
Internal code gets exposed. Check anyway. |
| "Tests will catch it" |
Tests check what you wrote, not what you missed. |
Output Format
When verifying, output:
## Correctness Verification
### Requirements: [PASS/FAIL/N/A]
- Requirement 1 → implemented in X
- Requirement 2 → implemented in Y
### Concurrency: [PASS/FAIL/N/A]
- Shared state: [list]
- Protection: [how]
### Errors: [PASS/FAIL/N/A]
- Failure points: [list]
- Handling: [approach]
### Resources: [PASS/FAIL/N/A]
- Acquired: [list]
- Released: [how]
### Boundaries: [PASS/FAIL/N/A]
- Edge cases: [list]
- Handling: [approach]
### Security: [PASS/FAIL/N/A]
- Untrusted input: [list]
- Validation: [approach]
**Verdict:** [DONE / NOT DONE - list blockers]
Relationship to Other Skills
| Skill |
Focus |
When |
| aposd-designing-deep-modules |
Design quality |
FIRST—during design |
| aposd-maintaining-design-quality |
Design philosophy |
During modification |
| aposd-verifying-correctness |
Actual correctness |
BEFORE "done" |
| cc-quality-practices |
Testing/debugging |
Throughout |
Order: Design → Implement → Verify (this skill) → Done
Chain
| After |
Next |
| All dimensions pass |
Done (pre-commit gate) |
1---
2name: aposd-verifying-correctness
3description: "Verify code correctness before claiming done or committing. Run 6-dimension checklist: requirements coverage, concurrency safety, error handling, resource management, boundary conditions, and security. Output PASS/FAIL per dimension with final DONE/NOT DONE verdict. Use after implementation as pre-commit gate. Triggers on: is it done, ready to commit, verify correctness, did I miss anything, pre-commit check."
4metadata:
5 source: https://skillmd.com/skills/aibot88/aposd-verifying-correctness
6---
7
8# Skill: aposd-verifying-correctness
9
10## STOP - Before "Done"
11
12**Design quality ≠ correctness.** Well-designed code can still have bugs, missing requirements, or safety issues.
13
14**Run ALL dimension checks before claiming done.** "I think I covered everything" without explicit mapping is a red flag.
15
16---
17
18## Dimension Detection & Checks
19
20For each dimension: detect if it applies, then verify.
21
22---
23
24### 1. Requirements Coverage
25
26**Detect:** Were requirements stated? (explicit list, user request, spec)
27
28**If YES, verify:**
29- [ ] List each requirement explicitly
30- [ ] For each: point to code that implements it
31- [ ] Any requirement without code? → **Not done**
32- [ ] Any code without requirement? → Scope creep or missing requirement
33
34**Red flag:** "I think I covered everything" without explicit mapping
35
36---
37
38### 2. Concurrency Safety
39
40**Detect:** Any of these present?
41- Multiple threads/processes accessing same data
42- Async/await patterns
43- Shared mutable state (class attributes, globals)
44- "Thread-safe" in requirements or docstring
45- Web handlers, queue workers, background tasks
46
47**If YES, verify:**
48- [ ] All shared mutable state identified
49- [ ] Each access point protected (lock, atomic, queue, immutable)
50- [ ] No time-of-check to time-of-use (TOCTOU) gaps
51- [ ] Lock ordering consistent (if multiple locks)
52
53**Red flag:** "It's probably fine" or "Python GIL handles it"
54
55---
56
57### 3. Error Handling
58
59**Detect:** Can any operation fail?
60- I/O (file, network, database)
61- External calls (APIs, subprocesses)
62- Resource acquisition (memory, connections)
63- User input processing
64- Parsing/deserialization
65
66**If YES, verify:**
67- [ ] Each failure point has explicit handling OR propagates
68- [ ] No bare `except:` or `except Exception: pass`
69- [ ] Error messages actionable (what failed, why, how to fix)
70- [ ] Partial failures handled (rollback, cleanup, consistent state)
71
72**Red flag:** "Errors are rare" or "caller handles it" without checking caller
73
74---
75
76### 4. Resource Management
77
78**Detect:** Does code acquire resources?
79- File handles, sockets, connections
80- Locks, semaphores
81- Memory allocations (large buffers, caches)
82- External service handles
83- Background threads/processes
84
85**If YES, verify:**
86- [ ] Every acquire has corresponding release
87- [ ] Release happens in finally/context manager/destructor
88- [ ] Release happens on error paths too
89- [ ] No resource leaks on repeated calls
90- [ ] Bounded growth (caches have limits, queues have limits)
91
92**Red flag:** "It cleans up eventually" or daemon threads without shutdown
93
94---
95
96### 5. Boundary Conditions
97
98**Detect:** Does code handle variable-size input?
99- Collections (lists, dicts, sets)
100- Strings, byte arrays
101- Numeric ranges
102- Optional/nullable values
103
104**If YES, verify:**
105- [ ] Empty input: What happens with `[]`, `""`, `None`, `0`?
106- [ ] Single item: Edge case often different from N items
107- [ ] Maximum size: What if input is huge? Memory? Time?
108- [ ] Invalid values: Negative numbers, NaN, special characters?
109- [ ] Type boundaries: int overflow, float precision?
110
111**Red flag:** "Nobody would pass that" or "that's an edge case"
112
113---
114
115### 6. Security (if applicable)
116
117**Detect:** Does code handle untrusted input?
118- User-provided data (forms, API requests)
119- File contents from external sources
120- URLs, paths, identifiers from users
121- Data that becomes SQL, shell, HTML, or code
122
123**If YES, verify:**
124- [ ] Input validated before use
125- [ ] No string concatenation for SQL/shell/HTML (use parameterized)
126- [ ] Path traversal prevented (no `../` exploitation)
127- [ ] Secrets not logged or exposed in errors
128- [ ] Auth/authz checked before action, not after
129
130**Red flag:** "It's internal only" (internals get exposed)
131
132---
133
134## Quick Checklist (Minimum)
135
136Before "done", answer YES to all that apply:
137
138| Dimension | Detection Trigger | Verified? |
139|-----------|-------------------|-----------|
140| Requirements | Requirements were stated | [ ] Each mapped to code |
141| Concurrency | Shared state exists | [ ] All access protected |
142| Errors | Operations can fail | [ ] All failures handled |
143| Resources | Resources acquired | [ ] All released (incl. errors) |
144| Boundaries | Variable-size input | [ ] Edge cases handled |
145| Security | Untrusted input | [ ] Input validated |
146
147---
148
149## Anti-Rationalization Table
150
151| Thought | Reality |
152|---------|---------|
153| "Design is good, so it works" | Design ≠ correctness. Check anyway. |
154| "It's simple code" | Simple code has bugs too. Check anyway. |
155| "I'll add error handling later" | Later = never. Check now. |
156| "Edge cases are rare" | Edge cases cause production incidents. |
157| "It's not user-facing" | Internal code gets exposed. Check anyway. |
158| "Tests will catch it" | Tests check what you wrote, not what you missed. |
159
160---
161
162## Output Format
163
164When verifying, output:
165
166```
167## Correctness Verification
168
169### Requirements: [PASS/FAIL/N/A]
170- Requirement 1 → implemented in X
171- Requirement 2 → implemented in Y
172
173### Concurrency: [PASS/FAIL/N/A]
174- Shared state: [list]
175- Protection: [how]
176
177### Errors: [PASS/FAIL/N/A]
178- Failure points: [list]
179- Handling: [approach]
180
181### Resources: [PASS/FAIL/N/A]
182- Acquired: [list]
183- Released: [how]
184
185### Boundaries: [PASS/FAIL/N/A]
186- Edge cases: [list]
187- Handling: [approach]
188
189### Security: [PASS/FAIL/N/A]
190- Untrusted input: [list]
191- Validation: [approach]
192
193**Verdict:** [DONE / NOT DONE - list blockers]
194```
195
196---
197
198## Relationship to Other Skills
199
200| Skill | Focus | When |
201|-------|-------|------|
202| **aposd-designing-deep-modules** | Design quality | FIRST—during design |
203| **aposd-maintaining-design-quality** | Design philosophy | During modification |
204| **aposd-verifying-correctness** | Actual correctness | BEFORE "done" |
205| **cc-quality-practices** | Testing/debugging | Throughout |
206
207**Order:** Design → Implement → Verify (this skill) → Done
208
209
210---
211
212## Chain
213
214| After | Next |
215|-------|------|
216| All dimensions pass | Done (pre-commit gate) |