@agent-ix/quoin 0.3.5 → 0.3.6

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agent-ix/quoin",
3
3
  "description": "Spec workflow and catalog CLI for Agent IX.",
4
- "version": "0.3.5",
4
+ "version": "0.3.6",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "files": [
@@ -2,6 +2,11 @@
2
2
 
3
3
  When an FR defines a domain object, set the `object:` frontmatter field and use the matching template.
4
4
 
5
+ > The `assets/...-template.md` names below identify each object type's template
6
+ > **within its catalog module** — they are not files shipped in this skill.
7
+ > Obtain the actual skeleton + schema with `quoin write --types <type>` (or
8
+ > inspect a type with `quoin catalog show <type>`).
9
+
5
10
  ## Business Objects (spec-objects-business)
6
11
 
7
12
  - `entity` / `aggregate_root` / `nested_entity`: Data entity, model, or aggregate → `assets/business/entity-template.md`
@@ -1,49 +1,102 @@
1
1
  ---
2
2
  name: specify
3
- description: Create or update spec files using quoin catalog authoring packs and Quire validation.
3
+ description: Create or update spec artifacts from a design or change request. Orchestrates authoring each requested requirement type (StR/US/FR/NFR/IT) as a discrete file using quoin catalog templates and Quire validation.
4
4
  ---
5
5
 
6
6
  # Specify
7
7
 
8
8
  Use this skill when turning an agreed design, feature, or change request into
9
- spec artifacts and supporting spec objects.
9
+ spec artifacts. `specify` decides **which artifacts the request needs**, authors
10
+ each one **as its own file** using the catalog templates, and validates.
10
11
 
11
- ## Process
12
+ ## Scope to the request
12
13
 
13
- 1. Identify the repository that owns the spec files.
14
- 2. Identify every artifact and object type that will be created or edited.
15
- 3. Run `quoin write <repo_dir> --types <type[,type...]>` once for the full set of types.
16
- 4. Use the returned skeletons, schemas, module roots, and examples as the authoring contract.
17
- 5. Author or edit the files directly in the target repo.
18
- 6. Run `quire validate <glob> [glob2 ...]` over the changed spec scope.
19
- 7. Fix validation errors before moving to review, matrix, or planning work.
14
+ Author **only the artifact types the request calls for** — nothing more.
20
15
 
21
- ## Type Selection
16
+ - "Add a user story for X" → one US.
17
+ - "Add the FR that implements US-003" → one FR (traced to US-003).
18
+ - "Add a user story and the requirement that implements it" → one US **and** one FR.
19
+ - "Edit FR-002 to …" → edit that one FR file in place.
20
+ - "Start a spec for service X" / "backport a spec from this code" → the full
21
+ chain (`spec.md` + US + FR + NFR, and IT where there are external integrations).
22
22
 
23
- Request all needed types together so the agent does not repeatedly fetch the
24
- same templates.
23
+ When unsure which types a request implies, decide from the request and state what
24
+ you are creating. A backport or new feature almost always needs **FR artifacts**,
25
+ not just a summary.
25
26
 
26
- Examples:
27
+ ## Requirements are files, not table rows
27
28
 
28
- ```bash
29
- quoin write . --types FR,domain,entity
30
- quoin write ../service --types StR,US,FR,NFR
31
- quoin write . --types process,configuration,value_object
32
- ```
29
+ Each requirement is a **discrete artifact file** with `type:` frontmatter. The
30
+ Requirements table inside `spec.md` (master-requirements) is an **index/summary**
31
+ — it never replaces the artifacts. Author every requested requirement as its own
32
+ file under the matching directory:
33
33
 
34
- Type lookup is catalog-driven and case-insensitive. Types may come from bundled
35
- `spec-artifacts-*`, bundled `spec-objects-*`, user-installed modules, or
36
- community modules.
34
+ | Type | `type:` | Location |
35
+ | ---- | ------- | ------------------------------ |
36
+ | StR | `StR` | `spec/stakeholder/StR-XXX-*.md`|
37
+ | US | `US` | `spec/usecase/US-XXX-*.md` |
38
+ | FR | `FR` | `spec/functional/FR-XXX-*.md` |
39
+ | NFR | `NFR` | `spec/non-functional/NFR-XXX-*.md` |
40
+ | IT | `IT` | `spec/integration/IT-XXX-*.md` |
37
41
 
38
- ## Authoring Rules
42
+ > If a request asks for functional requirements and you produced only table rows
43
+ > in `spec.md`, the request is **not done** — create the `FR-XXX.md` files.
44
+
45
+ ## Process
39
46
 
40
- - Let frontmatter identify exactly what each file is. The discriminator field is
41
- `type` (e.g. `type: FR`, `type: master-requirements`); it names the archetype the
42
- document conforms to.
47
+ Run only the steps the request needs; stop after IT.
48
+
49
+ 1. Identify the repository that owns the spec files, and which artifact types the
50
+ request implies (any subset of StR, US, FR, NFR, IT).
51
+ 2. Run `quoin write <repo_dir> --types <type[,type...]>` **once** for the full
52
+ set. Use the returned skeletons, schemas, module roots, and examples as the
53
+ authoring contract — the per-type rules live in the template, not your memory.
54
+ 3. Author each artifact as its own file (table above), in this logical order,
55
+ skipping any type not requested:
56
+ - `spec.md` — **REQUIRED when starting a new spec**: the
57
+ `type: master-requirements` root/index at `spec/spec.md`, authored from
58
+ `assets/spec-template.md` (or `assets/app-spec-template.md` for an
59
+ application). Then → StR → US →
60
+ **derive FR from US** (see [references/us-to-fr.md](references/us-to-fr.md))
61
+ → FR → NFR → IT (see [references/integration-tests.md](references/integration-tests.md)).
62
+ 4. Keep traceability in frontmatter `relationships:` (e.g. a US `traces_to` its
63
+ FRs; an FR/NFR/IT links back to the US/FR it serves).
64
+ 5. Run `quire validate <glob> [glob2 ...]` over the changed spec scope and fix
65
+ every error before continuing.
66
+ 6. **Stop at IT.** Then ask the user whether to build the test matrix
67
+ (`spec-matrix`) and run review (`spec-review`) — unless they already requested
68
+ them. Only run those on confirmation.
69
+
70
+ ## Functional requirements
71
+
72
+ FRs are normative (`SHALL` / `SHALL NOT`), atomic, and independently verifiable,
73
+ each with an Acceptance Criteria table (the `fr.md` skeleton enforces the shape).
74
+
75
+ - Derive FRs from the driving user story — see
76
+ [references/us-to-fr.md](references/us-to-fr.md).
77
+ - A behavioral FR has no `object:` field. A **domain-typed** FR carries
78
+ `object: <type>` (e.g. `entity`, `event`, `api_endpoint`, `process`,
79
+ `configuration`) and uses that type's structural template. Look up the
80
+ type→template map and relationship verbs in
81
+ `spec-object-review`'s `references/object-type-guide.md`, and inspect a type
82
+ with `quoin catalog show <type>`.
83
+
84
+ ## Application specs
85
+
86
+ When `component_type: application`, initialize `spec.md` from
87
+ `assets/app-spec-template.md`. Application specs own **only cross-service
88
+ concerns** — architecture rationale (ADRs), cross-service sequence diagrams,
89
+ system-level NFRs, the external consumer contract, scope boundaries, security
90
+ model. Per-service detail (endpoint contracts, DB schemas, per-service NFRs)
91
+ stays in the individual service specs. Otherwise use `assets/spec-template.md`.
92
+
93
+ ## Authoring rules
94
+
95
+ - Let frontmatter identify each file. The discriminator is `type` (e.g.
96
+ `type: FR`, `type: master-requirements`) — it names the archetype.
43
97
  - Use catalog skeletons and schemas rather than memory.
44
98
  - Keep workflow definitions out of artifact/object type vocabularies.
45
- - Validate every created or edited artifact with Quire.
46
- - Use `spec-review` after validation for quality, consistency, and completeness review.
99
+ - Validate every created or edited artifact with Quire before finishing.
47
100
 
48
101
  ## Reserved OKF Files
49
102
 
@@ -59,11 +112,11 @@ author them like any other type:
59
112
  ```text
60
113
  spec/
61
114
  ├── spec.md
62
- ├── stakeholder/
63
- ├── usecase/
64
- ├── functional/
65
- ├── non-functional/
66
- ├── integration/
115
+ ├── stakeholder/ # StR-XXX
116
+ ├── usecase/ # US-XXX
117
+ ├── functional/ # FR-XXX
118
+ ├── non-functional/ # NFR-XXX
119
+ ├── integration/ # IT-XXX
67
120
  ├── matrix/
68
121
  └── analysis/
69
122
  ```
@@ -0,0 +1,72 @@
1
+ # Authoring Integration Tests (IT)
2
+
3
+ Load this when a request involves integration tests — i.e. the system talks to
4
+ external services (HTTP APIs, event buses, databases, third-party/cloud APIs).
5
+ The per-section shape comes from the `IT` template (`quoin write --types IT`);
6
+ this file carries the *reasoning and reality rules* that the template can't
7
+ enforce.
8
+
9
+ ## Scope
10
+
11
+ HTTP client integrations, event bus connections (Kafka, RabbitMQ), database
12
+ connections (Postgres, Redis), and external APIs. One test case per file,
13
+ sequentially numbered (`IT-XXX`), saved to `spec/integration/IT-XXX-*.md`.
14
+
15
+ ## Reality rules — REAL by default
16
+
17
+ > Integration tests are **ALWAYS REAL** by default. Nothing is mocked unless the
18
+ > spec explicitly says so. An IT that only checks imports or constructs models
19
+ > without exercising real behavior is a **GAP**.
20
+
21
+ Every IT MUST include acceptance criteria from **both** categories:
22
+
23
+ - **Real Setup ACs** — the non-mocked environment is established: service running
24
+ and healthy (real health endpoint), real dependencies available (DB, bus,
25
+ external service), fixtures loaded into real stores, config applied through real
26
+ loading paths.
27
+ - **Real Output ACs** — real output from real services: HTTP responses
28
+ (status/headers/body), DB state changes (rows inserted/updated/deleted), events
29
+ published to and consumed from a real bus, file-system state, SSE/WebSocket
30
+ streams, LLM responses through real provider chains.
31
+
32
+ | Real (required) | Not real (GAP) |
33
+ | ------------------------------------------------- | ------------------------------ |
34
+ | POST to endpoint, assert response body | `assert MyModel is not None` |
35
+ | Query DB after a write, verify rows changed | `MyModel(field="value")` |
36
+ | Publish event, consume from real bus, verify load | `assert EventSchema is not None` |
37
+ | GET /health, verify HTTP 200 + status body | `assert app is not None` |
38
+
39
+ ### Mocking policy
40
+
41
+ - **Default: NO MOCKS.** ITs exercise real service boundaries.
42
+ - **Approved mock targets** only when the spec explicitly requires it: external
43
+ third-party APIs (payment, auth, cloud) via test doubles over real HTTP;
44
+ external services outside the test boundary via contract-faithful stubs.
45
+ - **Never mock**: HTTP transport, config loading, DB connections, file I/O,
46
+ session storage, event publishing, health endpoints, WebSocket/SSE connections.
47
+ - When a mock IS used, the IT must state WHY the real service can't be used, WHAT
48
+ boundary the mock replaces, and HOW the mock is verified faithful.
49
+
50
+ ## Process
51
+
52
+ 1. List the external dependencies from the codebase (the integration points).
53
+ 2. Take the next `IT-XXX`; get the contract with `quoin write --types IT`.
54
+ 3. Fill the template: Target Integration (service + protocol), Preconditions
55
+ (environment + data state), Test Data (`TD-XXX` fixtures with rationale),
56
+ Execution Plan (atomic steps, each with a timeout and `IT-XXX-SC-XX` success
57
+ criterion), Expected Outcome (success condition + failure modes).
58
+ 4. **Traceability is required**: every IT links to ≥1 FR/StR/NFR via frontmatter
59
+ `relationships:` (`type: verifies`). Cross-component references are fine
60
+ (e.g. `ix://org/other-service/FR-001`) per ISO 29148 bidirectional traceability.
61
+
62
+ ## Patterns by service type
63
+
64
+ - **API (FastAPI/REST)**: CRUD to real endpoints (verify codes/body/DB state);
65
+ invalid payloads → real 4xx; auth with/without creds → real 401/403.
66
+ - **Database**: real Alembic migrations → schema state; insert/query/update/delete
67
+ → row state; constraint violations → real DB errors.
68
+ - **Event-driven (FastStream)**: publish to a real topic, consume, verify payload;
69
+ produce an event, verify processing + side effects.
70
+ - **Worker**: submit a real job → completion state; slow job → timeout + cleanup.
71
+ - **Agent (LLM)**: deterministic scripted LLM via real API → verify tool calls;
72
+ real tool execution → file/process state; real SSE/WS → event sequence.
@@ -0,0 +1,40 @@
1
+ # Deriving Functional Requirements from a User Story
2
+
3
+ Load this when a request involves turning user stories into functional
4
+ requirements. It carries the *reasoning* for the derivation; the per-FR section
5
+ rules come from the `FR` template (`quoin write --types FR`).
6
+
7
+ ## Rules
8
+
9
+ - **Atomic**: decompose the story into specific, single-behavior FRs.
10
+ - **Normative**: FRs use `SHALL` / `SHALL NOT` (a US never does).
11
+ - **No copying**: translate intent into a technical specification — do not paste
12
+ the story text.
13
+ - **Verifiable**: every FR carries its own Acceptance Criteria table.
14
+
15
+ ## Process
16
+
17
+ 1. **Analyze** the `US-XXX`: list the system responsibilities it implies.
18
+ 2. **Decompose** into typed FRs. A behavioral FR (no `object:`) captures logic
19
+ and business rules. A domain-typed FR carries `object: <type>` and is purely
20
+ structural:
21
+ - `entity` — data model with typed fields
22
+ - `event` — a domain event emitted
23
+ - `api_endpoint` — a REST/HTTP endpoint
24
+ - `queue` — a message contract
25
+ - `process` — an end-to-end workflow
26
+ - `state_machine` — an entity lifecycle
27
+ - `configuration` — a configuration schema
28
+ - Full list + relationship verbs: `spec-object-review`'s
29
+ `references/object-type-guide.md`; inspect any type with
30
+ `quoin catalog show <type>`.
31
+ 3. **Author** each FR as its own file (`quoin write --types FR` for the contract),
32
+ and link it back to the story via frontmatter `relationships:`
33
+ (`type: implements`, target the `US-XXX`).
34
+ 4. **Specify** inputs/outputs (typed and validated), error handling (failure
35
+ modes), and constraints (technical limits, not options).
36
+ 5. **Separation of concerns**: keep behavioral triggers/validation in behavioral
37
+ FRs; domain-typed FR acceptance criteria test **structure** only (schema/field
38
+ presence), never behavior. Do not duplicate behavioral ACs into a domain FR.
39
+ 6. **Save** to `spec/functional/FR-XXX-description.md` (single repo) or
40
+ `specs/<category>/<component>/spec/functional/FR-XXX-description.md` (multi-repo).