@mkappelhof/agent-instructions 1.0.0 → 1.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/CHANGELOG.md +16 -0
- package/README.md +15 -11
- package/base.md +13 -5
- package/nest.md +53 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
1
|
# @mkappelhof/agent-instructions
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3c4c6b4: Add `nest.md` with general best-practice conventions for NestJS services (project structure, DI, DTOs/validation, error handling, config/logging, testing).
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 3c4c6b4: Make `base.md` a generic, standalone baseline instead of assuming it's always paired with this repo's other `@mkappelhof/*` config packages. Following a matching config package's `AGENTS.md` is now framed as conditional on the project actually using it, not assumed.
|
|
12
|
+
|
|
13
|
+
## 1.0.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- eb2577f: Add new configs
|
package/README.md
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
# Shared agent instructions
|
|
2
2
|
|
|
3
3
|
Project-level instructions for AI coding agents, covering code structure and conventions rather
|
|
4
|
-
than tool configuration.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
| `
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
than tool configuration. If the project also uses one of this repo's config packages (TypeScript,
|
|
5
|
+
Biome, ESLint, Stylelint), pair these with the `AGENTS.md` it ships, which describes that tool's
|
|
6
|
+
rules — but these files don't assume that pairing, and `base.md` works as generic baseline
|
|
7
|
+
instructions on its own for a project that doesn't match any of the more specific files below.
|
|
8
|
+
|
|
9
|
+
| File | For |
|
|
10
|
+
| ---------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| `base.md` | Any project, any stack: verifying instead of assuming, workflow, git, imports, TypeScript, design tokens, versioning |
|
|
12
|
+
| `react.md` | React and Next.js projects (components, contexts, i18next, SCSS modules, Vitest) |
|
|
13
|
+
| `astro.md` | Static Astro sites (rendering, styling, data, images) |
|
|
14
|
+
| `nest.md` | NestJS services (modules, DI, DTOs/validation, error handling, testing) |
|
|
15
|
+
|
|
16
|
+
`react.md`, `astro.md` and `nest.md` all tell agents to read `base.md` first, so you only need to
|
|
17
|
+
reference the file for your project type. For a project that's none of these (a plain script,
|
|
18
|
+
a different framework, etc.), reference `base.md` directly.
|
|
15
19
|
|
|
16
20
|
## Installation
|
|
17
21
|
|
package/base.md
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
# Base — agent instructions
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
the project
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
My personal baseline conventions for any project I work on, regardless of stack and regardless of
|
|
4
|
+
whether the project uses any other `@mkappelhof/*` package. `react.md`, `astro.md` and `nest.md`
|
|
5
|
+
build on this file for their respective project types, but this file is also meant to stand alone
|
|
6
|
+
as generic `AGENTS.md` content for projects that don't match one of those.
|
|
7
|
+
|
|
8
|
+
This file is a starting point, not a mandate: where the project's own `AGENTS.md` (or anything the
|
|
9
|
+
user says) differs from what's here, that project-specific instruction wins.
|
|
10
|
+
|
|
11
|
+
If the project happens to use one of my shared `@mkappelhof/*` config packages (for TypeScript,
|
|
12
|
+
linting, formatting, etc.), that package's own `AGENTS.md` describes the rules its tool enforces —
|
|
13
|
+
follow those too. Don't assume one is in use, though; check the project's `package.json` and
|
|
14
|
+
config files (`tsconfig.json`, `.eslintrc*`, `biome.json`, `.stylelintrc*`, ...) to see what
|
|
15
|
+
tooling is actually there before applying tool-specific conventions from anywhere.
|
|
8
16
|
|
|
9
17
|
## Don't assume, verify or ask
|
|
10
18
|
|
package/nest.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# NestJS — agent instructions
|
|
2
|
+
|
|
3
|
+
Conventions for NestJS services written in TypeScript. Everything in [`base.md`](./base.md)
|
|
4
|
+
applies as well (its CSS/design-token sections just won't come up in a backend service); read it
|
|
5
|
+
first.
|
|
6
|
+
|
|
7
|
+
## Project structure
|
|
8
|
+
|
|
9
|
+
- Organize by feature module under `src/<feature>/`, each with its own controller, service,
|
|
10
|
+
module and DTOs — the shape `nest g resource` / `nest g module|controller|service` produces.
|
|
11
|
+
- One class per file, named `<name>.<type>.ts` (`users.controller.ts`, `users.service.ts`,
|
|
12
|
+
`users.module.ts`).
|
|
13
|
+
- DTOs live in a `dto/` folder inside the feature module, one class per file
|
|
14
|
+
(`dto/create-user.dto.ts`).
|
|
15
|
+
|
|
16
|
+
## Modules & dependency injection
|
|
17
|
+
|
|
18
|
+
- Keep controllers thin: parse input, delegate to a service, shape the response. Business logic
|
|
19
|
+
belongs in services, not controllers.
|
|
20
|
+
- Inject dependencies through constructor parameter properties
|
|
21
|
+
(`constructor(private readonly usersService: UsersService) {}`), not property injection or
|
|
22
|
+
manual `new`.
|
|
23
|
+
- Depend on Nest's DI container for anything registered as a provider; don't import a service and
|
|
24
|
+
instantiate it yourself.
|
|
25
|
+
|
|
26
|
+
## DTOs & validation
|
|
27
|
+
|
|
28
|
+
- Validate every request body/query/param with a DTO class using `class-validator` decorators
|
|
29
|
+
(`@IsString()`, `@IsOptional()`, etc.), not manual checks in the controller.
|
|
30
|
+
- Enable a global `ValidationPipe` (with `whitelist: true`) in `main.ts` instead of adding it
|
|
31
|
+
per-route.
|
|
32
|
+
- Shape what a controller returns with a response DTO or `class-transformer`'s
|
|
33
|
+
`@Expose()`/`@Exclude()`, instead of returning entity/ORM objects straight to the client.
|
|
34
|
+
|
|
35
|
+
## Error handling
|
|
36
|
+
|
|
37
|
+
- Throw Nest's built-in HTTP exceptions (`NotFoundException`, `BadRequestException`, etc.) instead
|
|
38
|
+
of returning error objects or throwing a plain `Error`.
|
|
39
|
+
- For error formatting that applies across many routes, use an `ExceptionFilter` instead of
|
|
40
|
+
repeating try/catch in every controller.
|
|
41
|
+
|
|
42
|
+
## Configuration & logging
|
|
43
|
+
|
|
44
|
+
- Read environment values through `@nestjs/config`'s `ConfigService`, not `process.env` scattered
|
|
45
|
+
through the codebase.
|
|
46
|
+
- Log through Nest's built-in `Logger`, not `console.log`.
|
|
47
|
+
|
|
48
|
+
## Testing
|
|
49
|
+
|
|
50
|
+
- Build tests with `Test.createTestingModule` and override providers with mocks, rather than
|
|
51
|
+
instantiating classes by hand.
|
|
52
|
+
- Co-locate unit tests with their source as `*.spec.ts`. Keep end-to-end tests that exercise the
|
|
53
|
+
HTTP layer in `test/` as `*.e2e-spec.ts`.
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkappelhof/agent-instructions",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Shared instructions for AI coding agents working on React/Next.js and
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Shared instructions for AI coding agents working on React/Next.js, Astro and NestJS projects",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./base.md": "./base.md",
|
|
7
7
|
"./react.md": "./react.md",
|
|
8
8
|
"./astro.md": "./astro.md",
|
|
9
|
+
"./nest.md": "./nest.md",
|
|
9
10
|
"./package.json": "./package.json"
|
|
10
11
|
},
|
|
11
12
|
"files": [
|
|
12
13
|
"base.md",
|
|
13
14
|
"react.md",
|
|
14
15
|
"astro.md",
|
|
16
|
+
"nest.md",
|
|
15
17
|
"README.md",
|
|
16
18
|
"CHANGELOG.md"
|
|
17
19
|
],
|
|
@@ -27,6 +29,7 @@
|
|
|
27
29
|
"ai",
|
|
28
30
|
"react",
|
|
29
31
|
"nextjs",
|
|
30
|
-
"astro"
|
|
32
|
+
"astro",
|
|
33
|
+
"nestjs"
|
|
31
34
|
]
|
|
32
35
|
}
|