dialai 1.0.0 → 1.2.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/.claude/skills/dial-machine/SKILL.md +401 -0
- package/.claude/skills/dial-machine/references/api-reference.md +515 -0
- package/.claude/skills/dial-machine/references/patterns.md +628 -0
- package/.claude/skills/spec-for-ralph/SKILL.md +542 -0
- package/.claude/specs/llm-audit-log.md +280 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/dialai/api.d.ts +2 -6
- package/dist/dialai/api.d.ts.map +1 -1
- package/dist/dialai/api.js +22 -6
- package/dist/dialai/api.js.map +1 -1
- package/dist/dialai/llm.d.ts +6 -4
- package/dist/dialai/llm.d.ts.map +1 -1
- package/dist/dialai/llm.js +96 -31
- package/dist/dialai/llm.js.map +1 -1
- package/dist/dialai/migrations/002-llm-audit-log.d.ts +8 -0
- package/dist/dialai/migrations/002-llm-audit-log.d.ts.map +1 -0
- package/dist/dialai/migrations/002-llm-audit-log.js +41 -0
- package/dist/dialai/migrations/002-llm-audit-log.js.map +1 -0
- package/dist/dialai/migrations/migrate.d.ts.map +1 -1
- package/dist/dialai/migrations/migrate.js +2 -0
- package/dist/dialai/migrations/migrate.js.map +1 -1
- package/dist/dialai/store-memory.d.ts.map +1 -1
- package/dist/dialai/store-memory.js +22 -0
- package/dist/dialai/store-memory.js.map +1 -1
- package/dist/dialai/store-postgres.d.ts.map +1 -1
- package/dist/dialai/store-postgres.js +54 -1
- package/dist/dialai/store-postgres.js.map +1 -1
- package/dist/dialai/store.d.ts +3 -1
- package/dist/dialai/store.d.ts.map +1 -1
- package/dist/dialai/store.js.map +1 -1
- package/dist/dialai/types.d.ts +54 -0
- package/dist/dialai/types.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-for-ralph
|
|
3
|
+
description: Converts rough feature ideas into Ralph-ready implementation specifications with explicit scope, trigger phrases, phases, testable acceptance criteria, failure handling, and completion signals. Use when the user wants to write or improve a PRD, engineering spec, implementation brief, task plan, or autonomous-loop prompt for Claude Code or Ralph Wiggum.
|
|
4
|
+
disable-model-invocation: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Spec for Ralph
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Turn ambiguous software requests into **execution-ready specifications** that work well for autonomous or semi-autonomous Claude Code workflows, especially Ralph-style loops.
|
|
12
|
+
|
|
13
|
+
This skill should optimize for:
|
|
14
|
+
- unambiguous scope
|
|
15
|
+
- concrete deliverables
|
|
16
|
+
- testable acceptance criteria
|
|
17
|
+
- incremental phases
|
|
18
|
+
- built-in self-correction
|
|
19
|
+
- explicit stopping conditions
|
|
20
|
+
- low-risk execution
|
|
21
|
+
|
|
22
|
+
If the user provides a messy brief, transform it into a clean spec.
|
|
23
|
+
If the user provides an existing spec, review and strengthen it.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Core principle
|
|
28
|
+
|
|
29
|
+
A good Ralph-ready spec is not just descriptive. It is an **operational contract**.
|
|
30
|
+
|
|
31
|
+
It must tell Claude:
|
|
32
|
+
1. **What to build**
|
|
33
|
+
2. **What not to build**
|
|
34
|
+
3. **How success will be verified**
|
|
35
|
+
4. **What order to work in**
|
|
36
|
+
5. **What to do when blocked**
|
|
37
|
+
6. **What exact condition means “done”**
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## When this skill should be used
|
|
42
|
+
|
|
43
|
+
Use this skill when the user asks to:
|
|
44
|
+
- write a PRD
|
|
45
|
+
- write or improve a technical specification
|
|
46
|
+
- create an implementation brief
|
|
47
|
+
- prepare a prompt for Claude Code or Ralph
|
|
48
|
+
- make acceptance criteria more testable
|
|
49
|
+
- convert a vague feature request into a build plan
|
|
50
|
+
- make a spec better for autonomous execution
|
|
51
|
+
- break work into phases or milestones
|
|
52
|
+
- define “done”
|
|
53
|
+
|
|
54
|
+
Do not use this skill when the user only wants code immediately and does not want planning/specification help.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Required output behavior
|
|
59
|
+
|
|
60
|
+
When invoked, produce these sections in order unless the user asks for a different format:
|
|
61
|
+
|
|
62
|
+
1. **Executive Summary**
|
|
63
|
+
2. **Objective**
|
|
64
|
+
3. **In Scope**
|
|
65
|
+
4. **Out of Scope**
|
|
66
|
+
5. **Assumptions and Constraints**
|
|
67
|
+
6. **Implementation Plan**
|
|
68
|
+
7. **Acceptance Criteria**
|
|
69
|
+
8. **Validation and Tests**
|
|
70
|
+
9. **Failure and Recovery Rules**
|
|
71
|
+
10. **Completion Signal**
|
|
72
|
+
11. **Ralph Prompt Draft**
|
|
73
|
+
12. **Open Questions**
|
|
74
|
+
|
|
75
|
+
If the user already supplied a spec, first add:
|
|
76
|
+
|
|
77
|
+
- **Spec Weaknesses Found**
|
|
78
|
+
- **Recommended Improvements**
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## How to rewrite a spec
|
|
83
|
+
|
|
84
|
+
### Step 1: Extract the real objective
|
|
85
|
+
|
|
86
|
+
Rewrite the request as a single sentence:
|
|
87
|
+
|
|
88
|
+
- who/what is changing
|
|
89
|
+
- what capability is needed
|
|
90
|
+
- what result must exist when done
|
|
91
|
+
|
|
92
|
+
Prefer:
|
|
93
|
+
- “Build X so Y can do Z”
|
|
94
|
+
|
|
95
|
+
Avoid:
|
|
96
|
+
- fluffy product language
|
|
97
|
+
- abstract aspirations without observable output
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### Step 2: Separate scope from aspiration
|
|
102
|
+
|
|
103
|
+
Create:
|
|
104
|
+
- **In Scope**
|
|
105
|
+
- **Out of Scope**
|
|
106
|
+
|
|
107
|
+
Be strict.
|
|
108
|
+
|
|
109
|
+
Anything not clearly required should go into:
|
|
110
|
+
- Out of Scope
|
|
111
|
+
- Future Work
|
|
112
|
+
- Open Questions
|
|
113
|
+
|
|
114
|
+
This is especially important for autonomous loops, because underspecified scope expands unpredictably.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### Step 3: Convert vague goals into observable deliverables
|
|
119
|
+
|
|
120
|
+
Translate statements like:
|
|
121
|
+
- “make it robust”
|
|
122
|
+
- “make it production ready”
|
|
123
|
+
- “improve the UX”
|
|
124
|
+
- “support edge cases”
|
|
125
|
+
|
|
126
|
+
into concrete outputs such as:
|
|
127
|
+
- tests added
|
|
128
|
+
- retries implemented
|
|
129
|
+
- error messages standardized
|
|
130
|
+
- loading and empty states present
|
|
131
|
+
- docs updated
|
|
132
|
+
- lint/type/test/build all passing
|
|
133
|
+
|
|
134
|
+
Never leave quality words undefined.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### Step 4: Force testable acceptance criteria
|
|
139
|
+
|
|
140
|
+
Every acceptance criterion should be something a reviewer can verify.
|
|
141
|
+
|
|
142
|
+
Good criteria are phrased like:
|
|
143
|
+
- “Given X, when Y, then Z”
|
|
144
|
+
- “Command A exits with code 0”
|
|
145
|
+
- “All tests in file/path pass”
|
|
146
|
+
- “Endpoint returns 200 with schema S”
|
|
147
|
+
- “The page renders states A, B, and C”
|
|
148
|
+
- “No TypeScript errors remain”
|
|
149
|
+
- “README includes setup, usage, and limitations”
|
|
150
|
+
|
|
151
|
+
Bad criteria:
|
|
152
|
+
- “Works well”
|
|
153
|
+
- “Looks polished”
|
|
154
|
+
- “Handles errors gracefully”
|
|
155
|
+
- “Is scalable”
|
|
156
|
+
- “Feels intuitive”
|
|
157
|
+
|
|
158
|
+
When possible, create acceptance criteria at three levels:
|
|
159
|
+
1. **Functional**
|
|
160
|
+
2. **Quality**
|
|
161
|
+
3. **Operational**
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### Step 5: Break execution into phases
|
|
166
|
+
|
|
167
|
+
Default phase structure:
|
|
168
|
+
|
|
169
|
+
#### Phase 1: Foundations
|
|
170
|
+
- scaffold
|
|
171
|
+
- interfaces
|
|
172
|
+
- test harness
|
|
173
|
+
- failing tests or validation targets
|
|
174
|
+
|
|
175
|
+
#### Phase 2: Core functionality
|
|
176
|
+
- implement main feature path
|
|
177
|
+
- make main tests pass
|
|
178
|
+
|
|
179
|
+
#### Phase 3: Hardening
|
|
180
|
+
- edge cases
|
|
181
|
+
- validation
|
|
182
|
+
- error handling
|
|
183
|
+
- docs
|
|
184
|
+
- cleanup
|
|
185
|
+
|
|
186
|
+
#### Phase 4: Verification
|
|
187
|
+
- full test run
|
|
188
|
+
- typecheck/lint/build
|
|
189
|
+
- final review against acceptance criteria
|
|
190
|
+
|
|
191
|
+
If the project is large, further divide into milestones.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### Step 6: Add self-correction instructions
|
|
196
|
+
|
|
197
|
+
Ralph-style loops perform better when the spec explicitly says how to recover from failure.
|
|
198
|
+
|
|
199
|
+
Always add a recovery section with instructions like:
|
|
200
|
+
1. Run tests or checks after each meaningful change.
|
|
201
|
+
2. If tests fail, inspect the failure and fix the smallest root cause first.
|
|
202
|
+
3. If blocked after repeated attempts, document the blocker, attempted fixes, and the minimal decision needed from the operator.
|
|
203
|
+
4. Do not declare completion while any required acceptance criterion is unmet.
|
|
204
|
+
5. Prefer incremental verified progress over broad speculative rewrites.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
### Step 7: Define an exact stopping condition
|
|
209
|
+
|
|
210
|
+
Create a **Completion Signal** section.
|
|
211
|
+
|
|
212
|
+
It should include:
|
|
213
|
+
- the exact completion phrase
|
|
214
|
+
- the conditions that must be true before using it
|
|
215
|
+
|
|
216
|
+
Example:
|
|
217
|
+
- Output exactly `COMPLETE` only when:
|
|
218
|
+
- all listed acceptance criteria are met
|
|
219
|
+
- required tests pass
|
|
220
|
+
- docs are updated
|
|
221
|
+
- no blocking errors remain
|
|
222
|
+
|
|
223
|
+
If the user wants a Ralph-compatible phrase, preserve their requested completion signal.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Review checklist
|
|
228
|
+
|
|
229
|
+
When reviewing or generating a spec, check for all of the following:
|
|
230
|
+
|
|
231
|
+
- Is the objective concrete?
|
|
232
|
+
- Is scope bounded?
|
|
233
|
+
- Are out-of-scope items explicit?
|
|
234
|
+
- Are acceptance criteria testable?
|
|
235
|
+
- Are phases incremental?
|
|
236
|
+
- Are validation steps stated?
|
|
237
|
+
- Are failure rules included?
|
|
238
|
+
- Is completion explicitly defined?
|
|
239
|
+
- Is there any vague adjective left undefined?
|
|
240
|
+
- Could a coding agent act on this without asking 10 follow-up questions?
|
|
241
|
+
|
|
242
|
+
If not, fix it.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Preferred writing style
|
|
247
|
+
|
|
248
|
+
Use:
|
|
249
|
+
- direct language
|
|
250
|
+
- bullet lists
|
|
251
|
+
- short sections
|
|
252
|
+
- concrete file names / commands / outputs when available
|
|
253
|
+
- explicit assumptions
|
|
254
|
+
|
|
255
|
+
Avoid:
|
|
256
|
+
- marketing prose
|
|
257
|
+
- unnecessary background
|
|
258
|
+
- duplicated requirements
|
|
259
|
+
- hidden dependencies
|
|
260
|
+
- undefined quality language
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Output templates
|
|
265
|
+
|
|
266
|
+
### Template A: Spec skeleton
|
|
267
|
+
|
|
268
|
+
```md
|
|
269
|
+
# [Feature Name]
|
|
270
|
+
|
|
271
|
+
## Executive Summary
|
|
272
|
+
[1 short paragraph]
|
|
273
|
+
|
|
274
|
+
## Objective
|
|
275
|
+
[Single clear sentence]
|
|
276
|
+
|
|
277
|
+
## In Scope
|
|
278
|
+
- ...
|
|
279
|
+
|
|
280
|
+
## Out of Scope
|
|
281
|
+
- ...
|
|
282
|
+
|
|
283
|
+
## Assumptions and Constraints
|
|
284
|
+
- ...
|
|
285
|
+
- ...
|
|
286
|
+
|
|
287
|
+
## Implementation Plan
|
|
288
|
+
|
|
289
|
+
### Phase 1: Foundations
|
|
290
|
+
- ...
|
|
291
|
+
|
|
292
|
+
### Phase 2: Core Functionality
|
|
293
|
+
- ...
|
|
294
|
+
|
|
295
|
+
### Phase 3: Hardening
|
|
296
|
+
- ...
|
|
297
|
+
|
|
298
|
+
### Phase 4: Verification
|
|
299
|
+
- ...
|
|
300
|
+
|
|
301
|
+
## Acceptance Criteria
|
|
302
|
+
|
|
303
|
+
### Functional
|
|
304
|
+
- [Given/When/Then or equivalent]
|
|
305
|
+
- ...
|
|
306
|
+
|
|
307
|
+
### Quality
|
|
308
|
+
- ...
|
|
309
|
+
- ...
|
|
310
|
+
|
|
311
|
+
### Operational
|
|
312
|
+
- ...
|
|
313
|
+
- ...
|
|
314
|
+
|
|
315
|
+
## Validation and Tests
|
|
316
|
+
- Run: `...`
|
|
317
|
+
- Verify: `...`
|
|
318
|
+
- Expected result: `...`
|
|
319
|
+
|
|
320
|
+
## Failure and Recovery Rules
|
|
321
|
+
1. ...
|
|
322
|
+
2. ...
|
|
323
|
+
3. ...
|
|
324
|
+
|
|
325
|
+
## Completion Signal
|
|
326
|
+
Output exactly `[COMPLETION_SIGNAL]` only when:
|
|
327
|
+
- ...
|
|
328
|
+
- ...
|
|
329
|
+
- ...
|
|
330
|
+
|
|
331
|
+
## Ralph Prompt Draft
|
|
332
|
+
[Short operator-facing prompt optimized for Ralph]
|
|
333
|
+
|
|
334
|
+
## Open Questions
|
|
335
|
+
- ...
|
|
336
|
+
````
|
|
337
|
+
|
|
338
|
+
### Template B: Ralph prompt draft
|
|
339
|
+
|
|
340
|
+
When writing the Ralph-ready prompt, use this structure:
|
|
341
|
+
|
|
342
|
+
```md
|
|
343
|
+
Implement [feature name].
|
|
344
|
+
|
|
345
|
+
Constraints:
|
|
346
|
+
- [constraint]
|
|
347
|
+
- [constraint]
|
|
348
|
+
|
|
349
|
+
Required deliverables:
|
|
350
|
+
- [deliverable]
|
|
351
|
+
- [deliverable]
|
|
352
|
+
|
|
353
|
+
Acceptance criteria:
|
|
354
|
+
- [testable criterion]
|
|
355
|
+
- [testable criterion]
|
|
356
|
+
|
|
357
|
+
Execution rules:
|
|
358
|
+
1. Start by identifying the smallest workable implementation.
|
|
359
|
+
2. Write or run verification checks as early as possible.
|
|
360
|
+
3. After each meaningful change, validate progress.
|
|
361
|
+
4. If validation fails, fix the root cause before continuing.
|
|
362
|
+
5. If blocked after repeated attempts, report the blocker and the smallest needed decision.
|
|
363
|
+
6. Do not claim completion until every acceptance criterion is satisfied.
|
|
364
|
+
|
|
365
|
+
Output exactly `[COMPLETION_SIGNAL]` when all criteria are met.
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Transformation rules for common weak inputs
|
|
371
|
+
|
|
372
|
+
If the user gives:
|
|
373
|
+
|
|
374
|
+
* **“build X”** → add scope, constraints, tests, done criteria
|
|
375
|
+
* **a PRD** → turn it into engineering phases and verification criteria
|
|
376
|
+
* **a ticket list** → group into milestones with exit criteria
|
|
377
|
+
* **a vague feature idea** → produce spec + questions + Ralph draft
|
|
378
|
+
* **an overlong spec** → condense into execution-ready version
|
|
379
|
+
* **an autonomous-loop prompt** → strengthen it with acceptance tests and stop conditions
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## Examples
|
|
384
|
+
|
|
385
|
+
### Example 1: vague request
|
|
386
|
+
|
|
387
|
+
User says:
|
|
388
|
+
“Build a todo API and make it good.”
|
|
389
|
+
|
|
390
|
+
Produce:
|
|
391
|
+
|
|
392
|
+
* a narrowed API spec
|
|
393
|
+
* explicit CRUD deliverables
|
|
394
|
+
* validation requirements
|
|
395
|
+
* test targets
|
|
396
|
+
* docs requirements
|
|
397
|
+
* completion signal
|
|
398
|
+
|
|
399
|
+
### Example 2: existing PRD
|
|
400
|
+
|
|
401
|
+
User says:
|
|
402
|
+
“Here is my feature brief. Make it good for Ralph.”
|
|
403
|
+
|
|
404
|
+
Produce:
|
|
405
|
+
|
|
406
|
+
1. Spec Weaknesses Found
|
|
407
|
+
2. Revised execution-ready spec
|
|
408
|
+
3. Stronger acceptance criteria
|
|
409
|
+
4. Ralph Prompt Draft
|
|
410
|
+
|
|
411
|
+
### Example 3: large feature
|
|
412
|
+
|
|
413
|
+
User says:
|
|
414
|
+
“Create a complete e-commerce platform.”
|
|
415
|
+
|
|
416
|
+
Do not leave it as one blob.
|
|
417
|
+
Break it into phases such as:
|
|
418
|
+
|
|
419
|
+
* auth
|
|
420
|
+
* catalog
|
|
421
|
+
* cart
|
|
422
|
+
* checkout
|
|
423
|
+
* verification
|
|
424
|
+
|
|
425
|
+
Then define acceptance criteria per phase.
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## Troubleshooting
|
|
430
|
+
|
|
431
|
+
### Problem: The request is too vague
|
|
432
|
+
|
|
433
|
+
Solution:
|
|
434
|
+
|
|
435
|
+
* infer a minimal sensible scope
|
|
436
|
+
* state assumptions clearly
|
|
437
|
+
* include open questions at the end
|
|
438
|
+
|
|
439
|
+
### Problem: The user asks for “production-ready”
|
|
440
|
+
|
|
441
|
+
Solution:
|
|
442
|
+
Expand into explicit requirements such as:
|
|
443
|
+
|
|
444
|
+
* tests
|
|
445
|
+
* lint/typecheck/build clean
|
|
446
|
+
* logging/error handling
|
|
447
|
+
* docs
|
|
448
|
+
* configuration clarity
|
|
449
|
+
* safe defaults
|
|
450
|
+
|
|
451
|
+
### Problem: The feature is too large for one loop
|
|
452
|
+
|
|
453
|
+
Solution:
|
|
454
|
+
|
|
455
|
+
* split into phases
|
|
456
|
+
* create milestone-specific completion signals if helpful
|
|
457
|
+
* recommend executing one phase at a time
|
|
458
|
+
|
|
459
|
+
### Problem: Acceptance criteria are still subjective
|
|
460
|
+
|
|
461
|
+
Solution:
|
|
462
|
+
Rewrite each one into an observable check or command result.
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## Resolving Open Questions
|
|
467
|
+
|
|
468
|
+
After generating the spec, if the **Open Questions** section is non-empty, you **must** resolve every question before considering the spec complete.
|
|
469
|
+
|
|
470
|
+
### Procedure
|
|
471
|
+
|
|
472
|
+
1. For each open question, use the `AskUserQuestion` tool to present the question to the user with concrete options (when applicable).
|
|
473
|
+
2. Wait for the user's answer.
|
|
474
|
+
3. Update the spec to incorporate the answer:
|
|
475
|
+
- Move resolved decisions into the appropriate section (Assumptions, In Scope, Out of Scope, Acceptance Criteria, etc.)
|
|
476
|
+
- Remove the question from the Open Questions list
|
|
477
|
+
- If the answer introduces new scope or constraints, update Implementation Plan phases and Acceptance Criteria accordingly
|
|
478
|
+
4. Repeat until the Open Questions section is empty or contains only items explicitly deferred by the user.
|
|
479
|
+
5. When all questions are resolved, confirm to the user that the spec is complete and ready for Ralph.
|
|
480
|
+
|
|
481
|
+
### Rules
|
|
482
|
+
|
|
483
|
+
- Do not leave the spec in an ambiguous state. Every open question either gets an answer or an explicit “defer to future work” from the user.
|
|
484
|
+
- Do not guess answers to open questions. Ask the user.
|
|
485
|
+
- If resolving one question creates a new question, add it to the list and resolve it in the same pass.
|
|
486
|
+
- After all questions are resolved, re-run the Review Checklist to confirm the spec is still complete.
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
## Database testing requirements
|
|
491
|
+
|
|
492
|
+
This project uses PostgreSQL for persistence. When a spec involves database-backed features (new tables, store methods, migrations), the spec **must** include tests for both store backends:
|
|
493
|
+
|
|
494
|
+
1. **In-memory store** (`store-memory.ts`) -- runs without any external dependencies, always executed
|
|
495
|
+
2. **PostgreSQL store** (`store-postgres.ts`) -- requires a running PostgreSQL instance, skipped when `POSTGRES_URL` is not set
|
|
496
|
+
|
|
497
|
+
### PostgreSQL connection
|
|
498
|
+
|
|
499
|
+
The local development PostgreSQL runs in Docker with these credentials:
|
|
500
|
+
- **User:** `smsbot`
|
|
501
|
+
- **Password:** `smsbot`
|
|
502
|
+
- **Host:** `localhost:5432`
|
|
503
|
+
- **Admin database:** `postgres`
|
|
504
|
+
- **Connection string:** `postgresql://smsbot:smsbot@localhost:5432/postgres`
|
|
505
|
+
- **Environment variable:** `POSTGRES_URL`
|
|
506
|
+
|
|
507
|
+
The test helper `src/dialai/test-db.ts` (`createTestDatabase()`) connects to the admin database, creates an isolated test database with a random name, runs all migrations, and returns a cleanup function. Tests use `describe.skipIf(!process.env.POSTGRES_URL)` to skip gracefully when no database is available.
|
|
508
|
+
|
|
509
|
+
### What to include in specs
|
|
510
|
+
|
|
511
|
+
For any feature that touches the `Store` interface or database schema:
|
|
512
|
+
|
|
513
|
+
- **Store conformance tests** in `src/dialai/store.test.ts` using the parameterized `runStoreTests()` pattern (runs against both memory and postgres stores automatically)
|
|
514
|
+
- **PostgreSQL-specific integration tests** in `tests/integration/` for schema validation, constraint enforcement, triggers, rules, or other database-level behavior that does not apply to the in-memory store
|
|
515
|
+
- **Migration file** in `src/dialai/migrations/` registered in `migrate.ts`
|
|
516
|
+
- **Validation commands** should include both:
|
|
517
|
+
- `npm test` (memory-only, no database needed)
|
|
518
|
+
- `POSTGRES_URL="postgresql://smsbot:smsbot@localhost:5432/postgres" npm test` (full suite including PostgreSQL)
|
|
519
|
+
|
|
520
|
+
### Running PostgreSQL tests
|
|
521
|
+
|
|
522
|
+
Include these instructions in the spec's Validation section:
|
|
523
|
+
|
|
524
|
+
```bash
|
|
525
|
+
# Memory-only (always works)
|
|
526
|
+
npm test
|
|
527
|
+
|
|
528
|
+
# Full suite including PostgreSQL
|
|
529
|
+
POSTGRES_URL="postgresql://smsbot:smsbot@localhost:5432/postgres" npm test
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
---
|
|
533
|
+
|
|
534
|
+
## Final instruction
|
|
535
|
+
|
|
536
|
+
Your job is to make the specification **easier for Claude to execute correctly** and **easier for a human to verify objectively**.
|
|
537
|
+
|
|
538
|
+
Whenever in doubt:
|
|
539
|
+
|
|
540
|
+
* make it narrower
|
|
541
|
+
* make it more testable
|
|
542
|
+
* make “done” more explicit
|