create-daloy 1.1.1 → 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/README.md +1 -1
- package/package.json +1 -1
- package/sbom.cdx.json +9 -9
- package/sbom.spdx.json +5 -5
- package/templates/bun-basic/_agents/skills/daloyjs-best-practices/SKILL.md +21 -40
- package/templates/bun-basic/_agents/skills/daloyjs-best-practices/references/ci-workflows.md +19 -0
- package/templates/bun-basic/_agents/skills/daloyjs-best-practices/references/mcp.md +25 -0
- package/templates/bun-basic/package.json +1 -1
- package/templates/cloudflare-worker/_agents/skills/daloyjs-best-practices/SKILL.md +21 -40
- package/templates/cloudflare-worker/_agents/skills/daloyjs-best-practices/references/ci-workflows.md +19 -0
- package/templates/cloudflare-worker/_agents/skills/daloyjs-best-practices/references/mcp.md +25 -0
- package/templates/cloudflare-worker/package.json +1 -1
- package/templates/deno-basic/_agents/skills/daloyjs-best-practices/SKILL.md +21 -39
- package/templates/deno-basic/_agents/skills/daloyjs-best-practices/references/ci-workflows.md +17 -0
- package/templates/deno-basic/_agents/skills/daloyjs-best-practices/references/mcp.md +25 -0
- package/templates/deno-basic/deno.json +5 -5
- package/templates/node-basic/_agents/skills/daloyjs-best-practices/SKILL.md +20 -41
- package/templates/node-basic/_agents/skills/daloyjs-best-practices/references/ci-workflows.md +19 -0
- package/templates/node-basic/_agents/skills/daloyjs-best-practices/references/mcp.md +25 -0
- package/templates/node-basic/package.json +1 -1
- package/templates/vercel/_agents/skills/daloyjs-best-practices/SKILL.md +20 -41
- package/templates/vercel/_agents/skills/daloyjs-best-practices/references/ci-workflows.md +19 -0
- package/templates/vercel/_agents/skills/daloyjs-best-practices/references/mcp.md +25 -0
- package/templates/vercel/package.json +1 -1
package/README.md
CHANGED
|
@@ -281,7 +281,7 @@ not need.
|
|
|
281
281
|
Every scaffolded project ships with two files that help AI coding agents (Copilot, Claude Code, Cursor, Codex, etc.) understand and work in your project:
|
|
282
282
|
|
|
283
283
|
- `AGENTS.md` (repo root) — a small, top-of-context file (per the open [AGENTS.md](https://agents.md) convention): one-line project description, package manager / runtime, project shape, core rules, and the few commands an agent needs. It links to the full skill below.
|
|
284
|
-
- `.agents/skills/daloyjs-best-practices/SKILL.md` — comprehensive operational guidance following the open `agents/skills/<skill-name>/SKILL.md` convention: when to use the skill, project structure, core workflows (adding routes, regenerating the OpenAPI spec and client), schema and validation conventions, error-handling patterns, middleware order, testing best practices (happy and unhappy paths), security best practices, logging and observability notes, configuration and secrets handling, deployment notes, pitfalls and guardrails, and process expectations.
|
|
284
|
+
- `.agents/skills/daloyjs-best-practices/SKILL.md` — comprehensive operational guidance following the open `agents/skills/<skill-name>/SKILL.md` convention: when to use the skill, project structure, core workflows (adding routes, regenerating the OpenAPI spec and client), schema and validation conventions, error-handling patterns, middleware order, testing best practices (happy and unhappy paths), security best practices, logging and observability notes, configuration and secrets handling, deployment notes, pitfalls and guardrails, and process expectations. Rare topics (MCP, `--with-ci` workflows) live under `.agents/skills/daloyjs-best-practices/references/` and are opened only when the skill says to read them.
|
|
285
285
|
|
|
286
286
|
Both files are tailored to the chosen template (Node, Bun, Deno, Vercel, or Cloudflare Workers), and Node-style templates rewrite their commands to match your selected package manager. They follow the "instruction budget" advice — small root file, progressive disclosure for the rest — so they don't waste agent tokens. Edit or delete them freely; the framework does not depend on them at runtime.
|
|
287
287
|
|
package/package.json
CHANGED
package/sbom.cdx.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bomFormat": "CycloneDX",
|
|
3
3
|
"specVersion": "1.5",
|
|
4
|
-
"serialNumber": "urn:uuid:
|
|
4
|
+
"serialNumber": "urn:uuid:14e46560-a86e-5c0f-8279-490ef7794f0e",
|
|
5
5
|
"version": 1,
|
|
6
6
|
"metadata": {
|
|
7
|
-
"timestamp": "2026-08-
|
|
7
|
+
"timestamp": "2026-08-20T11:51:47.001Z",
|
|
8
8
|
"tools": [
|
|
9
9
|
{
|
|
10
10
|
"vendor": "DaloyJS",
|
|
11
11
|
"name": "daloy-generate-sbom",
|
|
12
|
-
"version": "1.
|
|
12
|
+
"version": "1.2.0"
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
"authors": [],
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "library",
|
|
18
|
-
"bom-ref": "pkg:npm/create-daloy@1.
|
|
18
|
+
"bom-ref": "pkg:npm/create-daloy@1.2.0",
|
|
19
19
|
"name": "create-daloy",
|
|
20
|
-
"version": "1.
|
|
20
|
+
"version": "1.2.0",
|
|
21
21
|
"description": "Scaffold a new DaloyJS project. Run with `pnpm create daloy`, `npm create daloy@latest`, `yarn create daloy`, or `bun create daloy`.",
|
|
22
|
-
"purl": "pkg:npm/create-daloy@1.
|
|
22
|
+
"purl": "pkg:npm/create-daloy@1.2.0",
|
|
23
23
|
"licenses": [
|
|
24
24
|
{
|
|
25
25
|
"license": {
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
}
|
|
43
43
|
],
|
|
44
44
|
"swid": {
|
|
45
|
-
"tagId": "swidtag-create-daloy-1.
|
|
45
|
+
"tagId": "swidtag-create-daloy-1.2.0",
|
|
46
46
|
"name": "create-daloy",
|
|
47
|
-
"version": "1.
|
|
47
|
+
"version": "1.2.0",
|
|
48
48
|
"tagVersion": 0,
|
|
49
49
|
"patch": false
|
|
50
50
|
}
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"components": [],
|
|
54
54
|
"dependencies": [
|
|
55
55
|
{
|
|
56
|
-
"ref": "pkg:npm/create-daloy@1.
|
|
56
|
+
"ref": "pkg:npm/create-daloy@1.2.0",
|
|
57
57
|
"dependsOn": []
|
|
58
58
|
}
|
|
59
59
|
]
|
package/sbom.spdx.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"spdxVersion": "SPDX-2.3",
|
|
3
3
|
"dataLicense": "CC0-1.0",
|
|
4
4
|
"SPDXID": "SPDXRef-DOCUMENT",
|
|
5
|
-
"name": "create-daloy-1.
|
|
6
|
-
"documentNamespace": "https://github.com/daloyjs/daloy/sbom/create-daloy-1.
|
|
5
|
+
"name": "create-daloy-1.2.0",
|
|
6
|
+
"documentNamespace": "https://github.com/daloyjs/daloy/sbom/create-daloy-1.2.0-14e46560-a86e-5c0f-8279-490ef7794f0e",
|
|
7
7
|
"creationInfo": {
|
|
8
|
-
"created": "2026-08-
|
|
8
|
+
"created": "2026-08-20T11:51:47.001Z",
|
|
9
9
|
"creators": [
|
|
10
10
|
"Tool: daloy-generate-sbom",
|
|
11
11
|
"Organization: DaloyJS"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
{
|
|
17
17
|
"SPDXID": "SPDXRef-Package-create-daloy",
|
|
18
18
|
"name": "create-daloy",
|
|
19
|
-
"versionInfo": "1.
|
|
19
|
+
"versionInfo": "1.2.0",
|
|
20
20
|
"downloadLocation": "https://github.com/daloyjs/daloy",
|
|
21
21
|
"filesAnalyzed": false,
|
|
22
22
|
"licenseConcluded": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
{
|
|
28
28
|
"referenceCategory": "PACKAGE-MANAGER",
|
|
29
29
|
"referenceType": "purl",
|
|
30
|
-
"referenceLocator": "pkg:npm/create-daloy@1.
|
|
30
|
+
"referenceLocator": "pkg:npm/create-daloy@1.2.0"
|
|
31
31
|
}
|
|
32
32
|
]
|
|
33
33
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: daloyjs-best-practices
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Build, test, and harden this DaloyJS REST API on Bun. Use when the user
|
|
5
|
+
asks to add or change an endpoint, route, Zod/Standard Schema,
|
|
6
|
+
middleware, error handling, OpenAPI spec, typed Hey API client, contract
|
|
7
|
+
gate, auth, rate limit, or security default. Also use for phrasing like
|
|
8
|
+
"add GET /...", "new route", "regenerate the client", "bun test", or
|
|
9
|
+
"fix the 401". Do not use for frontend UI, infra-only work, or unrelated
|
|
10
|
+
docs.
|
|
9
11
|
license: MIT
|
|
10
12
|
---
|
|
11
13
|
|
|
@@ -25,8 +27,15 @@ Use this skill when you need to:
|
|
|
25
27
|
- Wire up new middleware, validation, or error handling.
|
|
26
28
|
- Add or update tests, run typecheck, or build the project.
|
|
27
29
|
- Harden the API (auth, CORS, rate limits, secrets, dependency hygiene).
|
|
30
|
+
- User phrasing such as "add GET /books", "new endpoint", "regenerate the
|
|
31
|
+
client", or "fix the 401".
|
|
28
32
|
|
|
29
|
-
Do **not** use this skill for
|
|
33
|
+
Do **not** use this skill for frontend UI, infra-only work, or unrelated
|
|
34
|
+
docs. Rare topics live under `references/`: **read**
|
|
35
|
+
[references/mcp.md](references/mcp.md) only when adding an MCP endpoint,
|
|
36
|
+
and **read** [references/ci-workflows.md](references/ci-workflows.md) only
|
|
37
|
+
when editing `.github/` or a `--with-ci` workflow. Do not load those files
|
|
38
|
+
up front.
|
|
30
39
|
|
|
31
40
|
## Core principles
|
|
32
41
|
|
|
@@ -276,20 +285,9 @@ Aim for complete happy- and unhappy-path test coverage of the routes you add.
|
|
|
276
285
|
|
|
277
286
|
## CI and workflows (`--with-ci` scaffolds)
|
|
278
287
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
Those files carry the same weight as the secure defaults above — an agent
|
|
283
|
-
asked to "make CI pass" must not soften them.
|
|
284
|
-
|
|
285
|
-
- Keep every `uses:` pinned to a full commit SHA with its version comment. Never move an action to a tag or a branch, and never add an unpinned one.
|
|
286
|
-
- Keep `permissions: {}` at the top of each workflow and grant scopes per job. If a step needs more, give that one job the narrowest scope that works — never widen the workflow default.
|
|
287
|
-
- Keep `persist-credentials: false` on `actions/checkout` and keep package-manager caching off; a shared cache can bridge fork PRs into trusted branches.
|
|
288
|
-
- Keep installs running with lifecycle scripts disabled (`--ignore-scripts` / `npm_config_ignore_scripts`).
|
|
289
|
-
- `verify:lockfile`, `verify:runtime-eol`, the audit steps, the contract check, and the scanners are gates. When one fails, fix the finding — do not delete the step, add `continue-on-error`, or lower a severity threshold to go green.
|
|
290
|
-
- Keep `cooldown` in `.github/dependabot.yml` aligned with `minimum-release-age` in `.npmrc`. They are one 24h supply-chain policy expressed to two different tools; changing one alone silently defeats it.
|
|
291
|
-
- `dast.yml` boots this template's own start command. If you change how the app starts, update that workflow to match or the weekly scan will fail.
|
|
292
|
-
- Read `SECURITY.md` before deleting a workflow. On a private repository without GitHub Advanced Security some of them are _expected_ to be removed, and it lists exactly which.
|
|
288
|
+
Only when editing `.github/`, Dependabot, or a `--with-ci` workflow:
|
|
289
|
+
**read** [references/ci-workflows.md](references/ci-workflows.md) as
|
|
290
|
+
reference. Skip that file for ordinary route work.
|
|
293
291
|
|
|
294
292
|
## Logging & observability
|
|
295
293
|
|
|
@@ -339,26 +337,9 @@ asked to "make CI pass" must not soften them.
|
|
|
339
337
|
|
|
340
338
|
## Exposing this API over MCP
|
|
341
339
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
with `createMcpHandler({ tools, resources, prompts })` and mount it with
|
|
346
|
-
`mcpRoutes("/mcp", handler)`. Throw `McpToolError` for caller-correctable
|
|
347
|
-
tool failures. The handler ships protocol-level guards (body cap, UTF-8/JSON
|
|
348
|
-
validation, `Origin` checks against DNS rebinding) and composes with the
|
|
349
|
-
existing middleware chain — put `bearerAuth()` / `rateLimit()` in front of
|
|
350
|
-
it like any other route. See <https://daloyjs.dev/docs> for the MCP guide.
|
|
351
|
-
|
|
352
|
-
The handler speaks the stateless MCP `2026-07-28` revision and every earlier
|
|
353
|
-
one on the same endpoint: modern clients get `server/discover`, per-request
|
|
354
|
-
`_meta`, `resultType` results, caching hints, and multi round-trip requests
|
|
355
|
-
(return `{ resultType: "input_required", inputRequests, requestState }` instead
|
|
356
|
-
of a final result), while legacy clients keep the `initialize` handshake. The
|
|
357
|
-
required `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers are
|
|
358
|
-
validated against the body — never relax that check. Treat an incoming
|
|
359
|
-
`requestState` as attacker-controlled: sign it, bind it to the principal and
|
|
360
|
-
the originating request, and give it a short expiry before it influences
|
|
361
|
-
anything.
|
|
340
|
+
Only when adding or changing an MCP endpoint: **read**
|
|
341
|
+
[references/mcp.md](references/mcp.md) as reference (do not treat it as a
|
|
342
|
+
script to run). Skip that file for ordinary HTTP route work.
|
|
362
343
|
|
|
363
344
|
## More
|
|
364
345
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# CI and workflows (`--with-ci` scaffolds)
|
|
2
|
+
|
|
3
|
+
**Read this file as reference** when editing `.github/`, Dependabot, or a
|
|
4
|
+
`--with-ci` workflow. Skip it unless the task touches CI.
|
|
5
|
+
|
|
6
|
+
If this project was scaffolded with `--with-ci`, `.github/` holds a hardened
|
|
7
|
+
GitHub Actions bundle alongside `CODEOWNERS`, `SECURITY.md`, and the
|
|
8
|
+
`verify:lockfile` / `verify:runtime-eol` scripts wired into `package.json`.
|
|
9
|
+
Those files carry the same weight as the secure defaults in `SKILL.md` — an
|
|
10
|
+
agent asked to "make CI pass" must not soften them.
|
|
11
|
+
|
|
12
|
+
- Keep every `uses:` pinned to a full commit SHA with its version comment. Never move an action to a tag or a branch, and never add an unpinned one.
|
|
13
|
+
- Keep `permissions: {}` at the top of each workflow and grant scopes per job. If a step needs more, give that one job the narrowest scope that works — never widen the workflow default.
|
|
14
|
+
- Keep `persist-credentials: false` on `actions/checkout` and keep package-manager caching off; a shared cache can bridge fork PRs into trusted branches.
|
|
15
|
+
- Keep installs running with lifecycle scripts disabled (`--ignore-scripts` / `npm_config_ignore_scripts`).
|
|
16
|
+
- `verify:lockfile`, `verify:runtime-eol`, the audit steps, the contract check, and the scanners are gates. When one fails, fix the finding — do not delete the step, add `continue-on-error`, or lower a severity threshold to go green.
|
|
17
|
+
- Keep `cooldown` in `.github/dependabot.yml` aligned with `minimum-release-age` in `.npmrc`. They are one 24h supply-chain policy expressed to two different tools; changing one alone silently defeats it.
|
|
18
|
+
- `dast.yml` boots this template's own start command. If you change how the app starts, update that workflow to match or the weekly scan will fail.
|
|
19
|
+
- Read `SECURITY.md` before deleting a workflow. On a private repository without GitHub Advanced Security some of them are _expected_ to be removed, and it lists exactly which.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Exposing this API over MCP
|
|
2
|
+
|
|
3
|
+
**Read this file as reference** when adding or changing an MCP endpoint. Do
|
|
4
|
+
not treat it as a script to run. Skip it for ordinary HTTP route work.
|
|
5
|
+
|
|
6
|
+
`@daloyjs/core` ships a dependency-free Model Context Protocol (Streamable
|
|
7
|
+
HTTP) server helper — also available from the `@daloyjs/core/mcp` subpath.
|
|
8
|
+
To expose selected capabilities to MCP clients (AI agents), build a handler
|
|
9
|
+
with `createMcpHandler({ tools, resources, prompts })` and mount it with
|
|
10
|
+
`mcpRoutes("/mcp", handler)`. Throw `McpToolError` for caller-correctable
|
|
11
|
+
tool failures. The handler ships protocol-level guards (body cap, UTF-8/JSON
|
|
12
|
+
validation, `Origin` checks against DNS rebinding) and composes with the
|
|
13
|
+
existing middleware chain — put `bearerAuth()` / `rateLimit()` in front of
|
|
14
|
+
it like any other route. See <https://daloyjs.dev/docs> for the MCP guide.
|
|
15
|
+
|
|
16
|
+
The handler speaks the stateless MCP `2026-07-28` revision and every earlier
|
|
17
|
+
one on the same endpoint: modern clients get `server/discover`, per-request
|
|
18
|
+
`_meta`, `resultType` results, caching hints, and multi round-trip requests
|
|
19
|
+
(return `{ resultType: "input_required", inputRequests, requestState }` instead
|
|
20
|
+
of a final result), while legacy clients keep the `initialize` handshake. The
|
|
21
|
+
required `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers are
|
|
22
|
+
validated against the body — never relax that check. Treat an incoming
|
|
23
|
+
`requestState` as attacker-controlled: sign it, bind it to the principal and
|
|
24
|
+
the originating request, and give it a short expiry before it influences
|
|
25
|
+
anything.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: daloyjs-best-practices
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Schema
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Build, test, and harden this DaloyJS REST API on Cloudflare Workers. Use
|
|
5
|
+
when the user asks to add or change an endpoint, route, Zod/Standard
|
|
6
|
+
Schema, middleware, error handling, Worker binding (KV, D1, R2, Queues,
|
|
7
|
+
env), contract gate, auth, or rate limit. Also use for phrasing like
|
|
8
|
+
"add GET /...", "new route", "wrangler", "fix the 401", or "add a KV
|
|
9
|
+
binding". Do not use for frontend UI, infra-only work, or unrelated
|
|
10
|
+
docs.
|
|
9
11
|
license: MIT
|
|
10
12
|
---
|
|
11
13
|
|
|
@@ -26,8 +28,15 @@ Use this skill when you need to:
|
|
|
26
28
|
- Change Worker bindings (KV, D1, R2, Queues, env vars) in `wrangler.toml`.
|
|
27
29
|
- Run tests/typecheck or deploy the Worker.
|
|
28
30
|
- Harden the API (auth, CORS, rate limits, secrets, dependency hygiene).
|
|
31
|
+
- User phrasing such as "add GET /books", "new endpoint", "add a KV
|
|
32
|
+
binding", or "fix the 401".
|
|
29
33
|
|
|
30
|
-
Do **not** use this skill for
|
|
34
|
+
Do **not** use this skill for frontend UI, infra-only work, or unrelated
|
|
35
|
+
docs. Rare topics live under `references/`: **read**
|
|
36
|
+
[references/mcp.md](references/mcp.md) only when adding an MCP endpoint,
|
|
37
|
+
and **read** [references/ci-workflows.md](references/ci-workflows.md) only
|
|
38
|
+
when editing `.github/` or a `--with-ci` workflow. Do not load those files
|
|
39
|
+
up front.
|
|
31
40
|
|
|
32
41
|
## Core principles
|
|
33
42
|
|
|
@@ -279,20 +288,9 @@ Aim for complete happy- and unhappy-path test coverage of the routes you add.
|
|
|
279
288
|
|
|
280
289
|
## CI and workflows (`--with-ci` scaffolds)
|
|
281
290
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
Those files carry the same weight as the secure defaults above — an agent
|
|
286
|
-
asked to "make CI pass" must not soften them.
|
|
287
|
-
|
|
288
|
-
- Keep every `uses:` pinned to a full commit SHA with its version comment. Never move an action to a tag or a branch, and never add an unpinned one.
|
|
289
|
-
- Keep `permissions: {}` at the top of each workflow and grant scopes per job. If a step needs more, give that one job the narrowest scope that works — never widen the workflow default.
|
|
290
|
-
- Keep `persist-credentials: false` on `actions/checkout` and keep package-manager caching off; a shared cache can bridge fork PRs into trusted branches.
|
|
291
|
-
- Keep installs running with lifecycle scripts disabled (`--ignore-scripts` / `npm_config_ignore_scripts`).
|
|
292
|
-
- `verify:lockfile`, `verify:runtime-eol`, the audit steps, the contract check, and the scanners are gates. When one fails, fix the finding — do not delete the step, add `continue-on-error`, or lower a severity threshold to go green.
|
|
293
|
-
- Keep `cooldown` in `.github/dependabot.yml` aligned with `minimum-release-age` in `.npmrc`. They are one 24h supply-chain policy expressed to two different tools; changing one alone silently defeats it.
|
|
294
|
-
- `dast.yml` boots this template's own start command. If you change how the app starts, update that workflow to match or the weekly scan will fail.
|
|
295
|
-
- Read `SECURITY.md` before deleting a workflow. On a private repository without GitHub Advanced Security some of them are _expected_ to be removed, and it lists exactly which.
|
|
291
|
+
Only when editing `.github/`, Dependabot, or a `--with-ci` workflow:
|
|
292
|
+
**read** [references/ci-workflows.md](references/ci-workflows.md) as
|
|
293
|
+
reference. Skip that file for ordinary route work.
|
|
296
294
|
|
|
297
295
|
## Logging & observability
|
|
298
296
|
|
|
@@ -343,26 +341,9 @@ asked to "make CI pass" must not soften them.
|
|
|
343
341
|
|
|
344
342
|
## Exposing this API over MCP
|
|
345
343
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
with `createMcpHandler({ tools, resources, prompts })` and mount it with
|
|
350
|
-
`mcpRoutes("/mcp", handler)`. Throw `McpToolError` for caller-correctable
|
|
351
|
-
tool failures. The handler ships protocol-level guards (body cap, UTF-8/JSON
|
|
352
|
-
validation, `Origin` checks against DNS rebinding) and composes with the
|
|
353
|
-
existing middleware chain — put `bearerAuth()` / `rateLimit()` in front of
|
|
354
|
-
it like any other route. See <https://daloyjs.dev/docs> for the MCP guide.
|
|
355
|
-
|
|
356
|
-
The handler speaks the stateless MCP `2026-07-28` revision and every earlier
|
|
357
|
-
one on the same endpoint: modern clients get `server/discover`, per-request
|
|
358
|
-
`_meta`, `resultType` results, caching hints, and multi round-trip requests
|
|
359
|
-
(return `{ resultType: "input_required", inputRequests, requestState }` instead
|
|
360
|
-
of a final result), while legacy clients keep the `initialize` handshake. The
|
|
361
|
-
required `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers are
|
|
362
|
-
validated against the body — never relax that check. Treat an incoming
|
|
363
|
-
`requestState` as attacker-controlled: sign it, bind it to the principal and
|
|
364
|
-
the originating request, and give it a short expiry before it influences
|
|
365
|
-
anything.
|
|
344
|
+
Only when adding or changing an MCP endpoint: **read**
|
|
345
|
+
[references/mcp.md](references/mcp.md) as reference (do not treat it as a
|
|
346
|
+
script to run). Skip that file for ordinary HTTP route work.
|
|
366
347
|
|
|
367
348
|
## More
|
|
368
349
|
|
package/templates/cloudflare-worker/_agents/skills/daloyjs-best-practices/references/ci-workflows.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# CI and workflows (`--with-ci` scaffolds)
|
|
2
|
+
|
|
3
|
+
**Read this file as reference** when editing `.github/`, Dependabot, or a
|
|
4
|
+
`--with-ci` workflow. Skip it unless the task touches CI.
|
|
5
|
+
|
|
6
|
+
If this project was scaffolded with `--with-ci`, `.github/` holds a hardened
|
|
7
|
+
GitHub Actions bundle alongside `CODEOWNERS`, `SECURITY.md`, and the
|
|
8
|
+
`verify:lockfile` / `verify:runtime-eol` scripts wired into `package.json`.
|
|
9
|
+
Those files carry the same weight as the secure defaults in `SKILL.md` — an
|
|
10
|
+
agent asked to "make CI pass" must not soften them.
|
|
11
|
+
|
|
12
|
+
- Keep every `uses:` pinned to a full commit SHA with its version comment. Never move an action to a tag or a branch, and never add an unpinned one.
|
|
13
|
+
- Keep `permissions: {}` at the top of each workflow and grant scopes per job. If a step needs more, give that one job the narrowest scope that works — never widen the workflow default.
|
|
14
|
+
- Keep `persist-credentials: false` on `actions/checkout` and keep package-manager caching off; a shared cache can bridge fork PRs into trusted branches.
|
|
15
|
+
- Keep installs running with lifecycle scripts disabled (`--ignore-scripts` / `npm_config_ignore_scripts`).
|
|
16
|
+
- `verify:lockfile`, `verify:runtime-eol`, the audit steps, the contract check, and the scanners are gates. When one fails, fix the finding — do not delete the step, add `continue-on-error`, or lower a severity threshold to go green.
|
|
17
|
+
- Keep `cooldown` in `.github/dependabot.yml` aligned with `minimum-release-age` in `.npmrc`. They are one 24h supply-chain policy expressed to two different tools; changing one alone silently defeats it.
|
|
18
|
+
- `dast.yml` boots this template's own start command. If you change how the app starts, update that workflow to match or the weekly scan will fail.
|
|
19
|
+
- Read `SECURITY.md` before deleting a workflow. On a private repository without GitHub Advanced Security some of them are _expected_ to be removed, and it lists exactly which.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Exposing this API over MCP
|
|
2
|
+
|
|
3
|
+
**Read this file as reference** when adding or changing an MCP endpoint. Do
|
|
4
|
+
not treat it as a script to run. Skip it for ordinary HTTP route work.
|
|
5
|
+
|
|
6
|
+
`@daloyjs/core` ships a dependency-free Model Context Protocol (Streamable
|
|
7
|
+
HTTP) server helper — also available from the `@daloyjs/core/mcp` subpath.
|
|
8
|
+
To expose selected capabilities to MCP clients (AI agents), build a handler
|
|
9
|
+
with `createMcpHandler({ tools, resources, prompts })` and mount it with
|
|
10
|
+
`mcpRoutes("/mcp", handler)`. Throw `McpToolError` for caller-correctable
|
|
11
|
+
tool failures. The handler ships protocol-level guards (body cap, UTF-8/JSON
|
|
12
|
+
validation, `Origin` checks against DNS rebinding) and composes with the
|
|
13
|
+
existing middleware chain — put `bearerAuth()` / `rateLimit()` in front of
|
|
14
|
+
it like any other route. See <https://daloyjs.dev/docs> for the MCP guide.
|
|
15
|
+
|
|
16
|
+
The handler speaks the stateless MCP `2026-07-28` revision and every earlier
|
|
17
|
+
one on the same endpoint: modern clients get `server/discover`, per-request
|
|
18
|
+
`_meta`, `resultType` results, caching hints, and multi round-trip requests
|
|
19
|
+
(return `{ resultType: "input_required", inputRequests, requestState }` instead
|
|
20
|
+
of a final result), while legacy clients keep the `initialize` handshake. The
|
|
21
|
+
required `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers are
|
|
22
|
+
validated against the body — never relax that check. Treat an incoming
|
|
23
|
+
`requestState` as attacker-controlled: sign it, bind it to the principal and
|
|
24
|
+
the originating request, and give it a short expiry before it influences
|
|
25
|
+
anything.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: daloyjs-best-practices
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
Build, test, and harden this DaloyJS REST API on Deno. Use when the user
|
|
5
|
+
asks to add or change an endpoint, route, Zod/Standard Schema,
|
|
6
|
+
middleware, error handling, OpenAPI spec, contract gate, Deno
|
|
7
|
+
permission, deno.json import, auth, or rate limit. Also use for phrasing
|
|
8
|
+
like "add GET /...", "new route", "deno task", "fix the 401", or "allow
|
|
9
|
+
net". Do not use for frontend UI, npm/pnpm package.json work, or
|
|
10
|
+
unrelated docs.
|
|
10
11
|
license: MIT
|
|
11
12
|
---
|
|
12
13
|
|
|
@@ -27,8 +28,15 @@ Use this skill when you need to:
|
|
|
27
28
|
- Wire up new middleware, validation, or error handling.
|
|
28
29
|
- Add or update tests, run typecheck, or build the project.
|
|
29
30
|
- Harden the API (auth, CORS, rate limits, permissions, secrets).
|
|
31
|
+
- User phrasing such as "add GET /books", "new endpoint", "deno task", or
|
|
32
|
+
"fix the 401".
|
|
30
33
|
|
|
31
|
-
Do **not** use this skill for
|
|
34
|
+
Do **not** use this skill for frontend UI, npm/pnpm `package.json` work,
|
|
35
|
+
or unrelated docs. Rare topics live under `references/`: **read**
|
|
36
|
+
[references/mcp.md](references/mcp.md) only when adding an MCP endpoint,
|
|
37
|
+
and **read** [references/ci-workflows.md](references/ci-workflows.md) only
|
|
38
|
+
when editing `.github/` or a `--with-ci` workflow. Do not load those files
|
|
39
|
+
up front.
|
|
32
40
|
|
|
33
41
|
## Core principles
|
|
34
42
|
|
|
@@ -274,18 +282,9 @@ Aim for complete happy- and unhappy-path test coverage of the routes you add.
|
|
|
274
282
|
|
|
275
283
|
## CI and workflows (`--with-ci` scaffolds)
|
|
276
284
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
weight as the secure defaults above — an agent asked to "make CI pass" must
|
|
281
|
-
not soften them.
|
|
282
|
-
|
|
283
|
-
- Keep every `uses:` pinned to a full commit SHA with its version comment. Never move an action to a tag or a branch, and never add an unpinned one.
|
|
284
|
-
- Keep `permissions: {}` at the top of each workflow and grant scopes per job. If a step needs more, give that one job the narrowest scope that works — never widen the workflow default.
|
|
285
|
-
- Keep `persist-credentials: false` on `actions/checkout` and keep caching off; a shared cache can bridge fork PRs into trusted branches.
|
|
286
|
-
- `deno.lock` is committed and CI installs with `deno install --frozen=true`. Deno ships no `audit` command, so the lockfile is this project's integrity anchor: when a dependency changes, update it deliberately with `deno install` and commit the result. Never drop `--frozen` to make CI pass.
|
|
287
|
-
- `verify:runtime-eol`, the contract check, and the scanners are gates. When one fails, fix the finding — do not delete the step, add `continue-on-error`, or lower a severity threshold to go green.
|
|
288
|
-
- Read `SECURITY.md` before deleting a workflow. On a private repository without GitHub Advanced Security, some of them are _expected_ to be removed, and it lists exactly which.
|
|
285
|
+
Only when editing `.github/` or a `--with-ci` workflow: **read**
|
|
286
|
+
[references/ci-workflows.md](references/ci-workflows.md) as reference.
|
|
287
|
+
Skip that file for ordinary route work.
|
|
289
288
|
|
|
290
289
|
## Logging & observability
|
|
291
290
|
|
|
@@ -330,26 +329,9 @@ not soften them.
|
|
|
330
329
|
|
|
331
330
|
## Exposing this API over MCP
|
|
332
331
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
with `createMcpHandler({ tools, resources, prompts })` and mount it with
|
|
337
|
-
`mcpRoutes("/mcp", handler)`. Throw `McpToolError` for caller-correctable
|
|
338
|
-
tool failures. The handler ships protocol-level guards (body cap, UTF-8/JSON
|
|
339
|
-
validation, `Origin` checks against DNS rebinding) and composes with the
|
|
340
|
-
existing middleware chain — put `bearerAuth()` / `rateLimit()` in front of
|
|
341
|
-
it like any other route. See <https://daloyjs.dev/docs> for the MCP guide.
|
|
342
|
-
|
|
343
|
-
The handler speaks the stateless MCP `2026-07-28` revision and every earlier
|
|
344
|
-
one on the same endpoint: modern clients get `server/discover`, per-request
|
|
345
|
-
`_meta`, `resultType` results, caching hints, and multi round-trip requests
|
|
346
|
-
(return `{ resultType: "input_required", inputRequests, requestState }` instead
|
|
347
|
-
of a final result), while legacy clients keep the `initialize` handshake. The
|
|
348
|
-
required `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers are
|
|
349
|
-
validated against the body — never relax that check. Treat an incoming
|
|
350
|
-
`requestState` as attacker-controlled: sign it, bind it to the principal and
|
|
351
|
-
the originating request, and give it a short expiry before it influences
|
|
352
|
-
anything.
|
|
332
|
+
Only when adding or changing an MCP endpoint: **read**
|
|
333
|
+
[references/mcp.md](references/mcp.md) as reference (do not treat it as a
|
|
334
|
+
script to run). Skip that file for ordinary HTTP route work.
|
|
353
335
|
|
|
354
336
|
## More
|
|
355
337
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# CI and workflows (`--with-ci` scaffolds)
|
|
2
|
+
|
|
3
|
+
**Read this file as reference** when editing `.github/` or a `--with-ci`
|
|
4
|
+
workflow. Skip it unless the task touches CI.
|
|
5
|
+
|
|
6
|
+
If this project was scaffolded with `--with-ci`, `.github/` holds a hardened
|
|
7
|
+
GitHub Actions bundle alongside `CODEOWNERS`, `SECURITY.md`, and a
|
|
8
|
+
`verify:runtime-eol` task added to `deno.json`. Those files carry the same
|
|
9
|
+
weight as the secure defaults in `SKILL.md` — an agent asked to "make CI
|
|
10
|
+
pass" must not soften them.
|
|
11
|
+
|
|
12
|
+
- Keep every `uses:` pinned to a full commit SHA with its version comment. Never move an action to a tag or a branch, and never add an unpinned one.
|
|
13
|
+
- Keep `permissions: {}` at the top of each workflow and grant scopes per job. If a step needs more, give that one job the narrowest scope that works — never widen the workflow default.
|
|
14
|
+
- Keep `persist-credentials: false` on `actions/checkout` and keep caching off; a shared cache can bridge fork PRs into trusted branches.
|
|
15
|
+
- `deno.lock` is committed and CI installs with `deno install --frozen=true`. Deno ships no `audit` command, so the lockfile is this project's integrity anchor: when a dependency changes, update it deliberately with `deno install` and commit the result. Never drop `--frozen` to make CI pass.
|
|
16
|
+
- `verify:runtime-eol`, the contract check, and the scanners are gates. When one fails, fix the finding — do not delete the step, add `continue-on-error`, or lower a severity threshold to go green.
|
|
17
|
+
- Read `SECURITY.md` before deleting a workflow. On a private repository without GitHub Advanced Security, some of them are _expected_ to be removed, and it lists exactly which.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Exposing this API over MCP
|
|
2
|
+
|
|
3
|
+
**Read this file as reference** when adding or changing an MCP endpoint. Do
|
|
4
|
+
not treat it as a script to run. Skip it for ordinary HTTP route work.
|
|
5
|
+
|
|
6
|
+
`@daloyjs/core` ships a dependency-free Model Context Protocol (Streamable
|
|
7
|
+
HTTP) server helper — also available from the `@daloyjs/core/mcp` subpath.
|
|
8
|
+
To expose selected capabilities to MCP clients (AI agents), build a handler
|
|
9
|
+
with `createMcpHandler({ tools, resources, prompts })` and mount it with
|
|
10
|
+
`mcpRoutes("/mcp", handler)`. Throw `McpToolError` for caller-correctable
|
|
11
|
+
tool failures. The handler ships protocol-level guards (body cap, UTF-8/JSON
|
|
12
|
+
validation, `Origin` checks against DNS rebinding) and composes with the
|
|
13
|
+
existing middleware chain — put `bearerAuth()` / `rateLimit()` in front of
|
|
14
|
+
it like any other route. See <https://daloyjs.dev/docs> for the MCP guide.
|
|
15
|
+
|
|
16
|
+
The handler speaks the stateless MCP `2026-07-28` revision and every earlier
|
|
17
|
+
one on the same endpoint: modern clients get `server/discover`, per-request
|
|
18
|
+
`_meta`, `resultType` results, caching hints, and multi round-trip requests
|
|
19
|
+
(return `{ resultType: "input_required", inputRequests, requestState }` instead
|
|
20
|
+
of a final result), while legacy clients keep the `initialize` handshake. The
|
|
21
|
+
required `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers are
|
|
22
|
+
validated against the body — never relax that check. Treat an incoming
|
|
23
|
+
`requestState` as attacker-controlled: sign it, bind it to the principal and
|
|
24
|
+
the originating request, and give it a short expiry before it influences
|
|
25
|
+
anything.
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"hooks:install": "git config core.hooksPath .githooks"
|
|
11
11
|
},
|
|
12
12
|
"imports": {
|
|
13
|
-
"@daloyjs/core": "jsr:@daloyjs/daloy@^1.
|
|
14
|
-
"@daloyjs/core/banner": "jsr:@daloyjs/daloy@^1.
|
|
15
|
-
"@daloyjs/core/contract": "jsr:@daloyjs/daloy@^1.
|
|
16
|
-
"@daloyjs/core/deno": "jsr:@daloyjs/daloy@^1.
|
|
17
|
-
"@daloyjs/core/openapi": "jsr:@daloyjs/daloy@^1.
|
|
13
|
+
"@daloyjs/core": "jsr:@daloyjs/daloy@^1.2.0",
|
|
14
|
+
"@daloyjs/core/banner": "jsr:@daloyjs/daloy@^1.2.0/banner",
|
|
15
|
+
"@daloyjs/core/contract": "jsr:@daloyjs/daloy@^1.2.0/contract",
|
|
16
|
+
"@daloyjs/core/deno": "jsr:@daloyjs/daloy@^1.2.0/deno",
|
|
17
|
+
"@daloyjs/core/openapi": "jsr:@daloyjs/daloy@^1.2.0/openapi",
|
|
18
18
|
"zod": "npm:zod@^4.4.3"
|
|
19
19
|
},
|
|
20
20
|
"compilerOptions": {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: daloyjs-best-practices
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Build, test, and harden this DaloyJS REST API on Node.js. Use when the
|
|
5
|
+
user asks to add or change an endpoint, route, Zod/Standard Schema,
|
|
6
|
+
middleware, error handling, OpenAPI spec, typed Hey API client, contract
|
|
7
|
+
gate, auth, rate limit, or security default. Also use for phrasing like
|
|
8
|
+
"add GET /...", "new route", "regenerate the client", or "fix the 401".
|
|
9
|
+
Do not use for frontend UI, infra-only work, or unrelated docs.
|
|
9
10
|
license: MIT
|
|
10
11
|
---
|
|
11
12
|
|
|
@@ -25,9 +26,15 @@ Use this skill when you need to:
|
|
|
25
26
|
- Wire up new middleware, validation, or error handling.
|
|
26
27
|
- Add or update tests, run typecheck, or build the project.
|
|
27
28
|
- Harden the API (auth, CORS, rate limits, secrets, dependency hygiene).
|
|
29
|
+
- User phrasing such as "add GET /books", "new endpoint", "regenerate the
|
|
30
|
+
client", or "fix the 401".
|
|
28
31
|
|
|
29
|
-
Do **not** use this skill for
|
|
30
|
-
|
|
32
|
+
Do **not** use this skill for frontend UI, infra-only work, or unrelated
|
|
33
|
+
docs. Rare topics live under `references/`: **read**
|
|
34
|
+
[references/mcp.md](references/mcp.md) only when adding an MCP endpoint,
|
|
35
|
+
and **read** [references/ci-workflows.md](references/ci-workflows.md) only
|
|
36
|
+
when editing `.github/` or a `--with-ci` workflow. Do not load those files
|
|
37
|
+
up front.
|
|
31
38
|
|
|
32
39
|
## Core principles
|
|
33
40
|
|
|
@@ -336,20 +343,9 @@ honor them.
|
|
|
336
343
|
|
|
337
344
|
## CI and workflows (`--with-ci` scaffolds)
|
|
338
345
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
Those files carry the same weight as the secure defaults above — an agent
|
|
343
|
-
asked to "make CI pass" must not soften them.
|
|
344
|
-
|
|
345
|
-
- Keep every `uses:` pinned to a full commit SHA with its version comment. Never move an action to a tag or a branch, and never add an unpinned one.
|
|
346
|
-
- Keep `permissions: {}` at the top of each workflow and grant scopes per job. If a step needs more, give that one job the narrowest scope that works — never widen the workflow default.
|
|
347
|
-
- Keep `persist-credentials: false` on `actions/checkout` and keep package-manager caching off; a shared cache can bridge fork PRs into trusted branches.
|
|
348
|
-
- Keep installs running with lifecycle scripts disabled (`--ignore-scripts` / `npm_config_ignore_scripts`).
|
|
349
|
-
- `verify:lockfile`, `verify:runtime-eol`, the audit steps, the contract check, and the scanners are gates. When one fails, fix the finding — do not delete the step, add `continue-on-error`, or lower a severity threshold to go green.
|
|
350
|
-
- Keep `cooldown` in `.github/dependabot.yml` aligned with `minimum-release-age` in `.npmrc`. They are one 24h supply-chain policy expressed to two different tools; changing one alone silently defeats it.
|
|
351
|
-
- `dast.yml` boots this template's own start command. If you change how the app starts, update that workflow to match or the weekly scan will fail.
|
|
352
|
-
- Read `SECURITY.md` before deleting a workflow. On a private repository without GitHub Advanced Security some of them are _expected_ to be removed, and it lists exactly which.
|
|
346
|
+
Only when editing `.github/`, Dependabot, or a `--with-ci` workflow:
|
|
347
|
+
**read** [references/ci-workflows.md](references/ci-workflows.md) as
|
|
348
|
+
reference. Skip that file for ordinary route work.
|
|
353
349
|
|
|
354
350
|
## Logging & observability
|
|
355
351
|
|
|
@@ -410,26 +406,9 @@ asked to "make CI pass" must not soften them.
|
|
|
410
406
|
|
|
411
407
|
## Exposing this API over MCP
|
|
412
408
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
with `createMcpHandler({ tools, resources, prompts })` and mount it with
|
|
417
|
-
`mcpRoutes("/mcp", handler)`. Throw `McpToolError` for caller-correctable
|
|
418
|
-
tool failures. The handler ships protocol-level guards (body cap, UTF-8/JSON
|
|
419
|
-
validation, `Origin` checks against DNS rebinding) and composes with the
|
|
420
|
-
existing middleware chain — put `bearerAuth()` / `rateLimit()` in front of
|
|
421
|
-
it like any other route. See <https://daloyjs.dev/docs> for the MCP guide.
|
|
422
|
-
|
|
423
|
-
The handler speaks the stateless MCP `2026-07-28` revision and every earlier
|
|
424
|
-
one on the same endpoint: modern clients get `server/discover`, per-request
|
|
425
|
-
`_meta`, `resultType` results, caching hints, and multi round-trip requests
|
|
426
|
-
(return `{ resultType: "input_required", inputRequests, requestState }` instead
|
|
427
|
-
of a final result), while legacy clients keep the `initialize` handshake. The
|
|
428
|
-
required `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers are
|
|
429
|
-
validated against the body — never relax that check. Treat an incoming
|
|
430
|
-
`requestState` as attacker-controlled: sign it, bind it to the principal and
|
|
431
|
-
the originating request, and give it a short expiry before it influences
|
|
432
|
-
anything.
|
|
409
|
+
Only when adding or changing an MCP endpoint: **read**
|
|
410
|
+
[references/mcp.md](references/mcp.md) as reference (do not treat it as a
|
|
411
|
+
script to run). Skip that file for ordinary HTTP route work.
|
|
433
412
|
|
|
434
413
|
## More
|
|
435
414
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# CI and workflows (`--with-ci` scaffolds)
|
|
2
|
+
|
|
3
|
+
**Read this file as reference** when editing `.github/`, Dependabot, or a
|
|
4
|
+
`--with-ci` workflow. Skip it unless the task touches CI.
|
|
5
|
+
|
|
6
|
+
If this project was scaffolded with `--with-ci`, `.github/` holds a hardened
|
|
7
|
+
GitHub Actions bundle alongside `CODEOWNERS`, `SECURITY.md`, and the
|
|
8
|
+
`verify:lockfile` / `verify:runtime-eol` scripts wired into `package.json`.
|
|
9
|
+
Those files carry the same weight as the secure defaults in `SKILL.md` — an
|
|
10
|
+
agent asked to "make CI pass" must not soften them.
|
|
11
|
+
|
|
12
|
+
- Keep every `uses:` pinned to a full commit SHA with its version comment. Never move an action to a tag or a branch, and never add an unpinned one.
|
|
13
|
+
- Keep `permissions: {}` at the top of each workflow and grant scopes per job. If a step needs more, give that one job the narrowest scope that works — never widen the workflow default.
|
|
14
|
+
- Keep `persist-credentials: false` on `actions/checkout` and keep package-manager caching off; a shared cache can bridge fork PRs into trusted branches.
|
|
15
|
+
- Keep installs running with lifecycle scripts disabled (`--ignore-scripts` / `npm_config_ignore_scripts`).
|
|
16
|
+
- `verify:lockfile`, `verify:runtime-eol`, the audit steps, the contract check, and the scanners are gates. When one fails, fix the finding — do not delete the step, add `continue-on-error`, or lower a severity threshold to go green.
|
|
17
|
+
- Keep `cooldown` in `.github/dependabot.yml` aligned with `minimum-release-age` in `.npmrc`. They are one 24h supply-chain policy expressed to two different tools; changing one alone silently defeats it.
|
|
18
|
+
- `dast.yml` boots this template's own start command. If you change how the app starts, update that workflow to match or the weekly scan will fail.
|
|
19
|
+
- Read `SECURITY.md` before deleting a workflow. On a private repository without GitHub Advanced Security some of them are _expected_ to be removed, and it lists exactly which.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Exposing this API over MCP
|
|
2
|
+
|
|
3
|
+
**Read this file as reference** when adding or changing an MCP endpoint. Do
|
|
4
|
+
not treat it as a script to run. Skip it for ordinary HTTP route work.
|
|
5
|
+
|
|
6
|
+
`@daloyjs/core` ships a dependency-free Model Context Protocol (Streamable
|
|
7
|
+
HTTP) server helper — also available from the `@daloyjs/core/mcp` subpath.
|
|
8
|
+
To expose selected capabilities to MCP clients (AI agents), build a handler
|
|
9
|
+
with `createMcpHandler({ tools, resources, prompts })` and mount it with
|
|
10
|
+
`mcpRoutes("/mcp", handler)`. Throw `McpToolError` for caller-correctable
|
|
11
|
+
tool failures. The handler ships protocol-level guards (body cap, UTF-8/JSON
|
|
12
|
+
validation, `Origin` checks against DNS rebinding) and composes with the
|
|
13
|
+
existing middleware chain — put `bearerAuth()` / `rateLimit()` in front of
|
|
14
|
+
it like any other route. See <https://daloyjs.dev/docs> for the MCP guide.
|
|
15
|
+
|
|
16
|
+
The handler speaks the stateless MCP `2026-07-28` revision and every earlier
|
|
17
|
+
one on the same endpoint: modern clients get `server/discover`, per-request
|
|
18
|
+
`_meta`, `resultType` results, caching hints, and multi round-trip requests
|
|
19
|
+
(return `{ resultType: "input_required", inputRequests, requestState }` instead
|
|
20
|
+
of a final result), while legacy clients keep the `initialize` handshake. The
|
|
21
|
+
required `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers are
|
|
22
|
+
validated against the body — never relax that check. Treat an incoming
|
|
23
|
+
`requestState` as attacker-controlled: sign it, bind it to the principal and
|
|
24
|
+
the originating request, and give it a short expiry before it influences
|
|
25
|
+
anything.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: daloyjs-best-practices
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Zod/Standard Schema
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
Build, test, and harden this DaloyJS REST API on Vercel (Node.js
|
|
5
|
+
runtime). Use when the user asks to add or change an endpoint, route,
|
|
6
|
+
Zod/Standard Schema, middleware, error handling, OpenAPI spec, typed
|
|
7
|
+
client, contract gate, auth, rate limit, or the single Functions
|
|
8
|
+
entrypoint / rewrite. Also use for phrasing like "add GET /...", "new
|
|
9
|
+
route", "fix the 401", or "deploy this API". Do not use for Next.js App
|
|
10
|
+
Router work, frontend UI, or unrelated docs.
|
|
10
11
|
license: MIT
|
|
11
12
|
---
|
|
12
13
|
|
|
@@ -27,8 +28,14 @@ Use this skill when you need to:
|
|
|
27
28
|
- Run tests or typecheck the project.
|
|
28
29
|
- Deploy or troubleshoot the Vercel Functions entrypoint.
|
|
29
30
|
- Harden the API (auth, CORS, rate limits, secrets, dependency hygiene).
|
|
31
|
+
- User phrasing such as "add GET /books", "new endpoint", or "fix the 401".
|
|
30
32
|
|
|
31
|
-
Do **not** use this skill for
|
|
33
|
+
Do **not** use this skill for Next.js App Router work, frontend UI, or
|
|
34
|
+
unrelated docs. Rare topics live under `references/`: **read**
|
|
35
|
+
[references/mcp.md](references/mcp.md) only when adding an MCP endpoint,
|
|
36
|
+
and **read** [references/ci-workflows.md](references/ci-workflows.md) only
|
|
37
|
+
when editing `.github/` or a `--with-ci` workflow. Do not load those files
|
|
38
|
+
up front.
|
|
32
39
|
|
|
33
40
|
## Core principles
|
|
34
41
|
|
|
@@ -265,20 +272,9 @@ Aim for complete happy- and unhappy-path test coverage of the routes you add.
|
|
|
265
272
|
|
|
266
273
|
## CI and workflows (`--with-ci` scaffolds)
|
|
267
274
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
Those files carry the same weight as the secure defaults above — an agent
|
|
272
|
-
asked to "make CI pass" must not soften them.
|
|
273
|
-
|
|
274
|
-
- Keep every `uses:` pinned to a full commit SHA with its version comment. Never move an action to a tag or a branch, and never add an unpinned one.
|
|
275
|
-
- Keep `permissions: {}` at the top of each workflow and grant scopes per job. If a step needs more, give that one job the narrowest scope that works — never widen the workflow default.
|
|
276
|
-
- Keep `persist-credentials: false` on `actions/checkout` and keep package-manager caching off; a shared cache can bridge fork PRs into trusted branches.
|
|
277
|
-
- Keep installs running with lifecycle scripts disabled (`--ignore-scripts` / `npm_config_ignore_scripts`).
|
|
278
|
-
- `verify:lockfile`, `verify:runtime-eol`, the audit steps, the contract check, and the scanners are gates. When one fails, fix the finding — do not delete the step, add `continue-on-error`, or lower a severity threshold to go green.
|
|
279
|
-
- Keep `cooldown` in `.github/dependabot.yml` aligned with `minimum-release-age` in `.npmrc`. They are one 24h supply-chain policy expressed to two different tools; changing one alone silently defeats it.
|
|
280
|
-
- `dast.yml` boots this template's own start command. If you change how the app starts, update that workflow to match or the weekly scan will fail.
|
|
281
|
-
- Read `SECURITY.md` before deleting a workflow. On a private repository without GitHub Advanced Security some of them are _expected_ to be removed, and it lists exactly which.
|
|
275
|
+
Only when editing `.github/`, Dependabot, or a `--with-ci` workflow:
|
|
276
|
+
**read** [references/ci-workflows.md](references/ci-workflows.md) as
|
|
277
|
+
reference. Skip that file for ordinary route work.
|
|
282
278
|
|
|
283
279
|
## Logging & observability
|
|
284
280
|
|
|
@@ -330,26 +326,9 @@ asked to "make CI pass" must not soften them.
|
|
|
330
326
|
|
|
331
327
|
## Exposing this API over MCP
|
|
332
328
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
with `createMcpHandler({ tools, resources, prompts })` and mount it with
|
|
337
|
-
`mcpRoutes("/mcp", handler)`. Throw `McpToolError` for caller-correctable
|
|
338
|
-
tool failures. The handler ships protocol-level guards (body cap, UTF-8/JSON
|
|
339
|
-
validation, `Origin` checks against DNS rebinding) and composes with the
|
|
340
|
-
existing middleware chain — put `bearerAuth()` / `rateLimit()` in front of
|
|
341
|
-
it like any other route. See <https://daloyjs.dev/docs> for the MCP guide.
|
|
342
|
-
|
|
343
|
-
The handler speaks the stateless MCP `2026-07-28` revision and every earlier
|
|
344
|
-
one on the same endpoint: modern clients get `server/discover`, per-request
|
|
345
|
-
`_meta`, `resultType` results, caching hints, and multi round-trip requests
|
|
346
|
-
(return `{ resultType: "input_required", inputRequests, requestState }` instead
|
|
347
|
-
of a final result), while legacy clients keep the `initialize` handshake. The
|
|
348
|
-
required `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers are
|
|
349
|
-
validated against the body — never relax that check. Treat an incoming
|
|
350
|
-
`requestState` as attacker-controlled: sign it, bind it to the principal and
|
|
351
|
-
the originating request, and give it a short expiry before it influences
|
|
352
|
-
anything.
|
|
329
|
+
Only when adding or changing an MCP endpoint: **read**
|
|
330
|
+
[references/mcp.md](references/mcp.md) as reference (do not treat it as a
|
|
331
|
+
script to run). Skip that file for ordinary HTTP route work.
|
|
353
332
|
|
|
354
333
|
## More
|
|
355
334
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# CI and workflows (`--with-ci` scaffolds)
|
|
2
|
+
|
|
3
|
+
**Read this file as reference** when editing `.github/`, Dependabot, or a
|
|
4
|
+
`--with-ci` workflow. Skip it unless the task touches CI.
|
|
5
|
+
|
|
6
|
+
If this project was scaffolded with `--with-ci`, `.github/` holds a hardened
|
|
7
|
+
GitHub Actions bundle alongside `CODEOWNERS`, `SECURITY.md`, and the
|
|
8
|
+
`verify:lockfile` / `verify:runtime-eol` scripts wired into `package.json`.
|
|
9
|
+
Those files carry the same weight as the secure defaults in `SKILL.md` — an
|
|
10
|
+
agent asked to "make CI pass" must not soften them.
|
|
11
|
+
|
|
12
|
+
- Keep every `uses:` pinned to a full commit SHA with its version comment. Never move an action to a tag or a branch, and never add an unpinned one.
|
|
13
|
+
- Keep `permissions: {}` at the top of each workflow and grant scopes per job. If a step needs more, give that one job the narrowest scope that works — never widen the workflow default.
|
|
14
|
+
- Keep `persist-credentials: false` on `actions/checkout` and keep package-manager caching off; a shared cache can bridge fork PRs into trusted branches.
|
|
15
|
+
- Keep installs running with lifecycle scripts disabled (`--ignore-scripts` / `npm_config_ignore_scripts`).
|
|
16
|
+
- `verify:lockfile`, `verify:runtime-eol`, the audit steps, the contract check, and the scanners are gates. When one fails, fix the finding — do not delete the step, add `continue-on-error`, or lower a severity threshold to go green.
|
|
17
|
+
- Keep `cooldown` in `.github/dependabot.yml` aligned with `minimum-release-age` in `.npmrc`. They are one 24h supply-chain policy expressed to two different tools; changing one alone silently defeats it.
|
|
18
|
+
- `dast.yml` boots this template's own start command. If you change how the app starts, update that workflow to match or the weekly scan will fail.
|
|
19
|
+
- Read `SECURITY.md` before deleting a workflow. On a private repository without GitHub Advanced Security some of them are _expected_ to be removed, and it lists exactly which.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Exposing this API over MCP
|
|
2
|
+
|
|
3
|
+
**Read this file as reference** when adding or changing an MCP endpoint. Do
|
|
4
|
+
not treat it as a script to run. Skip it for ordinary HTTP route work.
|
|
5
|
+
|
|
6
|
+
`@daloyjs/core` ships a dependency-free Model Context Protocol (Streamable
|
|
7
|
+
HTTP) server helper — also available from the `@daloyjs/core/mcp` subpath.
|
|
8
|
+
To expose selected capabilities to MCP clients (AI agents), build a handler
|
|
9
|
+
with `createMcpHandler({ tools, resources, prompts })` and mount it with
|
|
10
|
+
`mcpRoutes("/mcp", handler)`. Throw `McpToolError` for caller-correctable
|
|
11
|
+
tool failures. The handler ships protocol-level guards (body cap, UTF-8/JSON
|
|
12
|
+
validation, `Origin` checks against DNS rebinding) and composes with the
|
|
13
|
+
existing middleware chain — put `bearerAuth()` / `rateLimit()` in front of
|
|
14
|
+
it like any other route. See <https://daloyjs.dev/docs> for the MCP guide.
|
|
15
|
+
|
|
16
|
+
The handler speaks the stateless MCP `2026-07-28` revision and every earlier
|
|
17
|
+
one on the same endpoint: modern clients get `server/discover`, per-request
|
|
18
|
+
`_meta`, `resultType` results, caching hints, and multi round-trip requests
|
|
19
|
+
(return `{ resultType: "input_required", inputRequests, requestState }` instead
|
|
20
|
+
of a final result), while legacy clients keep the `initialize` handshake. The
|
|
21
|
+
required `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers are
|
|
22
|
+
validated against the body — never relax that check. Treat an incoming
|
|
23
|
+
`requestState` as attacker-controlled: sign it, bind it to the principal and
|
|
24
|
+
the originating request, and give it a short expiry before it influences
|
|
25
|
+
anything.
|