invar-tools 1.8.0__py3-none-any.whl → 1.11.0__py3-none-any.whl

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 (117) hide show
  1. invar/__init__.py +8 -0
  2. invar/core/doc_edit.py +187 -0
  3. invar/core/doc_parser.py +563 -0
  4. invar/core/language.py +88 -0
  5. invar/core/models.py +106 -0
  6. invar/core/patterns/detector.py +6 -1
  7. invar/core/patterns/p0_exhaustive.py +15 -3
  8. invar/core/patterns/p0_literal.py +15 -3
  9. invar/core/patterns/p0_newtype.py +15 -3
  10. invar/core/patterns/p0_nonempty.py +15 -3
  11. invar/core/patterns/p0_validation.py +15 -3
  12. invar/core/patterns/registry.py +5 -1
  13. invar/core/patterns/types.py +5 -1
  14. invar/core/property_gen.py +4 -0
  15. invar/core/rules.py +84 -18
  16. invar/core/sync_helpers.py +27 -1
  17. invar/core/ts_parsers.py +286 -0
  18. invar/core/ts_sig_parser.py +310 -0
  19. invar/mcp/handlers.py +408 -0
  20. invar/mcp/server.py +288 -143
  21. invar/node_tools/MANIFEST +7 -0
  22. invar/node_tools/__init__.py +51 -0
  23. invar/node_tools/fc-runner/cli.js +77 -0
  24. invar/node_tools/quick-check/cli.js +28 -0
  25. invar/node_tools/ts-analyzer/cli.js +480 -0
  26. invar/shell/claude_hooks.py +35 -12
  27. invar/shell/commands/doc.py +409 -0
  28. invar/shell/commands/guard.py +41 -1
  29. invar/shell/commands/init.py +154 -16
  30. invar/shell/commands/perception.py +157 -33
  31. invar/shell/commands/skill.py +187 -0
  32. invar/shell/commands/template_sync.py +65 -13
  33. invar/shell/commands/uninstall.py +60 -12
  34. invar/shell/commands/update.py +6 -14
  35. invar/shell/contract_coverage.py +1 -0
  36. invar/shell/doc_tools.py +459 -0
  37. invar/shell/fs.py +67 -13
  38. invar/shell/pi_hooks.py +6 -0
  39. invar/shell/prove/crosshair.py +3 -0
  40. invar/shell/prove/guard_ts.py +902 -0
  41. invar/shell/skill_manager.py +355 -0
  42. invar/shell/template_engine.py +28 -4
  43. invar/shell/templates.py +4 -4
  44. invar/templates/claude-md/python/critical-rules.md +33 -0
  45. invar/templates/claude-md/python/quick-reference.md +24 -0
  46. invar/templates/claude-md/typescript/critical-rules.md +40 -0
  47. invar/templates/claude-md/typescript/quick-reference.md +24 -0
  48. invar/templates/claude-md/universal/check-in.md +25 -0
  49. invar/templates/claude-md/universal/skills.md +73 -0
  50. invar/templates/claude-md/universal/workflow.md +55 -0
  51. invar/templates/commands/{audit.md → audit.md.jinja} +18 -1
  52. invar/templates/config/AGENT.md.jinja +58 -0
  53. invar/templates/config/CLAUDE.md.jinja +16 -209
  54. invar/templates/config/context.md.jinja +19 -0
  55. invar/templates/examples/{README.md → python/README.md} +2 -0
  56. invar/templates/examples/{conftest.py → python/conftest.py} +1 -1
  57. invar/templates/examples/{contracts.py → python/contracts.py} +81 -4
  58. invar/templates/examples/python/core_shell.py +227 -0
  59. invar/templates/examples/python/functional.py +613 -0
  60. invar/templates/examples/typescript/README.md +31 -0
  61. invar/templates/examples/typescript/contracts.ts +163 -0
  62. invar/templates/examples/typescript/core_shell.ts +374 -0
  63. invar/templates/examples/typescript/functional.ts +601 -0
  64. invar/templates/examples/typescript/workflow.md +95 -0
  65. invar/templates/hooks/PostToolUse.sh.jinja +10 -1
  66. invar/templates/hooks/PreToolUse.sh.jinja +38 -0
  67. invar/templates/hooks/Stop.sh.jinja +1 -1
  68. invar/templates/hooks/UserPromptSubmit.sh.jinja +7 -0
  69. invar/templates/hooks/pi/invar.ts.jinja +9 -0
  70. invar/templates/manifest.toml +7 -6
  71. invar/templates/onboard/assessment.md.jinja +214 -0
  72. invar/templates/onboard/patterns/python.md +347 -0
  73. invar/templates/onboard/patterns/typescript.md +452 -0
  74. invar/templates/onboard/roadmap.md.jinja +168 -0
  75. invar/templates/protocol/INVAR.md.jinja +51 -0
  76. invar/templates/protocol/python/architecture-examples.md +41 -0
  77. invar/templates/protocol/python/contracts-syntax.md +56 -0
  78. invar/templates/protocol/python/markers.md +44 -0
  79. invar/templates/protocol/python/tools.md +24 -0
  80. invar/templates/protocol/python/troubleshooting.md +38 -0
  81. invar/templates/protocol/typescript/architecture-examples.md +52 -0
  82. invar/templates/protocol/typescript/contracts-syntax.md +73 -0
  83. invar/templates/protocol/typescript/markers.md +48 -0
  84. invar/templates/protocol/typescript/tools.md +65 -0
  85. invar/templates/protocol/typescript/troubleshooting.md +104 -0
  86. invar/templates/protocol/universal/architecture.md +36 -0
  87. invar/templates/protocol/universal/completion.md +14 -0
  88. invar/templates/protocol/universal/contracts-concept.md +37 -0
  89. invar/templates/protocol/universal/header.md +17 -0
  90. invar/templates/protocol/universal/session.md +17 -0
  91. invar/templates/protocol/universal/six-laws.md +10 -0
  92. invar/templates/protocol/universal/usbv.md +14 -0
  93. invar/templates/protocol/universal/visible-workflow.md +25 -0
  94. invar/templates/skills/develop/SKILL.md.jinja +85 -3
  95. invar/templates/skills/extensions/_registry.yaml +93 -0
  96. invar/templates/skills/extensions/acceptance/SKILL.md +383 -0
  97. invar/templates/skills/extensions/invar-onboard/SKILL.md +448 -0
  98. invar/templates/skills/extensions/invar-onboard/patterns/python.md +347 -0
  99. invar/templates/skills/extensions/invar-onboard/patterns/typescript.md +452 -0
  100. invar/templates/skills/extensions/invar-onboard/templates/assessment.md.jinja +214 -0
  101. invar/templates/skills/extensions/invar-onboard/templates/roadmap.md.jinja +168 -0
  102. invar/templates/skills/extensions/security/SKILL.md +382 -0
  103. invar/templates/skills/extensions/security/patterns/_common.yaml +126 -0
  104. invar/templates/skills/extensions/security/patterns/python.yaml +155 -0
  105. invar/templates/skills/extensions/security/patterns/typescript.yaml +194 -0
  106. invar/templates/skills/review/SKILL.md.jinja +220 -248
  107. {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/METADATA +336 -12
  108. invar_tools-1.11.0.dist-info/RECORD +178 -0
  109. invar/templates/examples/core_shell.py +0 -127
  110. invar/templates/protocol/INVAR.md +0 -310
  111. invar_tools-1.8.0.dist-info/RECORD +0 -116
  112. /invar/templates/examples/{workflow.md → python/workflow.md} +0 -0
  113. {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/WHEEL +0 -0
  114. {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/entry_points.txt +0 -0
  115. {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/licenses/LICENSE +0 -0
  116. {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/licenses/LICENSE-GPL +0 -0
  117. {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/licenses/NOTICE +0 -0
@@ -96,10 +96,11 @@ If task appears simple (4+ signals: single file, clear target, additive change,
96
96
 
97
97
  ### 2. SPECIFY
98
98
 
99
- - **Contracts FIRST:** Write `@pre`/`@post` before implementation
100
- - **Doctests:** Add examples for expected behavior
99
+ - **Contracts FIRST:** Write contracts before implementation
100
+ - **Examples:** Add examples for expected behavior
101
101
  - **Design:** Decompose complex tasks into sub-functions
102
102
 
103
+ {% if language == "python" %}
103
104
  ```python
104
105
  # SPECIFY before BUILD:
105
106
  @pre(lambda x: x > 0)
@@ -111,6 +112,25 @@ def calculate(x: int) -> int:
111
112
  """
112
113
  ... # Implementation comes in BUILD
113
114
  ```
115
+ {% elif language == "typescript" %}
116
+ ```typescript
117
+ // SPECIFY before BUILD:
118
+ import { z } from 'zod';
119
+
120
+ const CalculateInput = z.number().positive();
121
+ const CalculateOutput = z.number().nonnegative();
122
+
123
+ /**
124
+ * @example
125
+ * calculate(10) // => 100
126
+ */
127
+ function calculate(x: number): number {
128
+ const validated = CalculateInput.parse(x);
129
+ // Implementation comes in BUILD
130
+ return CalculateOutput.parse(result);
131
+ }
132
+ ```
133
+ {% endif %}
114
134
 
115
135
  #### Function-Level Gates (DX-63)
116
136
 
@@ -212,6 +232,52 @@ Co-Authored-By: Claude <noreply@anthropic.com>"
212
232
  - All TodoWrite items complete
213
233
  - Integration works (if applicable)
214
234
 
235
+ #### Isolation Requirement (DX-75)
236
+
237
+ **For non-trivial implementations (>3 functions OR >200 lines), VALIDATE requires isolation:**
238
+
239
+ ```
240
+ ┌─────────────────────────────────────────────────────────────┐
241
+ │ VALIDATE with Isolation │
242
+ │ ───────────────────────────────────────────────────────────│
243
+ │ │
244
+ │ Why: You (the builder) have context contamination. │
245
+ │ You "know" what the code is supposed to do. │
246
+ │ You cannot objectively verify your own work. │
247
+ │ │
248
+ │ Steps: │
249
+ │ 1. Main Agent: Run invar_guard() — mechanical checks │
250
+ │ │
251
+ │ 2. Spawn Isolated VALIDATOR (Task tool, model=opus): │
252
+ │ ┌─────────────────────────────────────────────────┐ │
253
+ │ │ RECEIVES: │ │
254
+ │ │ - Implementation files │ │
255
+ │ │ - Contracts (@pre/@post) │ │
256
+ │ │ - Original task description │ │
257
+ │ │ │ │
258
+ │ │ DOES NOT RECEIVE: │ │
259
+ │ │ - Development conversation │ │
260
+ │ │ - Your reasoning or decisions │ │
261
+ │ │ - Previous iterations │ │
262
+ │ │ │ │
263
+ │ │ TASK: "Does this implementation satisfy the │ │
264
+ │ │ contracts? Are there gaps or edge cases?" │ │
265
+ │ └─────────────────────────────────────────────────┘ │
266
+ │ │
267
+ │ 3. If VALIDATOR finds issues: │
268
+ │ - Main agent fixes │
269
+ │ - Spawn NEW validator (never reuse) │
270
+ │ - Repeat until PASS │
271
+ │ │
272
+ │ Exit: Guard PASS + Isolated Validator PASS │
273
+ └─────────────────────────────────────────────────────────────┘
274
+ ```
275
+
276
+ **Skip isolation when:**
277
+ - Simple changes (<3 functions AND <200 lines)
278
+ - Pure refactoring (no behavior change)
279
+ - Documentation-only changes
280
+
215
281
  ## Task Batching
216
282
 
217
283
  For multiple tasks:
@@ -240,6 +306,7 @@ For multiple tasks:
240
306
 
241
307
  Quick reference for resolving common Guard errors:
242
308
 
309
+ {% if language == "python" %}
243
310
  | Error | Cause | Quick Fix |
244
311
  |-------|-------|-----------|
245
312
  | `forbidden_import: io` | I/O library in Core | Use `iter(s.splitlines())` not `io.StringIO` |
@@ -258,6 +325,18 @@ Check the "Suggested:" line in Guard output.
258
325
 
259
326
  **Note:** Use `from deal import pre, post` for lambda-based contracts.
260
327
  `invar_runtime.pre/post` are for Contract objects like `NonEmpty`.
328
+ {% elif language == "typescript" %}
329
+ | Error | Cause | Quick Fix |
330
+ |-------|-------|-----------|
331
+ | `forbidden_import: fs` | fs module in Core | Accept path as parameter instead |
332
+ | `forbidden_import: path` | path module in Core | Accept string path as parameter |
333
+ | `missing_contract` | Core function without contract comments | Add @pre/@post comments |
334
+ | `empty_contract` | Contract with no condition | Add meaningful condition |
335
+ | `file_size` | File > 500 lines | Extract functions to new module |
336
+ | `shell_result` | Shell function missing Result | Return `Result<T, E>` type |
337
+
338
+ **Tip:** For `missing_contract`, Guard automatically suggests contracts based on parameter types.
339
+ {% endif %}
261
340
 
262
341
  ## Timeout Handling
263
342
 
@@ -392,8 +471,11 @@ Agent:
392
471
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
393
472
  📍 /develop → SPECIFY (2/4)
394
473
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
395
-
474
+ {% if language == "python" %}
396
475
  @pre(lambda source, path: len(source.strip()) > 0)
476
+ {% elif language == "typescript" %}
477
+ const SourceInput = z.string().refine(s => s.trim().length > 0);
478
+ {% endif %}
397
479
 
398
480
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
399
481
  📍 /develop → BUILD (3/4)
@@ -0,0 +1,93 @@
1
+ # Invar Extension Skills Registry
2
+ # This file defines available extension skills for `invar skill` commands
3
+
4
+ version: "1.0"
5
+
6
+ extensions:
7
+ invar-onboard:
8
+ name: "invar-onboard"
9
+ description: "Legacy project migration to Invar framework"
10
+ tier: T1
11
+ triggers:
12
+ - "onboard"
13
+ - "migrate to invar"
14
+ - "can this project use invar"
15
+ - "invar assessment"
16
+ isolation: false
17
+ files:
18
+ - "SKILL.md"
19
+ - "patterns"
20
+ - "templates"
21
+
22
+ acceptance:
23
+ name: "acceptance"
24
+ description: "Requirements acceptance review (PRD alignment)"
25
+ tier: T0
26
+ triggers:
27
+ - "acceptance"
28
+ - "check requirements"
29
+ - "PRD alignment"
30
+ - "acceptance review"
31
+ - "verify requirements"
32
+ isolation: true # Uses context isolation by default
33
+ files:
34
+ - "SKILL.md"
35
+
36
+ security:
37
+ name: "security"
38
+ description: "Security audit (OWASP Top 10)"
39
+ tier: T0
40
+ triggers:
41
+ - "security"
42
+ - "audit"
43
+ - "vulnerabilities"
44
+ - "OWASP"
45
+ isolation: true # Uses context isolation by default
46
+ files:
47
+ - "SKILL.md"
48
+ - "patterns/_common.yaml"
49
+ - "patterns/python.yaml"
50
+ - "patterns/typescript.yaml"
51
+
52
+ refactor:
53
+ name: "refactor"
54
+ description: "Refactoring strategy and execution"
55
+ tier: T1
56
+ status: pending_discussion
57
+ triggers:
58
+ - "refactor"
59
+ - "clean up"
60
+ - "simplify"
61
+ - "restructure"
62
+ isolation: false
63
+ files:
64
+ - "SKILL.md"
65
+
66
+ debug:
67
+ name: "debug"
68
+ description: "Root cause analysis"
69
+ tier: T1
70
+ status: pending_discussion
71
+ triggers:
72
+ - "debug"
73
+ - "why does"
74
+ - "root cause"
75
+ - "error"
76
+ - "bug"
77
+ isolation: false
78
+ files:
79
+ - "SKILL.md"
80
+
81
+ test-strategy:
82
+ name: "test-strategy"
83
+ description: "Test strategy design"
84
+ tier: T1
85
+ status: pending_discussion
86
+ triggers:
87
+ - "test strategy"
88
+ - "how to test"
89
+ - "what to test"
90
+ - "testing plan"
91
+ isolation: false
92
+ files:
93
+ - "SKILL.md"
@@ -0,0 +1,383 @@
1
+ <!--invar:skill-->
2
+ # /acceptance — Requirements Acceptance Review
3
+
4
+ > Extension Skill | Tier: T0 | Isolation: Default
5
+
6
+ ## Purpose
7
+
8
+ Verify implementation satisfies requirements with adversarial rigor. This skill performs PRD alignment review, checking that all requirements are implemented and edge cases are handled.
9
+
10
+ ## Triggers
11
+
12
+ Use this skill when user says: "acceptance", "check requirements", "PRD alignment", "acceptance review", "verify requirements"
13
+
14
+ ## Relationship to Core Skills
15
+
16
+ - `/review` = Code quality (bugs, contracts, security)
17
+ - `/acceptance` = Feature completeness (requirements coverage)
18
+
19
+ ---
20
+
21
+ ## Core Principles
22
+
23
+ | Principle | Description |
24
+ |-----------|-------------|
25
+ | **Skeptical by default** | Assume feature is NOT implemented until proven otherwise |
26
+ | **Evidence required** | "Implemented" requires file:line proof, not intuition |
27
+ | **Deep challenge** | Every requirement gets adversarial scenarios, no shortcuts |
28
+ | **Graceful degradation** | Works without Invar contracts (falls back to code analysis) |
29
+ | **Polluter pays** | External verification must restore state, or use dry-run |
30
+
31
+ ---
32
+
33
+ ## Depth Levels
34
+
35
+ | Level | Scope | Use Case |
36
+ |-------|-------|----------|
37
+ | `--quick` | P0 (Must-have) only, skip NFR/UI | Fast feedback, CI gates |
38
+ | `--standard` | P0 + P1, sample challenges | Normal development |
39
+ | `--deep` (default) | ALL requirements, full challenge, external verify | Release readiness |
40
+
41
+ **Default is `--deep`** — thorough verification is the norm.
42
+
43
+ ---
44
+
45
+ ## Workflow
46
+
47
+ ### Step 0: Isolation Check
48
+
49
+ ```
50
+ Parse depth: --quick / --standard / --deep (default)
51
+
52
+ If --deep (default):
53
+ ┌─────────────────────────────────────────────────────────┐
54
+ │ SPAWN ISOLATED AGENT │
55
+ │ │
56
+ │ Collect inputs: │
57
+ │ • PRD path (smart search or user-provided) │
58
+ │ • Design paths (if found) │
59
+ │ • Code scope (files/directories to review) │
60
+ │ │
61
+ │ Spawn Task agent with: │
62
+ │ • QA Acceptance Reviewer persona (see below) │
63
+ │ • NO conversation history │
64
+ │ • Only the collected inputs │
65
+ │ │
66
+ │ → Isolated agent executes steps 1-5 below │
67
+ │ → Returns structured report │
68
+ └─────────────────────────────────────────────────────────┘
69
+
70
+ If --quick or --standard:
71
+ └─ Continue in same context with persona switch
72
+ ```
73
+
74
+ ### Step 1: Entry
75
+
76
+ - Detect Invar (Enhanced/Standalone mode)
77
+ - Locate PRD: smart search or user-provided path
78
+ - Locate Design: design/, mockups/, figma/ (if exists)
79
+
80
+ **Invar Detection:**
81
+ - File-based: `INVAR.md` exists OR `.invar/` directory exists
82
+ - Context-based: `invar_guard` tool available in session
83
+ - Enhanced Mode → Use invar_guard, invar_sig, invar_map
84
+ - Standalone Mode → Use Read, Grep, Glob, Bash only
85
+
86
+ ### Step 2: Parse — Extract Requirements
87
+
88
+ Read PRD and extract:
89
+ - **FR (Functional):** What system must DO
90
+ - **NFR (Non-Functional):** Performance, security, UX
91
+ - **EC (Edge Case):** Explicitly mentioned scenarios
92
+ - **UI (UI/UX):** Visual/interaction requirements (if any)
93
+
94
+ **Output format:**
95
+ ```markdown
96
+ | ID | Type | Requirement | Priority |
97
+ |-------|------|--------------------------|----------|
98
+ | FR-1 | FR | User can login with email| Must |
99
+ | NFR-1 | NFR | Response time < 200ms | Should |
100
+ | UI-1 | UI | Login button is blue #007| Could |
101
+ ```
102
+
103
+ ### Step 3: Map — Link to Implementation (Skeptical)
104
+
105
+ **DEFAULT STATUS: ❌ Missing** (upgrade only with evidence)
106
+
107
+ **Evidence Sources (priority order):**
108
+ 1. Invar contracts (@pre/@post matching requirement)
109
+ 2. Type signatures + docstrings
110
+ 3. Test cases covering the requirement
111
+ 4. Code implementation (read and verify)
112
+
113
+ **Enhanced Mode:**
114
+ - `invar_sig` to find functions + contracts
115
+ - Cross-reference contracts with requirements
116
+
117
+ **Standalone Mode (no contracts):**
118
+ - Grep for requirement keywords
119
+ - Read docstrings, type hints, comments
120
+ - Trace code flow to verify implementation
121
+
122
+ **Output format:**
123
+ ```markdown
124
+ | ID | Requirement | Evidence | Status |
125
+ |------|--------------|--------------------| ------------|
126
+ | FR-1 | User login | auth.py:45 @post | ✅ Complete |
127
+ | FR-2 | Password reset| - | ❌ Missing |
128
+ | FR-3 | Email verify | email.py:30 (partial)| ⚠️ Partial|
129
+ ```
130
+
131
+ ### Step 4: Challenge — Deep Adversarial Scenarios
132
+
133
+ For **EVERY** requirement (no shortcuts):
134
+
135
+ **Functional (FR):**
136
+ - "What if input is empty/null/malformed?"
137
+ - "What if user lacks permission?"
138
+ - "What if dependent service fails?"
139
+ - "What if called twice/concurrently?"
140
+
141
+ **Non-Functional (NFR):**
142
+ - "Is there evidence this is measured?"
143
+ - "What's the worst-case scenario?"
144
+ - "How does it degrade under load?"
145
+
146
+ **Edge Cases (EC):**
147
+ - "Is boundary explicitly handled?"
148
+ - "What's the error message?"
149
+ - "Is it tested?"
150
+
151
+ **UI/UX (UI):**
152
+ - "Does implementation match design spec?"
153
+ - "Are design tokens correct (colors, spacing)?"
154
+ - "Is interaction behavior as specified?"
155
+
156
+ **Output format:**
157
+ ```markdown
158
+ | Scenario | Expected | Actual | Gap? |
159
+ |-----------------------|--------------|---------|------|
160
+ | Wrong password 5x | Lock account | No lock | ❌ |
161
+ | Empty email | Error msg | Crash | ❌ |
162
+ | Concurrent login | Queue/reject | Race bug| ❌ |
163
+ ```
164
+
165
+ ### Step 5: Verify — External Tool Validation
166
+
167
+ **POLLUTER PAYS PRINCIPLE:**
168
+ ```
169
+ Before running external verification:
170
+ 1. Can state be restored? (snapshot, rollback, reset)
171
+ → YES: Run freely, restore after
172
+ → NO: Must use dry-run / read-only mode
173
+
174
+ Examples:
175
+ • DB: Use transaction + rollback, or test DB
176
+ • Files: Backup → run → restore
177
+ • API: Use sandbox/test endpoint
178
+ • Destructive: MUST dry-run (--dry-run, --whatif)
179
+ ```
180
+
181
+ **Web Projects:**
182
+ - Playwright/Puppeteer for E2E flows
183
+ - curl/httpie for API endpoints
184
+ - Lighthouse for performance NFRs
185
+
186
+ **CLI Projects:**
187
+ - Actually invoke commands with test inputs
188
+ - Verify exit codes and output format
189
+
190
+ **Library Projects:**
191
+ - Run existing test suite
192
+ - Execute doctest examples
193
+
194
+ **NFR Benchmarks:**
195
+ ```bash
196
+ # Response Time
197
+ time curl -s http://localhost:8000/api/endpoint
198
+ hyperfine 'curl -s http://localhost:8000/api/endpoint'
199
+
200
+ # Load Testing
201
+ wrk -t4 -c100 -d30s http://localhost:8000/api/endpoint
202
+
203
+ # Memory
204
+ /usr/bin/time -v python script.py
205
+ ```
206
+
207
+ **UI/UX Deep Verification (4 levels):**
208
+ 1. **Level 1: Design Tokens** — Colors, Typography, Spacing
209
+ 2. **Level 2: Layout** — Flexbox/Grid alignment, Responsive breakpoints
210
+ 3. **Level 3: Interaction** — Hover/focus states, Animation, Keyboard nav
211
+ 4. **Level 4: Visual Regression** — Screenshot comparison (if baseline exists)
212
+
213
+ ### Step 6: Report — Coverage Matrix + Integration
214
+
215
+ ```markdown
216
+ ## Validation Report
217
+
218
+ **PRD:** docs/requirements.md
219
+ **Design:** design/mockups/ (if found)
220
+ **Mode:** Enhanced (Invar detected) / Standalone
221
+
222
+ ### Coverage Summary
223
+ | Status | Count | Percent |
224
+ |-------------|-------|---------|
225
+ | ✅ Complete | 7 | 58% |
226
+ | ⚠️ Partial | 3 | 25% |
227
+ | ❌ Missing | 2 | 17% |
228
+
229
+ ### Critical Gaps
230
+ 1. FR-2: Password reset — Not implemented
231
+ 2. NFR-1: Response time — Not measured
232
+
233
+ ### Adversarial Findings
234
+ | Finding | Severity | Location |
235
+ |----------------------------|----------|---------------|
236
+ | Account lockout missing | High | auth.py |
237
+ | Input validation incomplete| Medium | forms.py:23 |
238
+
239
+ ### UI/UX Discrepancies (if applicable)
240
+ | Element | Design | Actual | Action |
241
+ |--------------|-----------|-----------|--------------|
242
+ | Login button | #0070f3 | #007bff | Update color |
243
+
244
+ ### NFR Verification Results
245
+ | Requirement | Target | Measured | Status |
246
+ |-------------------|----------|----------|-----------|
247
+ | Response time | < 200ms | 145ms | ✅ Pass |
248
+ | Memory usage | < 100MB | 89MB | ✅ Pass |
249
+
250
+ ### Suggested /develop Tasks
251
+
252
+ **High Priority (Must-have gaps):**
253
+ 1. FR-2: Password reset
254
+ - Scope: auth/ module
255
+ - Estimate: ~80 LOC, 2 new functions
256
+
257
+ 2. Account lockout (adversarial finding)
258
+ - Scope: auth/session.py
259
+ - Estimate: ~30 LOC
260
+
261
+ ### Next Actions
262
+ 1. [ ] Implement FR-2 (use /develop)
263
+ 2. [ ] Add account lockout (use /develop)
264
+ 3. [ ] Run load test for NFR verification
265
+ ```
266
+
267
+ ---
268
+
269
+ ## PRD Smart Search
270
+
271
+ When user says "PRD" without path:
272
+
273
+ ```
274
+ Search order:
275
+ 1. docs/prd.md, docs/PRD.md, docs/requirements.md
276
+ 2. *.prd.md, *requirements*.md, *spec*.md
277
+ 3. README.md (Requirements section)
278
+ 4. .invar/prd.md
279
+
280
+ If multiple → ask user to select
281
+ If none → ask user for path
282
+ ```
283
+
284
+ ---
285
+
286
+ ## Design File Detection
287
+
288
+ ```
289
+ Search order:
290
+ 1. design/, mockups/, figma/
291
+ 2. *.fig, *.sketch (metadata only)
292
+ 3. docs/design/, docs/ui/
293
+ 4. .invar/design/
294
+
295
+ If found → enable UI/UX verification
296
+ If not → skip UI checks, note in report
297
+ ```
298
+
299
+ ---
300
+
301
+ ## Contract Fallback Strategy
302
+
303
+ When Invar contracts are not available:
304
+
305
+ | Fallback Level | Evidence Source | Confidence |
306
+ |----------------|-----------------|------------|
307
+ | 1. Type hints | `def login(email: str) -> User` | Medium |
308
+ | 2. Docstrings | `"""Returns user if valid credentials."""` | Medium |
309
+ | 3. Test cases | `test_login_success()` exists | High |
310
+ | 4. Code trace | Read implementation, verify logic | Low |
311
+
312
+ **Important:** Without contracts, increase skepticism. Code that "looks implemented" may have subtle bugs.
313
+
314
+ ---
315
+
316
+ ## QA Acceptance Reviewer Persona
317
+
318
+ Used in `--deep` mode (isolated agent):
319
+
320
+ ```
321
+ You are an independent QA Acceptance Reviewer.
322
+
323
+ CRITICAL RULES:
324
+ 1. You have NEVER seen this code before
325
+ 2. You do NOT know what the developer intended
326
+ 3. Assume NOTHING works until you verify evidence
327
+ 4. Your job is to FIND GAPS, not confirm success
328
+ 5. Be adversarial — challenge every claim
329
+
330
+ INPUT YOU WILL RECEIVE:
331
+ - PRD/Requirements document
332
+ - Code files to review
333
+ - Design specs (optional)
334
+
335
+ INPUT YOU WILL NOT RECEIVE:
336
+ - Development conversation history
337
+ - Developer's explanations
338
+ - Prior context about design decisions
339
+
340
+ OUTPUT: Structured Validation Report (see Step 6)
341
+ ```
342
+
343
+ ---
344
+
345
+ ## CLI Override
346
+
347
+ Override isolation level per-invocation:
348
+
349
+ ```
350
+ /acceptance → Uses --deep (default, spawns isolated agent)
351
+ /acceptance --quick → Same context, persona hint only
352
+ /acceptance --standard → Same context, persona switch
353
+ /acceptance --deep → Spawns isolated agent (explicit)
354
+ ```
355
+
356
+ **No external configuration required.** Defaults are in this SKILL.md.
357
+
358
+ ---
359
+
360
+ ## Installation
361
+
362
+ ```bash
363
+ # Via CLI
364
+ invar skill add acceptance
365
+
366
+ # Manual copy
367
+ cp -r /path/to/extensions/acceptance .claude/skills/
368
+ ```
369
+
370
+ ---
371
+
372
+ *Extension Skill v1.0 — LX-07*
373
+ <!--/invar:skill--><!--invar:extensions-->
374
+ <!-- ========================================================================
375
+ EXTENSIONS REGION - USER EDITABLE
376
+ Add project-specific extensions here. This section is preserved on update.
377
+
378
+ Examples of what to add:
379
+ - Custom acceptance criteria templates
380
+ - Project-specific requirement categories
381
+ - Domain-specific validation rules
382
+ ======================================================================== -->
383
+ <!--/invar:extensions-->