[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79GGD94Z0WM4CXT35ZVJ788":3,"skill-same:01M79GGD94Z0WM4CXT35ZVJ788":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M79GGD94Z0WM4CXT35ZVJ788","saasaloy-api-keys",null,"Runbook for the api-keys capability, which gives a machine caller a bearer credential owned by an organization (api-keys-organization) or by one user (api-keys-user). Use when picking or switching the owner, issuing or revoking a key, calling the api from a script or a pipeline, editing the key vocabulary in API_KEY_SCOPES, gating a route with requireCaller and requireScope, working on the bearer resolver or the scope guard, or removing either module.","mimukit\u002Fsaasaloy","mimukit","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F11677026?v=4","01M79GFSERAQQ77QPQMC1N0Y6M","Mukitul Islam Mukit","01M79GFSFA4WMGEEBHA68N59WV",4,"MIT","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fmodules\u002Fapi-keys\u002Fskills\u002Fsaasaloy-api-keys\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: saasaloy-api-keys\ndescription: Runbook for the api-keys capability, which gives a machine caller a bearer credential owned by an organization (api-keys-organization) or by one user (api-keys-user). Use when picking or switching the owner, issuing or revoking a key, calling the api from a script or a pipeline, editing the key vocabulary in API_KEY_SCOPES, gating a route with requireCaller and requireScope, working on the bearer resolver or the scope guard, or removing either module.\n---\n\n# api-keys\n\n`api-keys` gives a caller with no cookie a credential it presents as `Authorization: Bearer sk_…`. Who owns a key is a choice the project makes once, at `add` time, the way it picks a database driver (ADR 0055):\n\n| Owner module | A key belongs to | Pulls in | Route gate |\n| --- | --- | --- | --- |\n| `api-keys-organization` | one organization | `multitenant`, `teams`, `admin` | `requireTenant` \u002F `requirePermission` from `@repo\u002Fauth\u002Ftenant` and `@repo\u002Fauth\u002Fpermissions` |\n| `api-keys-user` | one user | `auth` only | `requireCaller` \u002F `requireScope` from `@repo\u002Fauth\u002Fcaller` |\n\n## What the core holds and what each owner holds\n\nThe core, `api-keys`, holds what both owners share:\n\n- the `@better-auth\u002Fapi-key` line in `packages\u002Fauth\u002Fpackage.json`;\n- `packages\u002Fauth\u002Fsrc\u002Fplugins\u002Fapi-key-client.ts` and its patches into `authClientPlugins` and `adminAuthClientPlugins` in `client.ts`;\n- the four `plugin-array` patches into `auth.ts` that call `apiKeyPlugin()` and `apiKeyScopeGuard()` on both instances, `auth` and `adminAuth` (ADR 0050);\n- `packages\u002Fauth\u002Fsrc\u002Fplugins\u002Fapi-key-options.ts`: the shared plugin options (`API_KEY_OPTIONS`), `GUARDED_PATHS`, `scopeOf`, the bearer parsing (`hasBearer`, `bearerKey`) and `INVALID_API_KEY`;\n- this skill.\n\nEach owner ships `packages\u002Fauth\u002Fsrc\u002Fplugins\u002Fapi-key.ts` at the same path, so the `auth.ts` import line is the same in both modes. The owner's file adds `references` and the `schema.apikey` rename to the shared options, and it holds that owner's `apiKeyScopeGuard()`. Each owner also ships `packages\u002Fdb\u002Fsrc\u002Fschema\u002Fapi-keys.ts`, with `organization_id` or `user_id` as the owner column.\n\n- `api-keys-organization` adds `packages\u002Fauth\u002Fsrc\u002Fresolvers\u002Fapi-key.ts` (the bearer resolver, patched into `multitenant`'s `tenantResolvers`), the `\u002Fapi-keys` screen in `apps\u002Fadmin`, and its `NAV_ITEMS` entry.\n- `api-keys-user` adds `packages\u002Fauth\u002Fsrc\u002Fcaller.ts` (`requireCaller`, `requireScope`), `packages\u002Fauth\u002Fsrc\u002Fapi-key-rules.ts` (the import-free rules `scopeDenial`, `keyAllows` and `ownerMayUseKeys`), and `packages\u002Fauth\u002Fsrc\u002Fapi-key-scopes.ts` (the key vocabulary). It has no screen. Its one patch puts `apiKeyAdminGuard()` into `adminAuth.plugins`.\n\n## Picking an owner\n\nName the owner, and its `dependsOn` pulls the core in:\n\n```sh\nsaasaloy add api-keys-organization   # or: saasaloy add api-keys-user\n```\n\nA bare `saasaloy add api-keys` on a terminal asks `api-keys needs one of these — pick one`. With no terminal, it refuses with exit 2 and names both options:\n\n```\nCannot add api-keys — unmet requirement:\n  api-keys needs one of: api-keys-organization, api-keys-user, and none is installed. Run `saasaloy add api-keys-organization` first, or pick another from that list.\n```\n\n`--yes` does not answer this question. It means \"do not ask me\", not \"pick an owner for me\", so `add api-keys --yes` refuses the same way. Name the owner module instead.\n\nThe two owners name each other in `conflictsWith`, so `add` refuses the second one while the first is installed.\n\nPick `api-keys-organization` when the project already has organizations and roles. Pick `api-keys-user` when a key acts for one person and the project has no organizations to carry.\n\n## Calling the api with a key\n\nOne header, and in both modes the routes do not change:\n\n```sh\ncurl -s -H \"Authorization: Bearer sk_a1b2c3...\" https:\u002F\u002Fapi.example.com\u002Fprojects\n```\n\nThe bearer rule is the same in both modes, because both read `hasBearer` and `bearerKey` from `api-key-options.ts`:\n\n- A bearer header is claimed first. A request that carries both a key and a cookie is answered as a key request.\n- A claimed request never falls back to the cookie. A revoked key sent from a signed-in browser gets 401, not the browser user's access.\n- Every failure is 401 `invalid api key`: no key after `Bearer`, not found, revoked, disabled, expired, or a hash that matches nothing. The message is the same on purpose. \"That key exists but is expired\" tells the caller the key exists.\n\n## Organization mode (`api-keys-organization`)\n\nA key belongs to one organization and resolves the same `Tenant` a cookie does, through `apiKeyTenant` in `multitenant`'s `tenantResolvers` table. `GET \u002Ftenant` shows what the server made of a key:\n\n```sh\ncurl -s -H \"Authorization: Bearer $KEY\" https:\u002F\u002Fapi.example.com\u002Ftenant\n# { \"organizationId\": \"org_…\", \"principal\": { \"kind\": \"apiKey\", \"keyId\": \"…\", \"statements\": { \"project\": [\"read\"] } } }\n```\n\n`x-organization-id` beside a bearer header is 403 `forbidden` whatever it says. A key is bound to one organization; the superadmin bypass is a cookie-path power, and it needs the admin session.\n\n### Issuing a key\n\nUse `\u002Fapi-keys` in `apps\u002Fadmin`, on the caller's active organization. From a browser client, the call the screen makes is:\n\n```ts\nconst { data } = await auth.apiKey.create({\n  name: \"deploy pipeline\",\n  organizationId,\n  metadata: { scope: { project: [\"read\"] } },\n  expiresIn: 30 * 24 * 60 * 60, \u002F\u002F seconds; omit for no expiry\n});\ndata.key; \u002F\u002F the plaintext, this once and never again\n```\n\nThe scope travels as `metadata.scope` because the plugin refuses `permissions` on any request that carries headers (`SERVER_ONLY_PROPERTY`). The guard checks `metadata.scope`, and the plugin's `defaultPermissions` writes it to the `permissions` column. Read `permissions` on a stored row, never `metadata.scope`. The long note on `API_KEY_OPTIONS` in `api-key-options.ts` explains why (ADR 0036).\n\n### Scopes are statements, and they cannot exceed the creator's\n\nA key's scope is a permission map from `packages\u002Fauth\u002Fsrc\u002Faccess.ts`, the same vocabulary a role uses. `can()` reads it the way it reads a member's statements, so a route needs no branch for machine callers:\n\n```ts\n.delete(\"\u002F:id\", async (c) => {\n  const tenant = await requirePermission(c, { project: [\"delete\"] }); \u002F\u002F key or cookie, one line\n});\n```\n\n- **A key cannot out-scope its creator.** `apiKeyScopeGuard()` is a `before` hook on `\u002Fapi-key\u002Fcreate`. It loads the creator's statements with the loader `requireTenant` uses and refuses a scope `can()` denies, with 403 `permission required: \u003Cresource>:\u003Caction>`. It runs before the plugin's own `apiKey: [\"create\"]` check, so holding that statement does not get past it. A superadmin passes.\n- **A scope is a snapshot at issue time.** A later role edit changes the members and never a key. `\u002Fapi-key\u002Fupdate` is not guarded because it cannot write a scope. To change what a key may do, revoke it and issue another.\n\nThe create form offers only the statements the caller holds. The form is a convenience. The guard is the gate.\n\n### The `api_keys` table in organization mode\n\n`apiKeyPlugin()` sets `references: \"organization\"` and renames `referenceId` to `organizationId`, so the table meets the tenant column convention. The rename in `packages\u002Fauth\u002Fsrc\u002Fplugins\u002Fapi-key.ts` and the snapshot in `packages\u002Fdb\u002Fsrc\u002Fschema\u002Fapi-keys.ts` change together, or the adapter writes into a column that is not there.\n\n## User mode (`api-keys-user`)\n\nA key belongs to one user. `api_keys.user_id` references `users.id` with `onDelete: \"cascade\"`, so a deleted account deletes its keys. `references: \"user\"` makes the plugin take the owner from the session on create, and `get`, `update` and `delete` answer `KEY_NOT_FOUND` for a key another user owns.\n\n### The key vocabulary\n\n`packages\u002Fauth\u002Fsrc\u002Fapi-key-scopes.ts` lists every resource-and-action pair a key may carry. The project owns this file and edits it. It ships empty:\n\n```ts\nexport const API_KEY_SCOPES: Readonly\u003CRecord\u003Cstring, readonly string[]>> = {};\n```\n\nWhile it is empty, every scoped create is refused with 403 `permission required: \u003Cresource>:\u003Caction>`. A create with no scope still issues a key, and that key holds nothing, so `requireScope` refuses it every demand. Declare the pairs your routes demand:\n\n```ts\nexport const API_KEY_SCOPES: Readonly\u003CRecord\u003Cstring, readonly string[]>> = {\n  cards: [\"read\", \"write\"],\n  reviews: [\"read\", \"write\"],\n};\n```\n\n`apiKeyScopeGuard()` checks every create against this list, with or without a session. A server-side `auth.api.createApiKey` with `permissions` is held to the same list as a browser's `metadata.scope`. Removing a pair later stops new keys from carrying it and does not shrink a key that already holds it. Revoke and reissue those keys. It checks a server-side `auth.api.updateApiKey` that sets `permissions` against the same list. A browser cannot set `permissions` on update at all, because the plugin refuses that field from a request, and `metadata.scope` on an update changes no scope.\n\n### Issuing, listing and revoking keys\n\nKeys live on the client instance, under `\u002Fauth`, only. The core registers the plugin on `adminAuth` too, for the organization owner's screen, so this owner patches `apiKeyAdminGuard()` into `adminAuth.plugins`. It refuses every `\u002Fadmin\u002Fauth\u002Fapi-key\u002F*` call with 403 `API_KEYS_ON_CLIENT_ONLY`, so an admin session can neither mint nor verify a user-owned key, and a credential counts only where it was issued (ADR 0050).\n\nThere is no key screen in user mode. Call the client plugin from the signed-in user's browser. `authClient` here is the client `createClient(baseURL)` from `@repo\u002Fauth\u002Fclient` returns:\n\n```ts\nconst { data, error } = await authClient.apiKey.create({\n  name: \"cli on my laptop\",\n  metadata: { scope: { cards: [\"read\"] } },\n});\ndata.key; \u002F\u002F the plaintext, this once and never again\n\nconst { data: keys } = await authClient.apiKey.list(); \u002F\u002F the caller's own keys\nawait authClient.apiKey.delete({ keyId: keys[0].id });\n```\n\nSend the scope as `metadata.scope`, for the same `SERVER_ONLY_PROPERTY` reason as organization mode. Read a key's scope from `permissions`.\n\n### Gating a route\n\nA route opens with `requireCaller(c)` and states its demand with `requireScope(caller, demand)`:\n\n```ts\nimport { requireCaller, requireScope } from \"@repo\u002Fauth\u002Fcaller\";\n\nexport const cards = new Hono().get(\"\u002F\", async (c) => {\n  const caller = await requireCaller(c);\n  requireScope(caller, { cards: [\"read\"] });\n  return c.json(await listCards(c, caller.userId), 200);\n});\n```\n\n`requireCaller` returns `{ userId, principal }`. The principal is `{ kind: \"user\" }` for a session cookie, or `{ kind: \"apiKey\", keyId, statements }` for a key. With no bearer header and no session it throws 401 `sign in first`.\n\n- **A session user passes every demand.** A scope narrows a key and never a person.\n- **A key must hold every demanded action.** The 403 names the first missing pair: `permission required: cards:write`.\n- **An empty demand is refused** for both kinds, with 403 `permission required`. A demand built from an empty loop fails closed.\n- **A banned owner's keys stop working.** `requireCaller` loads the key's owner after the key verifies and answers 401 `invalid api key` while the owner is banned, the way the `admin()` plugin refuses their sign-in. A ban with a past `banExpires` no longer counts. The plugin itself never reads the user row, so this check is the only one.\n- **Data ownership is the route's job.** `requireScope` says what a caller may do, never which rows are theirs. Filter every query on `caller.userId`.\n\nBoth functions throw `HTTPException`, so `apps\u002Fapi`'s `onError` renders their refusals as the `{ error: { code, message } }` envelope.\n\n### The `api_keys` table in user mode\n\n`apiKeyPlugin()` sets `references: \"user\"` and renames `referenceId` to `userId`, which the snapshot stores as `user_id` with the index `api_keys_user_id_idx`. `requireCaller` still reads the plugin's own `referenceId` field off a verified key, because the adapter maps the column back to the model field.\n\n## Shared by both modes\n\n### The plaintext and expiry\n\nThe plaintext exists in the create response and nowhere else. Only a SHA-256 hash is stored, and the plugin has no endpoint that returns a key again. A lost key is reissued, not recovered.\n\n`expiresIn` is in **seconds**, with a floor of one day and a ceiling of 365 days. Leave it out and the key stays valid until it is revoked.\n\n### What is off, and why\n\n- `enableSessionForAPIKeys: false`. A key never becomes a session, so `requireSession` never accepts one, and only the owner's bearer path turns a key into a caller. In organization mode the mocked session would also carry no `activeOrganizationId` and resolve to no tenant.\n- `rateLimit: { enabled: false }`, with `remaining` and the refill columns unused. Limits belong to the `ratelimit` module, not to one credential type.\n- `deferUpdates: false`. It needs `advanced.backgroundTasks.handler`, and Workers has no `waitUntil` behind that hook.\n\nThe columns stay in the snapshot because the plugin writes `requestCount` regardless, and a snapshot that drops a column the adapter knows about does not match what the adapter writes.\n\n### One write per bearer call\n\n`verifyApiKey` writes `lastRequest` on every request, synchronously. That is accepted by decision. A key busy enough for that write to matter needs a limiter in front of it, which is the job of `ratelimit`.\n\n### `modelName` and the pinned version\n\nBoth owners set `schema.apikey.modelName: \"apiKey\"`. `auth.ts` passes `usePlural: true` to the Drizzle adapter, so the adapter asks for the `apiKeys` export, stored as the `api_keys` table. Without it the adapter asks for `apikeys`, finds no export, and every key call throws. Change the `modelName` and the export key together.\n\nThe snapshot is hand-authored against `@better-auth\u002Fapi-key@1.7.7` and ships in two dialects, selected by `onlyWith`. A version bump means re-verifying every column against that version's `apiKeySchema()`. Each owner's `schema-version.test.ts` fails until its header and the range the core pins agree again.\n\n## Failure codes\n\n| Case | Mode | Status and body |\n| --- | --- | --- |\n| A claimed bearer header with no key, or a key not found, revoked, disabled or expired | both | 401 `invalid api key` |\n| A valid key whose owner is banned | user | 401 `invalid api key` |\n| Any `\u002Fadmin\u002Fauth\u002Fapi-key\u002F*` call | user | 403 `API_KEYS_ON_CLIENT_ONLY` |\n| No bearer header and no session on `requireCaller` | user | 401 `sign in first` |\n| `x-organization-id` beside a bearer header | organization | 403 `forbidden` |\n| A route demand the key does not hold | both | 403 `permission required: \u003Cresource>:\u003Caction>` |\n| An empty demand on `requireScope` | user | 403 `permission required` |\n| A create scope wider than the creator's statements | organization | 403 `permission required: \u003Cresource>:\u003Caction>` |\n| A create scope, or a server-side update's `permissions`, outside `API_KEY_SCOPES` | user | 403 `permission required: \u003Cresource>:\u003Caction>` |\n\nA route refusal comes through the api's `{ error: { code, message } }` envelope. The guard's 403 on `\u002Fauth\u002Fapi-key\u002Fcreate` is a Better Auth `APIError`, so its body is Better Auth's `{ \"message\": \"permission required: …\" }` with no `code`, in both modes. A client that reads the create error must read `error.message`.\n\nA deleted user takes every key they own with them (`onDelete: \"cascade\"`), so the next bearer call with one of those keys gets 401 `invalid api key`.\n\n## Boundaries to honor\n\n- **Do not add a second permission path for keys.** In organization mode the bearer principal carries statements and `can()` reads them. In user mode `requireScope` reads them. A route that asks Better Auth's `hasPermission` pays a query per check and answers from a different engine.\n- **Do not mint a `TenantId` from a request.** In organization mode the resolver calls `asTenantId` on the verified key's organization, the only place on this path where that is allowed.\n- **Do not widen the 401 message.** Each failure a caller can tell apart is a fact an attacker did not have.\n- **Do not turn `enableSessionForAPIKeys` on.** In both modes it lets a key pass `requireSession`, which no route expects.\n- **Do not read `metadata.scope` off a stored row.** `permissions` decides. The two copies drift after an update.\n\n## Switching owners\n\nNo keys move between owners. The owner column changes, so a key issued under one owner means nothing under the other.\n\n1. Revoke every key, and tell the machine callers that hold them.\n2. Run `saasaloy remove api-keys-organization` (or `remove api-keys-user`).\n3. Run `saasaloy add api-keys-user` (or `add api-keys-organization`).\n4. Run `pnpm db:generate`, and read the migration. The table is empty, so a rebuild of `api_keys` with the new owner column is safe.\n5. Apply the migration, then issue new keys.\n\nThe core stays installed across the switch, so its `auth.ts` patches stay too. Between steps 2 and 3, `auth.ts` imports a `plugins\u002Fapi-key.ts` that no longer exists, so the project does not compile until step 3. When moving to user mode, also rewrite each route that uses `requirePermission` for a key caller to use `requireCaller` and `requireScope`.\n\n## Removal\n\nRemove the owner first. The owner depends on the core, so `remove api-keys` refuses while an owner is installed.\n\n`saasaloy remove api-keys-organization` reverses the bearer resolver patch and the `\u002Fapi-keys` nav entry, and deletes the owner's files. `saasaloy remove api-keys-user` reverses the `apiKeyAdminGuard()` patch on `adminAuth` and deletes its files, which include `caller.ts`, so every route that imports `@repo\u002Fauth\u002Fcaller` stops compiling. For both owners, the `api_keys` table survives. Run `db:generate` and read the drop migration before you apply it. Tell the machine callers first, because every key stops working when the owner goes. Removing the last owner also warns that `api-keys` is left with none of its `requiresOneOf` installed and names the fix. It does not refuse, because switching owners is remove-then-add, and `doctor` reports the state until an owner is back.\n\n`saasaloy remove api-keys` then reverses the core's six patches, the two server plugins on each of `auth` and `adminAuth` and the client plugin in each of `authClientPlugins` and `adminAuthClientPlugins`, and deletes `api-key-options.ts` and `api-key-client.ts`. The `@better-auth\u002Fapi-key` line in `packages\u002Fauth\u002Fpackage.json` survives, because a `package-json-dependency` patch has no removal inverse. Drop it by hand and run `pnpm install`.\n\n## Moving an existing `api-keys` project to the split\n\nA project that installed `api-keys` before the split has organization-owned keys. Its new `api-keys` descriptor needs an owner, so `saasaloy update` refuses with exit 2 and changes nothing until one is installed:\n\n```\nCannot update — unmet requirement:\n  api-keys now needs one of: api-keys-organization, api-keys-user, and none is installed. Run one of:\n    saasaloy add api-keys-organization\n    saasaloy add api-keys-user\nThen run `saasaloy update` again. Nothing was changed.\n```\n\n1. Upgrade the `saasaloy` CLI to 0.7.0 or later. `api-keys` and both owners declare `requires.saasaloy: \">=0.7.0\"`, and an older CLI refuses them in `add` and `update` before it writes anything.\n2. Run `saasaloy add api-keys-organization`. The schema, the resolver, the screen and the plugin keep their bytes, so `add` adopts them, moves their ownership to the new module, and records the resolver patch again under it.\n3. Run `saasaloy update`. It writes the new `packages\u002Fauth\u002Fsrc\u002Fplugins\u002Fapi-key-options.ts` under `api-keys`.\n4. Run `pnpm db:generate`. It reports no schema changes, because the table is the same.\n\nDo not pick `api-keys-user` for an existing project. Its keys are organization-owned, and no keys move between owners.\n\n## Upgrading from singular table names\n\nA project that installed `api-keys` before the tables became plural has an `apikey` table in its database. Move it to the new name like this:\n\n1. Update `auth` first, because its schema rename and `usePlural: true` land together. Then follow \"Moving an existing `api-keys` project to the split\" above. The `add` and `update` steps there write the new schema file and the `modelName: \"apiKey\"` option.\n2. Run `pnpm db:generate`.\n3. drizzle-kit asks, for each new table, whether it is created or renamed from an existing table. Pick the rename from the old name: `apikey` → `api_keys`.\n4. Read the generated SQL before you apply it. It must rename the table and its indexes (`ALTER TABLE ... RENAME TO ...`), and contain no `DROP TABLE` or `CREATE TABLE` for a table that holds data.\n5. If it drops a table, delete that migration file and run `pnpm db:generate` again.\n6. Apply the migration, then call the API once with an existing key to confirm the adapter finds the table.\n\n## Next\n\nRun `saasaloy-api` to accept a key on a route and read the caller it resolves to.\n","# api-keys\n\n`api-keys` gives a caller with no cookie a credential it presents as `Authorization: Bearer sk_…`. Who owns a key is a choice the project makes once, at `add` time, the way it picks a database driver (ADR 0055):\n\n| Owner module | A key belongs to | Pulls in | Route gate |\n| --- | --- | --- | --- |\n| `api-keys-organization` | one organization | `multitenant`, `teams`, `admin` | `requireTenant` \u002F `requirePermission` from `@repo\u002Fauth\u002Ftenant` and `@repo\u002Fauth\u002Fpermissions` |\n| `api-keys-user` | one user | `auth` only | `requireCaller` \u002F `requireScope` from `@repo\u002Fauth\u002Fcaller` |\n\n## What the core holds and what each owner holds\n\nThe core, `api-keys`, holds what both owners share:\n\n- the `@better-auth\u002Fapi-key` line in `packages\u002Fauth\u002Fpackage.json`;\n- `packages\u002Fauth\u002Fsrc\u002Fplugins\u002Fapi-key-client.ts` and its patches into `authClientPlugins` and `adminAuthClientPlugins` in `client.ts`;\n- the four `plugin-array` patches into `auth.ts` that call `apiKeyPlugin()` and `apiKeyScopeGuard()` on both instances, `auth` and `adminAuth` (ADR 0050);\n- `packages\u002Fauth\u002Fsrc\u002Fplugins\u002Fapi-key-options.ts`: the shared plugin options (`API_KEY_OPTIONS`), `GUARDED_PATHS`, `scopeOf`, the bearer parsing (`hasBearer`, `bearerKey`) and `INVALID_API_KEY`;\n- this skill.\n\nEach owner ships `packages\u002Fauth\u002Fsrc\u002Fplugins\u002Fapi-key.ts` at the same path, so the `auth.ts` import line is the same in both modes. The owner's file adds `references` and the `schema.apikey` rename to the shared options, and it holds that owner's `apiKeyScopeGuard()`. Each owner also ships `packages\u002Fdb\u002Fsrc\u002Fschema\u002Fapi-keys.ts`, with `organization_id` or `user_id` as the owner column.\n\n- `api-keys-organization` adds `packages\u002Fauth\u002Fsrc\u002Fresolvers\u002Fapi-key.ts` (the bearer resolver, patched into `multitenant`'s `tenantResolvers`), the `\u002Fapi-keys` screen in `apps\u002Fadmin`, and its `NAV_ITEMS` entry.\n- `api-keys-user` adds `packages\u002Fauth\u002Fsrc\u002Fcaller.ts` (`requireCaller`, `requireScope`), `packages\u002Fauth\u002Fsrc\u002Fapi-key-rules.ts` (the import-free rules `scopeDenial`, `keyAllows` and `ownerMayUseKeys`), and `packages\u002Fauth\u002Fsrc\u002Fapi-key-scopes.ts` (the key vocabulary). It has no screen. Its one patch puts `apiKeyAdminGuard()` into `adminAuth.plugins`.\n\n## Picking an owner\n\nName the owner, and its `dependsOn` pulls the core in:\n\n```sh\nsaasaloy add api-keys-organization   # or: saasaloy add api-keys-user\n```\n\nA bare `saasaloy add api-keys` on a terminal asks `api-keys needs one of these — pick one`. With no terminal, it refuses with exit 2 and names both options:\n\n```\nCannot add api-keys — unmet requirement:\n  api-keys needs one of: api-keys-organization, api-keys-user, and none is installed. Run `saasaloy add api-keys-organization` first, or pick another from that list.\n```\n\n`--yes` does not answer this question. It means \"do not ask me\", not \"pick an owner for me\", so `add api-keys --yes` refuses the same way. Name the owner module instead.\n\nThe two owners name each other in `conflictsWith`, so `add` refuses the second one while the first is installed.\n\nPick `api-keys-organization` when the project already has organizations and roles. Pick `api-keys-user` when a key acts for one person and the project has no organizations to carry.\n\n## Calling the api with a key\n\nOne header, and in both modes the routes do not change:\n\n```sh\ncurl -s -H \"Authorization: Bearer sk_a1b2c3...\" https:\u002F\u002Fapi.example.com\u002Fprojects\n```\n\nThe bearer rule is the same in both modes, because both read `hasBearer` and `bearerKey` from `api-key-options.ts`:\n\n- A bearer header is claimed first. A request that carries both a key and a cookie is answered as a key request.\n- A claimed request never falls back to the cookie. A revoked key sent from a signed-in browser gets 401, not the browser user's access.\n- Every failure is 401 `invalid api key`: no key after `Bearer`, not found, revoked, disabled, expired, or a hash that matches nothing. The message is the same on purpose. \"That key exists but is expired\" tells the caller the key exists.\n\n## Organization mode (`api-keys-organization`)\n\nA key belongs to one organization and resolves the same `Tenant` a cookie does, through `apiKeyTenant` in `multitenant`'s `tenantResolvers` table. `GET \u002Ftenant` shows what the server made of a key:\n\n```sh\ncurl -s -H \"Authorization: Bearer $KEY\" https:\u002F\u002Fapi.example.com\u002Ftenant\n# { \"organizationId\": \"org_…\", \"principal\": { \"kind\": \"apiKey\", \"keyId\": \"…\", \"statements\": { \"project\": [\"read\"] } } }\n```\n\n`x-organization-id` beside a bearer header is 403 `forbidden` whatever it says. A key is bound to one organization; the superadmin bypass is a cookie-path power, and it needs the admin session.\n\n### Issuing a key\n\nUse `\u002Fapi-keys` in `apps\u002Fadmin`, on the caller's active organization. From a browser client, the call the screen makes is:\n\n```ts\nconst { data } = await auth.apiKey.create({\n  name: \"deploy pipeline\",\n  organizationId,\n  metadata: { scope: { project: [\"read\"] } },\n  expiresIn: 30 * 24 * 60 * 60, \u002F\u002F seconds; omit for no expiry\n});\ndata.key; \u002F\u002F the plaintext, this once and never again\n```\n\nThe scope travels as `metadata.scope` because the plugin refuses `permissions` on any request that carries headers (`SERVER_ONLY_PROPERTY`). The guard checks `metadata.scope`, and the plugin's `defaultPermissions` writes it to the `permissions` column. Read `permissions` on a stored row, never `metadata.scope`. The long note on `API_KEY_OPTIONS` in `api-key-options.ts` explains why (ADR 0036).\n\n### Scopes are statements, and they cannot exceed the creator's\n\nA key's scope is a permission map from `packages\u002Fauth\u002Fsrc\u002Faccess.ts`, the same vocabulary a role uses. `can()` reads it the way it reads a member's statements, so a route needs no branch for machine callers:\n\n```ts\n.delete(\"\u002F:id\", async (c) => {\n  const tenant = await requirePermission(c, { project: [\"delete\"] }); \u002F\u002F key or cookie, one line\n});\n```\n\n- **A key cannot out-scope its creator.** `apiKeyScopeGuard()` is a `before` hook on `\u002Fapi-key\u002Fcreate`. It loads the creator's statements with the loader `requireTenant` uses and refuses a scope `can()` denies, with 403 `permission required: \u003Cresource>:\u003Caction>`. It runs before the plugin's own `apiKey: [\"create\"]` check, so holding that statement does not get past it. A superadmin passes.\n- **A scope is a snapshot at issue time.** A later role edit changes the members and never a key. `\u002Fapi-key\u002Fupdate` is not guarded because it cannot write a scope. To change what a key may do, revoke it and issue another.\n\nThe create form offers only the statements the caller holds. The form is a convenience. The guard is the gate.\n\n### The `api_keys` table in organization mode\n\n`apiKeyPlugin()` sets `references: \"organization\"` and renames `referenceId` to `organizationId`, so the table meets the tenant column convention. The rename in `packages\u002Fauth\u002Fsrc\u002Fplugins\u002Fapi-key.ts` and the snapshot in `packages\u002Fdb\u002Fsrc\u002Fschema\u002Fapi-keys.ts` change together, or the adapter writes into a column that is not there.\n\n## User mode (`api-keys-user`)\n\nA key belongs to one user. `api_keys.user_id` references `users.id` with `onDelete: \"cascade\"`, so a deleted account deletes its keys. `references: \"user\"` makes the plugin take the owner from the session on create, and `get`, `update` and `delete` answer `KEY_NOT_FOUND` for a key another user owns.\n\n### The key vocabulary\n\n`packages\u002Fauth\u002Fsrc\u002Fapi-key-scopes.ts` lists every resource-and-action pair a key may carry. The project owns this file and edits it. It ships empty:\n\n```ts\nexport const API_KEY_SCOPES: Readonly\u003CRecord\u003Cstring, readonly string[]>> = {};\n```\n\nWhile it is empty, every scoped create is refused with 403 `permission required: \u003Cresource>:\u003Caction>`. A create with no scope still issues a key, and that key holds nothing, so `requireScope` refuses it every demand. Declare the pairs your routes demand:\n\n```ts\nexport const API_KEY_SCOPES: Readonly\u003CRecord\u003Cstring, readonly string[]>> = {\n  cards: [\"read\", \"write\"],\n  reviews: [\"read\", \"write\"],\n};\n```\n\n`apiKeyScopeGuard()` checks every create against this list, with or without a session. A server-side `auth.api.createApiKey` with `permissions` is held to the same list as a browser's `metadata.scope`. Removing a pair later stops new keys from carrying it and does not shrink a key that already holds it. Revoke and reissue those keys. It checks a server-side `auth.api.updateApiKey` that sets `permissions` against the same list. A browser cannot set `permissions` on update at all, because the plugin refuses that field from a request, and `metadata.scope` on an update changes no scope.\n\n### Issuing, listing and revoking keys\n\nKeys live on the client instance, under `\u002Fauth`, only. The core registers the plugin on `adminAuth` too, for the organization owner's screen, so this owner patches `apiKeyAdminGuard()` into `adminAuth.plugins`. It refuses every `\u002Fadmin\u002Fauth\u002Fapi-key\u002F*` call with 403 `API_KEYS_ON_CLIENT_ONLY`, so an admin session can neither mint nor verify a user-owned key, and a credential counts only where it was issued (ADR 0050).\n\nThere is no key screen in user mode. Call the client plugin from the signed-in user's browser. `authClient` here is the client `createClient(baseURL)` from `@repo\u002Fauth\u002Fclient` returns:\n\n```ts\nconst { data, error } = await authClient.apiKey.create({\n  name: \"cli on my laptop\",\n  metadata: { scope: { cards: [\"read\"] } },\n});\ndata.key; \u002F\u002F the plaintext, this once and never again\n\nconst { data: keys } = await authClient.apiKey.list(); \u002F\u002F the caller's own keys\nawait authClient.apiKey.delete({ keyId: keys[0].id });\n```\n\nSend the scope as `metadata.scope`, for the same `SERVER_ONLY_PROPERTY` reason as organization mode. Read a key's scope from `permissions`.\n\n### Gating a route\n\nA route opens with `requireCaller(c)` and states its demand with `requireScope(caller, demand)`:\n\n```ts\nimport { requireCaller, requireScope } from \"@repo\u002Fauth\u002Fcaller\";\n\nexport const cards = new Hono().get(\"\u002F\", async (c) => {\n  const caller = await requireCaller(c);\n  requireScope(caller, { cards: [\"read\"] });\n  return c.json(await listCards(c, caller.userId), 200);\n});\n```\n\n`requireCaller` returns `{ userId, principal }`. The principal is `{ kind: \"user\" }` for a session cookie, or `{ kind: \"apiKey\", keyId, statements }` for a key. With no bearer header and no session it throws 401 `sign in first`.\n\n- **A session user passes every demand.** A scope narrows a key and never a person.\n- **A key must hold every demanded action.** The 403 names the first missing pair: `permission required: cards:write`.\n- **An empty demand is refused** for both kinds, with 403 `permission required`. A demand built from an empty loop fails closed.\n- **A banned owner's keys stop working.** `requireCaller` loads the key's owner after the key verifies and answers 401 `invalid api key` while the owner is banned, the way the `admin()` plugin refuses their sign-in. A ban with a past `banExpires` no longer counts. The plugin itself never reads the user row, so this check is the only one.\n- **Data ownership is the route's job.** `requireScope` says what a caller may do, never which rows are theirs. Filter every query on `caller.userId`.\n\nBoth functions throw `HTTPException`, so `apps\u002Fapi`'s `onError` renders their refusals as the `{ error: { code, message } }` envelope.\n\n### The `api_keys` table in user mode\n\n`apiKeyPlugin()` sets `references: \"user\"` and renames `referenceId` to `userId`, which the snapshot stores as `user_id` with the index `api_keys_user_id_idx`. `requireCaller` still reads the plugin's own `referenceId` field off a verified key, because the adapter maps the column back to the model field.\n\n## Shared by both modes\n\n### The plaintext and expiry\n\nThe plaintext exists in the create response and nowhere else. Only a SHA-256 hash is stored, and the plugin has no endpoint that returns a key again. A lost key is reissued, not recovered.\n\n`expiresIn` is in **seconds**, with a floor of one day and a ceiling of 365 days. Leave it out and the key stays valid until it is revoked.\n\n### What is off, and why\n\n- `enableSessionForAPIKeys: false`. A key never becomes a session, so `requireSession` never accepts one, and only the owner's bearer path turns a key into a caller. In organization mode the mocked session would also carry no `activeOrganizationId` and resolve to no tenant.\n- `rateLimit: { enabled: false }`, with `remaining` and the refill columns unused. Limits belong to the `ratelimit` module, not to one credential type.\n- `deferUpdates: false`. It needs `advanced.backgroundTasks.handler`, and Workers has no `waitUntil` behind that hook.\n\nThe columns stay in the snapshot because the plugin writes `requestCount` regardless, and a snapshot that drops a column the adapter knows about does not match what the adapter writes.\n\n### One write per bearer call\n\n`verifyApiKey` writes `lastRequest` on every request, synchronously. That is accepted by decision. A key busy enough for that write to matter needs a limiter in front of it, which is the job of `ratelimit`.\n\n### `modelName` and the pinned version\n\nBoth owners set `schema.apikey.modelName: \"apiKey\"`. `auth.ts` passes `usePlural: true` to the Drizzle adapter, so the adapter asks for the `apiKeys` export, stored as the `api_keys` table. Without it the adapter asks for `apikeys`, finds no export, and every key call throws. Change the `modelName` and the export key together.\n\nThe snapshot is hand-authored against `@better-auth\u002Fapi-key@1.7.7` and ships in two dialects, selected by `onlyWith`. A version bump means re-verifying every column against that version's `apiKeySchema()`. Each owner's `schema-version.test.ts` fails until its header and the range the core pins agree again.\n\n## Failure codes\n\n| Case | Mode | Status and body |\n| --- | --- | --- |\n| A claimed bearer header with no key, or a key not found, revoked, disabled or expired | both | 401 `invalid api key` |\n| A valid key whose owner is banned | user | 401 `invalid api key` |\n| Any `\u002Fadmin\u002Fauth\u002Fapi-key\u002F*` call | user | 403 `API_KEYS_ON_CLIENT_ONLY` |\n| No bearer header and no session on `requireCaller` | user | 401 `sign in first` |\n| `x-organization-id` beside a bearer header | organization | 403 `forbidden` |\n| A route demand the key does not hold | both | 403 `permission required: \u003Cresource>:\u003Caction>` |\n| An empty demand on `requireScope` | user | 403 `permission required` |\n| A create scope wider than the creator's statements | organization | 403 `permission required: \u003Cresource>:\u003Caction>` |\n| A create scope, or a server-side update's `permissions`, outside `API_KEY_SCOPES` | user | 403 `permission required: \u003Cresource>:\u003Caction>` |\n\nA route refusal comes through the api's `{ error: { code, message } }` envelope. The guard's 403 on `\u002Fauth\u002Fapi-key\u002Fcreate` is a Better Auth `APIError`, so its body is Better Auth's `{ \"message\": \"permission required: …\" }` with no `code`, in both modes. A client that reads the create error must read `error.message`.\n\nA deleted user takes every key they own with them (`onDelete: \"cascade\"`), so the next bearer call with one of those keys gets 401 `invalid api key`.\n\n## Boundaries to honor\n\n- **Do not add a second permission path for keys.** In organization mode the bearer principal carries statements and `can()` reads them. In user mode `requireScope` reads them. A route that asks Better Auth's `hasPermission` pays a query per check and answers from a different engine.\n- **Do not mint a `TenantId` from a request.** In organization mode the resolver calls `asTenantId` on the verified key's organization, the only place on this path where that is allowed.\n- **Do not widen the 401 message.** Each failure a caller can tell apart is a fact an attacker did not have.\n- **Do not turn `enableSessionForAPIKeys` on.** In both modes it lets a key pass `requireSession`, which no route expects.\n- **Do not read `metadata.scope` off a stored row.** `permissions` decides. The two copies drift after an update.\n\n## Switching owners\n\nNo keys move between owners. The owner column changes, so a key issued under one owner means nothing under the other.\n\n1. Revoke every key, and tell the machine callers that hold them.\n2. Run `saasaloy remove api-keys-organization` (or `remove api-keys-user`).\n3. Run `saasaloy add api-keys-user` (or `add api-keys-organization`).\n4. Run `pnpm db:generate`, and read the migration. The table is empty, so a rebuild of `api_keys` with the new owner column is safe.\n5. Apply the migration, then issue new keys.\n\nThe core stays installed across the switch, so its `auth.ts` patches stay too. Between steps 2 and 3, `auth.ts` imports a `plugins\u002Fapi-key.ts` that no longer exists, so the project does not compile until step 3. When moving to user mode, also rewrite each route that uses `requirePermission` for a key caller to use `requireCaller` and `requireScope`.\n\n## Removal\n\nRemove the owner first. The owner depends on the core, so `remove api-keys` refuses while an owner is installed.\n\n`saasaloy remove api-keys-organization` reverses the bearer resolver patch and the `\u002Fapi-keys` nav entry, and deletes the owner's files. `saasaloy remove api-keys-user` reverses the `apiKeyAdminGuard()` patch on `adminAuth` and deletes its files, which include `caller.ts`, so every route that imports `@repo\u002Fauth\u002Fcaller` stops compiling. For both owners, the `api_keys` table survives. Run `db:generate` and read the drop migration before you apply it. Tell the machine callers first, because every key stops working when the owner goes. Removing the last owner also warns that `api-keys` is left with none of its `requiresOneOf` installed and names the fix. It does not refuse, because switching owners is remove-then-add, and `doctor` reports the state until an owner is back.\n\n`saasaloy remove api-keys` then reverses the core's six patches, the two server plugins on each of `auth` and `adminAuth` and the client plugin in each of `authClientPlugins` and `adminAuthClientPlugins`, and deletes `api-key-options.ts` and `api-key-client.ts`. The `@better-auth\u002Fapi-key` line in `packages\u002Fauth\u002Fpackage.json` survives, because a `package-json-dependency` patch has no removal inverse. Drop it by hand and run `pnpm install`.\n\n## Moving an existing `api-keys` project to the split\n\nA project that installed `api-keys` before the split has organization-owned keys. Its new `api-keys` descriptor needs an owner, so `saasaloy update` refuses with exit 2 and changes nothing until one is installed:\n\n```\nCannot update — unmet requirement:\n  api-keys now needs one of: api-keys-organization, api-keys-user, and none is installed. Run one of:\n    saasaloy add api-keys-organization\n    saasaloy add api-keys-user\nThen run `saasaloy update` again. Nothing was changed.\n```\n\n1. Upgrade the `saasaloy` CLI to 0.7.0 or later. `api-keys` and both owners declare `requires.saasaloy: \">=0.7.0\"`, and an older CLI refuses them in `add` and `update` before it writes anything.\n2. Run `saasaloy add api-keys-organization`. The schema, the resolver, the screen and the plugin keep their bytes, so `add` adopts them, moves their ownership to the new module, and records the resolver patch again under it.\n3. Run `saasaloy update`. It writes the new `packages\u002Fauth\u002Fsrc\u002Fplugins\u002Fapi-key-options.ts` under `api-keys`.\n4. Run `pnpm db:generate`. It reports no schema changes, because the table is the same.\n\nDo not pick `api-keys-user` for an existing project. Its keys are organization-owned, and no keys move between owners.\n\n## Upgrading from singular table names\n\nA project that installed `api-keys` before the tables became plural has an `apikey` table in its database. Move it to the new name like this:\n\n1. Update `auth` first, because its schema rename and `usePlural: true` land together. Then follow \"Moving an existing `api-keys` project to the split\" above. The `add` and `update` steps there write the new schema file and the `modelName: \"apiKey\"` option.\n2. Run `pnpm db:generate`.\n3. drizzle-kit asks, for each new table, whether it is created or renamed from an existing table. Pick the rename from the old name: `apikey` → `api_keys`.\n4. Read the generated SQL before you apply it. It must rename the table and its indexes (`ALTER TABLE ... RENAME TO ...`), and contain no `DROP TABLE` or `CREATE TABLE` for a table that holds data.\n5. If it drops a table, delete that migration file and run `pnpm db:generate` again.\n6. Apply the migration, then call the API once with an existing key to confirm the adapter finds the table.\n\n## Next\n\nRun `saasaloy-api` to accept a key on a route and read the caller it resolves to.\n",{"name":5,"description":7},"main","a46a4dd388795519840da0ed1f695634b6dcd99b","modules\u002Fapi-keys\u002Fskills\u002Fsaasaloy-api-keys",0,"https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy","https:\u002F\u002Fsaasaloy.com","https:\u002F\u002Fgithub.com\u002Fmimukit","https:\u002F\u002Fmimukit.com","Senior Software Engineer · 9+ yrs Fullstack (TS\u002FNode\u002FReact) · AI integrations, distributed systems · Building @saasaloy & @codealoy · Bangladesh 🇧🇩 \u002F Remote","2026-11-13 20:39:28",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add mimukit\u002Fsaasaloy --skill saasaloy-api-keys",{"tool":40,"command":41},"bunx","bunx skills add mimukit\u002Fsaasaloy --skill saasaloy-api-keys",{"tool":43,"command":44},"pnpm","pnpm dlx skills add mimukit\u002Fsaasaloy --skill saasaloy-api-keys","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fmodules\u002Fapi-keys\u002Fskills\u002Fsaasaloy-api-keys\u002FSKILL.md",true,[],[49,56,63,70,77,83],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7BE75C34XHSPVJNQC8FY4Q0","saasaloy-subscription","Runbook for the subscription capability — provider-agnostic subscriptions in packages\u002Fsubscription, with a plan file, a projection table, a billable-subject file, plan entitlements and per-provider modules. Use when adding a plan, adding a plan feature or a numeric limit, gating an API route with requireFeature or requireWithinLimit, reading the 402 it returns, working out why a subject resolves to the free plan, wiring a checkout or portal route, reading a SubscriptionError, choosing or switching SUBSCRIPTION_PROVIDER, registering a webhook in the vendor's dashboard, writing a third subscription provider, or upgrading a project that still has `billing` installed.","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fmodules\u002Fsubscription\u002Fskills\u002Fsaasaloy-subscription\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7BE68MJ8H47JZKTBDFYR6JD","saasaloy-notification","Runbook for the notification module, in-app notifications for apps\u002Fapp. It owns the notifications and notification_opt_outs tables, notify() in apps\u002Fapi\u002Fsrc\u002Flib\u002Fnotify.ts, the \u002Fnotifications api routes, the bell in the app header, the sidebar badge, the \u002Fnotifications page with Inbox and Preferences tabs, the notification config section, and the daily prune. Use when sending a notification from an api route, adding or changing a category, changing retention, debugging a badge or bell count that does not move, or removing the module.","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fmodules\u002Fnotification\u002Fskills\u002Fsaasaloy-notification\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7BE53PDQV0YDPG8RNVGTPEQ","saasaloy-cms","Runbook for the cms module, the in-house CMS behind apps\u002Fadmin. Covers code-defined collections, the Tiptap editor, drafts, revisions and redirects, the publish-time renderer, the public blog on apps\u002Fweb and its 60-second cache. Use when adding a collection or a field, rendering a stored body, reusing the editor, renderer or media field from another module, moving the blog to another path, re-rendering live posts after a renderer upgrade or a STORAGE_PUBLIC_URL change, or working out why a published post is not live yet.","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fmodules\u002Fcms\u002Fskills\u002Fsaasaloy-cms\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M79GQ03M63V5EKSST92B3S5X","saasaloy-beta","The beta module's own procedure.","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fpackages\u002Fcli\u002Ftest\u002Ffixtures\u002Fregistry-clean\u002Fbeta\u002Fsaasaloy-beta\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M79GPXV3K8YF3M4VA0KGVE0B","helper","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fpackages\u002Fcli\u002Ftest\u002Ffixtures\u002Fregistry-broken\u002Fbad-skill\u002Fhelper\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M79GPR8EVS1YX0W8X33Q9YD8","saasaloy-update","Runbook for an AI agent that updates this project to a newer Saasaloy CLI and newer module versions with saasaloy update. Use when the owner says \"update saasaloy\", \"upgrade the CLI\", \"pull the latest modules\", \"update the base template\", \"work the merge plan\", \"clear the update notes\", when saasaloy update or saasaloy outdated --check exits 3 or 2, when a merge plan or .saasaloy\u002Fmerge-plan.md is handed to you, or when an adopted project takes its first update. Covers the CLI upgrade, the preview, --out, the file merges, the update notes and \"Notes that may apply\", --resolved and --done, a file deleted locally and --restore, a three-way or two-way base, an update that skips releases, --from, the verify commands, and the exit codes.","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fpackages\u002Fcli\u002Ftemplates\u002Fbase\u002F_agents\u002Fskills\u002Fsaasaloy-update\u002FSKILL.md",[],[]]