@vinoles/ai-drivers-skills 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +357 -2
- package/context-examples/ecommerce/fastapi.md +94 -0
- package/context-examples/ecommerce/laravel.md +99 -0
- package/context-examples/ecommerce/nestjs.md +93 -0
- package/context-examples/hotel-reservations/fastapi.md +95 -0
- package/context-examples/hotel-reservations/laravel.md +97 -0
- package/context-examples/hotel-reservations/nestjs.md +94 -0
- package/dist/catalog.d.ts +3 -0
- package/dist/catalog.js +12 -0
- package/dist/catalog.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +78 -0
- package/dist/cli.js.map +1 -0
- package/dist/installer.d.ts +11 -0
- package/dist/installer.js +105 -0
- package/dist/installer.js.map +1 -0
- package/dist/installer.test.d.ts +1 -0
- package/dist/installer.test.js +45 -0
- package/dist/installer.test.js.map +1 -0
- package/package.json +62 -4
- package/skill-definitions/SKILL.md +20 -0
- package/skill-definitions/code-explanation/SKILL.md +56 -0
- package/skill-definitions/code-explanation/locales/en/SKILL.md +56 -0
- package/skill-definitions/code-explanation/locales/es/SKILL.md +57 -0
- package/skill-definitions/code-explanation/locales/fr/SKILL.md +56 -0
- package/skill-definitions/feature-implementation/SKILL.md +107 -0
- package/skill-definitions/feature-implementation/locales/en/SKILL.md +107 -0
- package/skill-definitions/feature-implementation/locales/en/references/requirements.md +73 -0
- package/skill-definitions/feature-implementation/locales/es/SKILL.md +107 -0
- package/skill-definitions/feature-implementation/locales/es/references/requirements.md +114 -0
- package/skill-definitions/feature-implementation/locales/fr/SKILL.md +107 -0
- package/skill-definitions/feature-implementation/locales/fr/references/requirements.md +73 -0
- package/skill-definitions/feature-implementation/references/requirements.md +73 -0
- package/skill-definitions/git-workflow/SKILL.md +58 -0
- package/skill-definitions/git-workflow/locales/en/SKILL.md +58 -0
- package/skill-definitions/git-workflow/locales/es/SKILL.md +58 -0
- package/skill-definitions/git-workflow/locales/fr/SKILL.md +58 -0
- package/skill-definitions/issue-management/SKILL.md +52 -0
- package/skill-definitions/issue-management/locales/en/SKILL.md +52 -0
- package/skill-definitions/issue-management/locales/es/SKILL.md +52 -0
- package/skill-definitions/issue-management/locales/fr/SKILL.md +52 -0
- package/skill-definitions/quality-verification/SKILL.md +101 -0
- package/skill-definitions/quality-verification/locales/en/SKILL.md +101 -0
- package/skill-definitions/quality-verification/locales/es/SKILL.md +101 -0
- package/skill-definitions/quality-verification/locales/fr/SKILL.md +101 -0
- package/skill-definitions/spec-driven-development/SKILL.md +115 -0
- package/skill-definitions/spec-driven-development/assets/spec-template.md +38 -0
- package/skill-definitions/spec-driven-development/assets/tasks-template.md +19 -0
- package/skill-definitions/spec-driven-development/locales/en/SKILL.md +115 -0
- package/skill-definitions/spec-driven-development/locales/en/assets/spec-template.md +38 -0
- package/skill-definitions/spec-driven-development/locales/en/assets/tasks-template.md +19 -0
- package/skill-definitions/spec-driven-development/locales/en/references/ears.md +35 -0
- package/skill-definitions/spec-driven-development/locales/en/references/phases.md +359 -0
- package/skill-definitions/spec-driven-development/locales/es/SKILL.md +102 -0
- package/skill-definitions/spec-driven-development/locales/es/assets/spec-template.md +38 -0
- package/skill-definitions/spec-driven-development/locales/es/assets/tasks-template.md +20 -0
- package/skill-definitions/spec-driven-development/locales/es/references/ears.md +37 -0
- package/skill-definitions/spec-driven-development/locales/es/references/phases.md +342 -0
- package/skill-definitions/spec-driven-development/locales/fr/SKILL.md +101 -0
- package/skill-definitions/spec-driven-development/locales/fr/assets/spec-template.md +38 -0
- package/skill-definitions/spec-driven-development/locales/fr/assets/tasks-template.md +19 -0
- package/skill-definitions/spec-driven-development/locales/fr/references/ears.md +35 -0
- package/skill-definitions/spec-driven-development/locales/fr/references/phases.md +343 -0
- package/skill-definitions/spec-driven-development/references/ears.md +35 -0
- package/skill-definitions/spec-driven-development/references/phases.md +359 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vinoles
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,358 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AI Drivers Skills
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Reusable, stack-agnostic development skills for coding agents and compatible tools. The skills do not impose a language, framework, architecture, provider or command. They discover project-specific decisions from the consumer repository and its `.agents/skills-context.md` file.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 20 or later.
|
|
8
|
+
- A consumer project where the skills will be installed.
|
|
9
|
+
- A compatible agent or tool that loads skills from `.agents/skills/`.
|
|
10
|
+
|
|
11
|
+
## Available skills
|
|
12
|
+
|
|
13
|
+
- `code-explanation`: explain existing code based on repository evidence.
|
|
14
|
+
- `feature-implementation`: implement a complete capability or significant refactoring.
|
|
15
|
+
- `git-workflow`: manage branches, commits, revisions and integrations according to project rules.
|
|
16
|
+
- `issue-management`: manage work items through the provider configured by the project.
|
|
17
|
+
- `quality-verification`: discover and run the project's relevant quality controls.
|
|
18
|
+
- `spec-driven-development`: manage Constitution, specification, planning, tasks, implementation and validation.
|
|
19
|
+
|
|
20
|
+
## Obtain the package
|
|
21
|
+
|
|
22
|
+
The package is currently tested from a local checkout or directly from GitHub. Once published, it can also be installed from npm.
|
|
23
|
+
|
|
24
|
+
### From a local checkout
|
|
25
|
+
|
|
26
|
+
Create a package archive from this repository:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install
|
|
30
|
+
npm run check
|
|
31
|
+
npm test
|
|
32
|
+
npm pack --pack-destination /tmp
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This creates an archive similar to:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
/tmp/vinoles-ai-drivers-skills-0.1.0.tgz
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Install that archive in the consumer project:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install --no-save /tmp/vinoles-ai-drivers-skills-0.1.0.tgz
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### From GitHub
|
|
48
|
+
|
|
49
|
+
Install the package from the default branch:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install --no-save github:TuLogic-Labs/ai-drivers-skills#main
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
To test another branch, replace `<branch-name>`:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install --no-save \
|
|
59
|
+
github:TuLogic-Labs/ai-drivers-skills#<branch-name>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### From npm
|
|
63
|
+
|
|
64
|
+
After publication, install the package with:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install --save-dev @vinoles/ai-drivers-skills
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The commands below use the `ai-drivers` executable provided by the installed package. With a local dependency, use `npx --no-install ai-drivers` to ensure the project-local version is used.
|
|
71
|
+
|
|
72
|
+
## Install skills
|
|
73
|
+
|
|
74
|
+
The installer copies the selected skills into the consumer project at:
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
.agents/
|
|
78
|
+
├── skills/
|
|
79
|
+
│ ├── code-explanation/
|
|
80
|
+
│ ├── feature-implementation/
|
|
81
|
+
│ ├── git-workflow/
|
|
82
|
+
│ ├── issue-management/
|
|
83
|
+
│ ├── quality-verification/
|
|
84
|
+
│ └── spec-driven-development/
|
|
85
|
+
└── skills-context.md
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The source package contains the available language directories, but the installer copies only the selected language. The consumer project never receives `locales/` directories.
|
|
89
|
+
|
|
90
|
+
### Install the complete catalog
|
|
91
|
+
|
|
92
|
+
Install all six skills in English, which is the default language:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npx --no-install ai-drivers install --all
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Install the complete catalog in another language:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npx --no-install ai-drivers install --all --language es
|
|
102
|
+
npx --no-install ai-drivers install --all --language fr
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Install a subset of the catalog
|
|
106
|
+
|
|
107
|
+
Pass one or more skill names after `install`:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx --no-install ai-drivers install code-explanation quality-verification
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
This is useful when a project only needs explanation and verification guidance. For an implementation workflow, install the related skills explicitly:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npx --no-install ai-drivers install \
|
|
117
|
+
feature-implementation \
|
|
118
|
+
quality-verification \
|
|
119
|
+
--language en
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
For specification-driven work:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npx --no-install ai-drivers install \
|
|
126
|
+
spec-driven-development \
|
|
127
|
+
feature-implementation \
|
|
128
|
+
quality-verification
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
List the available skill names with:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npx --no-install ai-drivers list
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Installation parameters
|
|
138
|
+
|
|
139
|
+
### `--all`
|
|
140
|
+
|
|
141
|
+
Install every skill in the catalog. Do not combine it with skill names unless you intentionally want the complete catalog; otherwise pass the specific names instead.
|
|
142
|
+
|
|
143
|
+
### `<skill> [skill...]`
|
|
144
|
+
|
|
145
|
+
Install one or more skills by name. Invalid names are ignored; if no valid skill remains, the command fails. Use `ai-drivers list` to see the catalog.
|
|
146
|
+
|
|
147
|
+
### `--language <code>` / `--lang <code>`
|
|
148
|
+
|
|
149
|
+
Select the language for the installed Markdown and the working-language instruction written to the project context. Supported translations currently include `en`, `es` and `fr`; BCP 47 forms such as `en-US` and `pt-BR` are accepted. The language base is normalized, and an unavailable translation falls back to English.
|
|
150
|
+
|
|
151
|
+
If omitted, English (`en`) is used.
|
|
152
|
+
|
|
153
|
+
### `--context "..."`
|
|
154
|
+
|
|
155
|
+
Write project context directly into `.agents/skills-context.md` while installing. Example:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
npx --no-install ai-drivers install --all \
|
|
159
|
+
--context "Node.js with TypeScript. Use npm test and npm run check."
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Use this for short context. For a structured context, prefer `--context-file`.
|
|
163
|
+
|
|
164
|
+
### `--context-file <path>`
|
|
165
|
+
|
|
166
|
+
Read project context from an existing file and write it to `.agents/skills-context.md`:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npx --no-install ai-drivers install --all \
|
|
170
|
+
--context-file ./PROJECT.md
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The external file is not copied into `.agents/`; only its content is written to `.agents/skills-context.md`.
|
|
174
|
+
|
|
175
|
+
### `--cwd <path>`
|
|
176
|
+
|
|
177
|
+
Install into a project other than the current working directory:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npx --no-install ai-drivers install --all \
|
|
181
|
+
--cwd /path/to/consumer-project
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### `--force`
|
|
185
|
+
|
|
186
|
+
Allow existing skill files to be overwritten. Use it deliberately when refreshing an installation. The project context is also rewritten when `--context`, `--context-file` or `--language` causes context output.
|
|
187
|
+
|
|
188
|
+
### `--help`
|
|
189
|
+
|
|
190
|
+
Display the CLI usage and available options:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
npx --no-install ai-drivers install --help
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Project context
|
|
197
|
+
|
|
198
|
+
`.agents/skills-context.md` is the project-specific contract read by the skills before they act. It should contain facts supported by the repository, not generic instructions copied from another project.
|
|
199
|
+
|
|
200
|
+
Recommended sections include:
|
|
201
|
+
|
|
202
|
+
```md
|
|
203
|
+
# Project context
|
|
204
|
+
|
|
205
|
+
## Stack and runtime
|
|
206
|
+
|
|
207
|
+
- Language and runtime versions.
|
|
208
|
+
- Frameworks and important dependencies.
|
|
209
|
+
|
|
210
|
+
## Commands
|
|
211
|
+
|
|
212
|
+
- Install: `...`
|
|
213
|
+
- Check or typecheck: `...`
|
|
214
|
+
- Test: `...`
|
|
215
|
+
- Build: `...`
|
|
216
|
+
- Lint or static analysis: `...` or `N/A`
|
|
217
|
+
|
|
218
|
+
## Repository structure
|
|
219
|
+
|
|
220
|
+
- Source directories and their responsibilities.
|
|
221
|
+
- Test and documentation locations.
|
|
222
|
+
|
|
223
|
+
## Architecture and boundaries
|
|
224
|
+
|
|
225
|
+
- Architectural style, only when supported by the repository: layered, modular monolith, hexagonal, clean architecture, DDD, event-driven or another documented approach.
|
|
226
|
+
- Domain, application, infrastructure and interface boundaries.
|
|
227
|
+
- Dependency direction and forbidden dependencies.
|
|
228
|
+
- Responsibilities of controllers, handlers, commands, queries, jobs, workers, events, listeners and adapters when they exist.
|
|
229
|
+
- Rules for synchronous calls, asynchronous processing and event delivery.
|
|
230
|
+
|
|
231
|
+
## Conventions
|
|
232
|
+
|
|
233
|
+
- Naming, module boundaries and documentation rules.
|
|
234
|
+
- Branch, commit and review policy.
|
|
235
|
+
|
|
236
|
+
## Limits
|
|
237
|
+
|
|
238
|
+
- Security, data, integration and operational constraints.
|
|
239
|
+
- Decisions agents must ask about instead of inventing.
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Example for a small TypeScript project:
|
|
243
|
+
|
|
244
|
+
```md
|
|
245
|
+
# Project context
|
|
246
|
+
|
|
247
|
+
## Stack and runtime
|
|
248
|
+
|
|
249
|
+
- Node.js 20 and TypeScript.
|
|
250
|
+
- Tests use the Node test runner.
|
|
251
|
+
|
|
252
|
+
## Commands
|
|
253
|
+
|
|
254
|
+
- Install: `npm install`
|
|
255
|
+
- Check: `npm run check`
|
|
256
|
+
- Test: `npm test`
|
|
257
|
+
- Build: `npm run build`
|
|
258
|
+
|
|
259
|
+
## Structure
|
|
260
|
+
|
|
261
|
+
- `src/` contains package source.
|
|
262
|
+
- `docs/` contains project documentation.
|
|
263
|
+
- Tests are colocated with the source or use `*.test.ts`.
|
|
264
|
+
|
|
265
|
+
## Architecture and boundaries
|
|
266
|
+
|
|
267
|
+
- Style: modular and hexagonal, with domain-oriented modules and event-driven workflows where documented.
|
|
268
|
+
- Domain code contains business rules and does not depend on infrastructure.
|
|
269
|
+
- Application services coordinate use cases and ports.
|
|
270
|
+
- Adapters connect external interfaces, persistence and messaging to the application ports.
|
|
271
|
+
- Controllers or handlers translate external input into application requests; they do not contain domain rules.
|
|
272
|
+
- Events describe completed facts. Listeners or workers handle asynchronous effects through the configured mechanism.
|
|
273
|
+
- Jobs are repeatable units of work and must follow the project's retry and idempotency rules.
|
|
274
|
+
- Dependencies flow toward the domain; new cross-boundary dependencies require explicit approval.
|
|
275
|
+
|
|
276
|
+
## Limits
|
|
277
|
+
|
|
278
|
+
- Do not add runtime dependencies without approval.
|
|
279
|
+
- Do not invent commands that are not present in `package.json` or project documentation.
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
If the file already exists, the installer preserves its existing project context and replaces only the working-language section when a language is selected. Do not put secrets in this file.
|
|
283
|
+
|
|
284
|
+
Architecture descriptions must be factual. Do not write “DDD”, “hexagonal” or “event-driven” merely because the project may benefit from those ideas. If the architecture is unclear, the agent must inspect the repository and ask before imposing a pattern.
|
|
285
|
+
|
|
286
|
+
### Complete context examples
|
|
287
|
+
|
|
288
|
+
The repository includes three equivalent context examples for a hotel-reservation project. They describe the same domain and workflows using different stacks:
|
|
289
|
+
|
|
290
|
+
- [`context-examples/hotel-reservations/nestjs.md`](context-examples/hotel-reservations/nestjs.md)
|
|
291
|
+
- [`context-examples/hotel-reservations/fastapi.md`](context-examples/hotel-reservations/fastapi.md)
|
|
292
|
+
- [`context-examples/hotel-reservations/laravel.md`](context-examples/hotel-reservations/laravel.md)
|
|
293
|
+
|
|
294
|
+
The same architecture is also demonstrated with an e-commerce domain:
|
|
295
|
+
|
|
296
|
+
- [`context-examples/ecommerce/nestjs.md`](context-examples/ecommerce/nestjs.md)
|
|
297
|
+
- [`context-examples/ecommerce/fastapi.md`](context-examples/ecommerce/fastapi.md)
|
|
298
|
+
- [`context-examples/ecommerce/laravel.md`](context-examples/ecommerce/laravel.md)
|
|
299
|
+
|
|
300
|
+
These examples demonstrate how controllers, jobs, workers, events and realtime adapters can be documented without changing the generic behavior expected from the skills.
|
|
301
|
+
|
|
302
|
+
## Spec-driven development and Constitution
|
|
303
|
+
|
|
304
|
+
The `spec-driven-development` skill is optional. Install it when a change needs explicit requirements, decisions, planning, task traceability or validation:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
npx --no-install ai-drivers install spec-driven-development \
|
|
308
|
+
feature-implementation \
|
|
309
|
+
quality-verification
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Constitution behavior
|
|
313
|
+
|
|
314
|
+
The Constitution is an optional project document at:
|
|
315
|
+
|
|
316
|
+
```text
|
|
317
|
+
docs/constitution.md
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
If it does not exist, the skill must not create it automatically. It should:
|
|
321
|
+
|
|
322
|
+
1. Ask whether the user wants a Constitution draft.
|
|
323
|
+
2. If the answer is no, record the Constitution as omitted and continue without blocking the specification workflow.
|
|
324
|
+
3. If the answer is yes, inspect the repository, context, manifests, scripts, tests and documentation.
|
|
325
|
+
4. Present a draft based only on verifiable project evidence.
|
|
326
|
+
5. Wait for explicit approval.
|
|
327
|
+
6. Create `docs/constitution.md` only after approval.
|
|
328
|
+
7. Verify that all commands and controls defined by the Constitution actually exist.
|
|
329
|
+
|
|
330
|
+
### Change classification
|
|
331
|
+
|
|
332
|
+
Before starting, the skill classifies the change:
|
|
333
|
+
|
|
334
|
+
- **Lightweight:** an isolated, clear correction or documentation change with no new contract, data model, security rule, integration or cross-layer behavior.
|
|
335
|
+
- **Standard:** related code, tests or configuration within an existing capability.
|
|
336
|
+
- **Full SDD:** a new capability, ambiguous or changing requirements, cross-cutting behavior, data/security changes, external effects or a need for explicit traceability.
|
|
337
|
+
|
|
338
|
+
Lightweight work records its scope, assumptions, risks and validation without creating unnecessary `spec.md`, `plan.md` or `tasks.md` files. If the scope expands or a decision is missing, the workflow escalates to Standard or Full SDD.
|
|
339
|
+
|
|
340
|
+
The complete SDD flow is:
|
|
341
|
+
|
|
342
|
+
```text
|
|
343
|
+
Constitution → Spec → Clarification → Plan → Tasks → Implementation → Documentation → Validation
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
The project context and repository define the actual commands, architecture, routes and tools. The skill must not invent them.
|
|
347
|
+
|
|
348
|
+
## Development
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
npm install
|
|
352
|
+
npm run check
|
|
353
|
+
npm run build
|
|
354
|
+
npm test
|
|
355
|
+
node dist/cli.js list
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
The future release will use `npm publish --access public`. It can then be run with `npx ai-drivers ...` or through `npm`, `yarn`, `pnpm` or `bun`.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Project context: E-commerce — FastAPI
|
|
2
|
+
|
|
3
|
+
This example describes an e-commerce platform with the same modular, hexagonal and event-driven architecture used by the other context examples.
|
|
4
|
+
|
|
5
|
+
## Stack and commands
|
|
6
|
+
|
|
7
|
+
- Python 3.12 and FastAPI.
|
|
8
|
+
- PostgreSQL with SQLAlchemy and Alembic.
|
|
9
|
+
- Redis and Celery workers for asynchronous jobs.
|
|
10
|
+
- FastAPI WebSocket endpoints for order and fulfillment updates.
|
|
11
|
+
- Dependency and environment manager: uv.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
uv sync
|
|
15
|
+
uv run fastapi dev app/main.py
|
|
16
|
+
uv run pytest
|
|
17
|
+
uv run pytest tests/e2e
|
|
18
|
+
uv run ruff check .
|
|
19
|
+
uv run mypy app
|
|
20
|
+
uv run alembic upgrade head
|
|
21
|
+
uv run celery -A app.infrastructure.worker worker
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Project structure
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
app/
|
|
28
|
+
├── modules/
|
|
29
|
+
│ ├── catalog/
|
|
30
|
+
│ ├── orders/
|
|
31
|
+
│ ├── inventory/
|
|
32
|
+
│ ├── payments/
|
|
33
|
+
│ └── fulfillment/
|
|
34
|
+
├── jobs/
|
|
35
|
+
├── shared/
|
|
36
|
+
└── main.py
|
|
37
|
+
tests/
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Architecture and boundaries
|
|
41
|
+
|
|
42
|
+
- Modular, domain-oriented and hexagonal architecture.
|
|
43
|
+
- Domain modules contain entities, value objects, invariants and domain events. They do not depend on FastAPI, WebSockets, Celery or SQLAlchemy.
|
|
44
|
+
- Application modules contain commands, queries, handlers, ports and transaction boundaries.
|
|
45
|
+
- Infrastructure implements repositories, payment gateways, Celery tasks, event publishing and external adapters.
|
|
46
|
+
- Routers and WebSocket endpoints are entry points only. They validate transport input, authorize the request, invoke an application use case and serialize the response.
|
|
47
|
+
- Routers must not reserve stock, capture payments, create shipments or execute long-running processes inline.
|
|
48
|
+
|
|
49
|
+
## E-commerce domain
|
|
50
|
+
|
|
51
|
+
- Products belong to categories and have a price and availability state.
|
|
52
|
+
- An order contains immutable line-item snapshots, customer data, totals and a lifecycle status.
|
|
53
|
+
- Inventory reservations prevent overselling and must be released when an order expires or is cancelled.
|
|
54
|
+
- Payment state is separate from order state and follows the configured provider contract.
|
|
55
|
+
- Shipment state is separate from payment and order state.
|
|
56
|
+
- Order, payment and inventory transitions are explicit and idempotent.
|
|
57
|
+
|
|
58
|
+
## HTTP and WebSocket entry points
|
|
59
|
+
|
|
60
|
+
- `GET /products` and `GET /products/{product_id}` expose catalog queries.
|
|
61
|
+
- `POST /orders` accepts an order request and invokes `CreateOrder`.
|
|
62
|
+
- `POST /orders/{order_id}/cancel` invokes the cancellation use case.
|
|
63
|
+
- `GET /orders/{order_id}` returns the current order projection.
|
|
64
|
+
- `OrderWebSocket` sends authorized order and fulfillment updates.
|
|
65
|
+
|
|
66
|
+
## Events and asynchronous jobs
|
|
67
|
+
|
|
68
|
+
- `OrderPlaced`, `InventoryReserved`, `PaymentAuthorized`, `PaymentFailed`, `OrderConfirmed`, `ShipmentCreated` and `OrderCancelled` are facts, not commands.
|
|
69
|
+
- Events are published after the required transaction boundary through the configured event bus.
|
|
70
|
+
- Event handlers enqueue tasks such as `reserve_inventory`, `authorize_payment`, `create_shipment`, `send_order_confirmation` and `release_expired_inventory`.
|
|
71
|
+
- Celery workers execute tasks with configured retry, timeout, backoff and failure rules.
|
|
72
|
+
- Tasks are idempotent and reload current state using stable identifiers.
|
|
73
|
+
- WebSocket notifications are reactions to events or completed tasks, never direct calls from domain objects.
|
|
74
|
+
|
|
75
|
+
## Example flow
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
OrdersRouter
|
|
79
|
+
→ CreateOrder use case
|
|
80
|
+
→ store pending order
|
|
81
|
+
→ OrderPlaced event
|
|
82
|
+
→ reserve inventory task
|
|
83
|
+
→ payment authorization task
|
|
84
|
+
→ OrderConfirmed event
|
|
85
|
+
→ shipment task
|
|
86
|
+
→ OrderWebSocket sends the documented update
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Rules and limits
|
|
90
|
+
|
|
91
|
+
- Do not put business rules in routers, WebSocket endpoints, tasks or event handlers.
|
|
92
|
+
- Do not call payment, inventory and fulfillment modules directly when an event is the integration boundary.
|
|
93
|
+
- Preserve idempotency for payment callbacks, inventory reservations and event delivery.
|
|
94
|
+
- Do not introduce a provider, queue or transport adapter without an explicit project decision.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Project context: E-commerce — Laravel
|
|
2
|
+
|
|
3
|
+
This example describes an e-commerce platform with the same modular, hexagonal and event-driven architecture used by the other context examples.
|
|
4
|
+
|
|
5
|
+
## Stack and commands
|
|
6
|
+
|
|
7
|
+
- PHP 8.3 and Laravel 11.
|
|
8
|
+
- PostgreSQL with Eloquent and migrations.
|
|
9
|
+
- Redis queues and Laravel workers for asynchronous jobs.
|
|
10
|
+
- Laravel broadcasting and Reverb for order and fulfillment updates.
|
|
11
|
+
- Dependency manager: Composer.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
composer install
|
|
15
|
+
php artisan serve
|
|
16
|
+
php artisan test
|
|
17
|
+
php artisan test --testsuite=Feature
|
|
18
|
+
./vendor/bin/pint --test
|
|
19
|
+
php artisan about
|
|
20
|
+
php artisan migrate
|
|
21
|
+
php artisan queue:work
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Project structure
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
app/
|
|
28
|
+
├── Domain/
|
|
29
|
+
│ ├── Catalog/
|
|
30
|
+
│ ├── Orders/
|
|
31
|
+
│ ├── Inventory/
|
|
32
|
+
│ ├── Payments/
|
|
33
|
+
│ └── Fulfillment/
|
|
34
|
+
├── Application/
|
|
35
|
+
├── Infrastructure/
|
|
36
|
+
├── Http/Controllers/
|
|
37
|
+
├── Jobs/
|
|
38
|
+
├── Events/
|
|
39
|
+
├── Listeners/
|
|
40
|
+
└── Broadcasts/
|
|
41
|
+
database/
|
|
42
|
+
routes/
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Architecture and boundaries
|
|
46
|
+
|
|
47
|
+
- Modular, domain-oriented and hexagonal architecture within the Laravel application.
|
|
48
|
+
- Domain modules contain entities, value objects, invariants and domain events. They do not depend on HTTP controllers, queue workers, broadcasting or persistence details.
|
|
49
|
+
- Application modules contain commands, queries, handlers, ports and transaction boundaries.
|
|
50
|
+
- Infrastructure implements repositories, payment gateways, queues, event publishing and external adapters.
|
|
51
|
+
- HTTP controllers and broadcast channels are entry points only. They validate transport input, authorize the request, invoke an application use case and return or broadcast a documented response.
|
|
52
|
+
- Controllers must not reserve stock, capture payments, create shipments or execute long-running processes inline.
|
|
53
|
+
|
|
54
|
+
## E-commerce domain
|
|
55
|
+
|
|
56
|
+
- Products belong to categories and have a price and availability state.
|
|
57
|
+
- An order contains immutable line-item snapshots, customer data, totals and a lifecycle status.
|
|
58
|
+
- Inventory reservations prevent overselling and must be released when an order expires or is cancelled.
|
|
59
|
+
- Payment state is separate from order state and follows the configured provider contract.
|
|
60
|
+
- Shipment state is separate from payment and order state.
|
|
61
|
+
- Order, payment and inventory transitions are explicit and idempotent.
|
|
62
|
+
|
|
63
|
+
## HTTP and realtime entry points
|
|
64
|
+
|
|
65
|
+
- `GET /products` and `GET /products/{product}` expose catalog queries.
|
|
66
|
+
- `POST /orders` accepts an order request and invokes `CreateOrder`.
|
|
67
|
+
- `POST /orders/{order}/cancel` invokes the cancellation use case.
|
|
68
|
+
- `GET /orders/{order}` returns the current order projection.
|
|
69
|
+
- Broadcast channels expose authorized order and fulfillment updates.
|
|
70
|
+
|
|
71
|
+
## Events and asynchronous jobs
|
|
72
|
+
|
|
73
|
+
- `OrderPlaced`, `InventoryReserved`, `PaymentAuthorized`, `PaymentFailed`, `OrderConfirmed`, `ShipmentCreated` and `OrderCancelled` are facts, not commands.
|
|
74
|
+
- Events are dispatched after the required transaction boundary through the configured event mechanism.
|
|
75
|
+
- Listeners dispatch jobs such as `ReserveInventory`, `AuthorizePayment`, `CreateShipment`, `SendOrderConfirmation` and `ReleaseExpiredInventory`.
|
|
76
|
+
- Queue workers execute jobs with configured retry, timeout, backoff and failed-job rules.
|
|
77
|
+
- Jobs are idempotent and reload current state using stable identifiers.
|
|
78
|
+
- Broadcast notifications are reactions to events or completed jobs, never direct calls from domain objects.
|
|
79
|
+
|
|
80
|
+
## Example flow
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
OrderController
|
|
84
|
+
→ CreateOrder use case
|
|
85
|
+
→ store pending order
|
|
86
|
+
→ OrderPlaced event
|
|
87
|
+
→ reserve inventory job
|
|
88
|
+
→ payment authorization job
|
|
89
|
+
→ OrderConfirmed event
|
|
90
|
+
→ shipment job
|
|
91
|
+
→ broadcast channel publishes the documented update
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Rules and limits
|
|
95
|
+
|
|
96
|
+
- Do not put business rules in controllers, jobs, listeners or broadcast channels.
|
|
97
|
+
- Do not call payment, inventory and fulfillment modules directly when an event is the integration boundary.
|
|
98
|
+
- Preserve idempotency for payment callbacks, inventory reservations and event delivery.
|
|
99
|
+
- Do not introduce a provider, queue or broadcast adapter without an explicit project decision.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Project context: E-commerce — NestJS
|
|
2
|
+
|
|
3
|
+
This example describes an e-commerce platform with the same modular, hexagonal and event-driven architecture used by the other context examples.
|
|
4
|
+
|
|
5
|
+
## Stack and commands
|
|
6
|
+
|
|
7
|
+
- Node.js 22, TypeScript 5 and NestJS.
|
|
8
|
+
- PostgreSQL for catalog, orders and inventory.
|
|
9
|
+
- Redis and BullMQ for asynchronous jobs and workers.
|
|
10
|
+
- NestJS WebSocket gateways for order and fulfillment updates.
|
|
11
|
+
- Package manager: pnpm.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
pnpm install
|
|
15
|
+
pnpm start:dev
|
|
16
|
+
pnpm test
|
|
17
|
+
pnpm test:e2e
|
|
18
|
+
pnpm lint
|
|
19
|
+
pnpm typecheck
|
|
20
|
+
pnpm build
|
|
21
|
+
pnpm worker
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Project structure
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
src/
|
|
28
|
+
├── modules/
|
|
29
|
+
│ ├── catalog/
|
|
30
|
+
│ ├── orders/
|
|
31
|
+
│ ├── inventory/
|
|
32
|
+
│ ├── payments/
|
|
33
|
+
│ └── fulfillment/
|
|
34
|
+
├── jobs/
|
|
35
|
+
├── shared/
|
|
36
|
+
└── main.ts
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Architecture and boundaries
|
|
40
|
+
|
|
41
|
+
- Modular, domain-oriented and hexagonal architecture.
|
|
42
|
+
- Domain modules contain entities, value objects, invariants and domain events. They do not depend on NestJS, HTTP, WebSockets, queues or persistence adapters.
|
|
43
|
+
- Application modules contain commands, queries, handlers, ports and transaction boundaries.
|
|
44
|
+
- Infrastructure implements repositories, payment gateways, queues, event publishing and external adapters.
|
|
45
|
+
- Controllers and WebSocket gateways are entry points only. They authenticate, validate transport input, invoke an application use case and return or emit a documented response.
|
|
46
|
+
- Controllers must not reserve stock, capture payments, create shipments or execute long-running processes inline.
|
|
47
|
+
|
|
48
|
+
## E-commerce domain
|
|
49
|
+
|
|
50
|
+
- Products belong to categories and have a price and availability state.
|
|
51
|
+
- An order contains immutable line-item snapshots, customer data, totals and a lifecycle status.
|
|
52
|
+
- Inventory reservations prevent overselling and must be released when an order expires or is cancelled.
|
|
53
|
+
- Payment state is separate from order state and follows the configured provider contract.
|
|
54
|
+
- Shipment state is separate from payment and order state.
|
|
55
|
+
- Order, payment and inventory transitions are explicit and idempotent.
|
|
56
|
+
|
|
57
|
+
## HTTP and WebSocket entry points
|
|
58
|
+
|
|
59
|
+
- `GET /products` and `GET /products/:id` expose catalog queries.
|
|
60
|
+
- `POST /orders` accepts an order request and invokes `CreateOrder`.
|
|
61
|
+
- `POST /orders/:id/cancel` invokes the cancellation use case.
|
|
62
|
+
- `GET /orders/:id` returns the current order projection.
|
|
63
|
+
- `OrderGateway` emits authorized order and fulfillment updates.
|
|
64
|
+
|
|
65
|
+
## Events and asynchronous jobs
|
|
66
|
+
|
|
67
|
+
- `OrderPlaced`, `InventoryReserved`, `PaymentAuthorized`, `PaymentFailed`, `OrderConfirmed`, `ShipmentCreated` and `OrderCancelled` are facts, not commands.
|
|
68
|
+
- Events are published after the required transaction boundary through the configured event bus.
|
|
69
|
+
- Event handlers schedule jobs such as `ReserveInventory`, `AuthorizePayment`, `CreateShipment`, `SendOrderConfirmation` and `ReleaseExpiredInventory`.
|
|
70
|
+
- Workers execute jobs with configured retry, timeout, backoff and dead-letter rules.
|
|
71
|
+
- Jobs are idempotent and reload current state using stable identifiers.
|
|
72
|
+
- WebSocket notifications are reactions to events or completed jobs, never direct calls from domain entities.
|
|
73
|
+
|
|
74
|
+
## Example flow
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
OrdersController
|
|
78
|
+
→ CreateOrder use case
|
|
79
|
+
→ store pending order
|
|
80
|
+
→ OrderPlaced event
|
|
81
|
+
→ reserve inventory job
|
|
82
|
+
→ payment authorization job
|
|
83
|
+
→ OrderConfirmed event
|
|
84
|
+
→ shipment job
|
|
85
|
+
→ OrderGateway emits the documented update
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Rules and limits
|
|
89
|
+
|
|
90
|
+
- Do not put business rules in controllers, gateways, jobs or event listeners.
|
|
91
|
+
- Do not call payment, inventory and fulfillment modules directly when an event is the integration boundary.
|
|
92
|
+
- Preserve idempotency for payment callbacks, inventory reservations and event delivery.
|
|
93
|
+
- Do not introduce a provider, queue or transport adapter without an explicit project decision.
|