Skip to content
Back to skills

Ape Add Extension

ASecurity

Write an extension (a package any product can add: its table, actions, event, default rule, admin section, app screen) and install it with ape add, or remove it with ape remove: the key prefix, the grant, privacy, outbound(ctx), the ./admin and ./app entries.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
developmentgoshellreactnodetestinggitapidatabase

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add BuffApe/BuffApe --skill ape-add-extension --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ape Add Extension?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ape Add Extension
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/buffape-ape-add-extension/badge)](https://www.skillsdirectory.com/skills/buffape-ape-add-extension)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ape-add-extension
description: "Write an extension (a package any product can add: its table, actions, event, default rule, admin section, app screen) and install it with ape add, or remove it with ape remove: the key prefix, the grant, privacy, outbound(ctx), the ./admin and ./app entries."
---

# Write and install an extension

Start one with `ape create <name> --extension`.

Read `node_modules/@buffcore/cli/docs/EXTENSIONS.md` with the installed CLI. In a BuffCore checkout, read `docs/EXTENSIONS.md`.

After adding or updating an extension, approve each new data destination with a literal `yes` on a TTY (`ape extension approve-places` lists any still missing); installation's `--yes` never approves places, and `ape check places` refuses them until a person does (see the extension guide).

Run `pnpm ape check compatible ./packages/<key>` before installing or publishing; `ape add`, product CI and `ape catalog sign --check <dir>…` share this suite; `not yet` is reported as incomplete and does not block installation, signing or CI.

An extension is a module written apart from the products that compose it, as its own package. `defineExtension` from `@buffcore/server` is `defineModule` plus `reads` (the sensitive kinds it holds or receives), `hosts` (the only hosts it calls) and `places` (where it sends people's data outside the product: `{ host, who, fields }`, each host one of its `hosts`); a product grants exactly that in `buffcore.config.ts`, and `ape add` writes the grant after showing it. Copy BuffCore's `packages/feedback` (members send feedback from the app, the Owner closes it in the console): it has every part. The rules, and what each check says, are in the extension guide under "Writing and installing one".

**To use one BuffCore publishes** (`@buffcore/payments` takes Stripe payments; `@buffcore/feedback`; `@buffcore/waitlist`), only step 5 applies: stop `ape dev`, then `pnpm ape add @buffcore/payments` (it installs at the release the product uses). Then read its README, which is its guide (the setup, the route line the app needs, the functions your code may call): `apps/api/node_modules/@buffcore/<key>/README.md` in the product, `packages/<key>/README.md` in BuffCore. Its screens are already approved (the ape-prototype skill).

1. **The package** (in a product, `packages/<key>/`, which its `pnpm-workspace.yaml` already lists): a `package.json` with its name, `"type": "module"`, and `exports` for `.` (the server entry, `./src/server.ts`), `./admin` and `./app` when it has screens. Copy `packages/feedback/package.json` as the example, with three differences inside a product: every `@buffcore/*` range (dependencies, peers and dev dependencies) is the product's BuffCore version, not `workspace:*`; it has no `build` script and no `publishConfig` until it is published; and `react` and `react-dom` are pinned to the versions the product's `apps/app` pins. The screen packages (`@buffcore/admin-shell`, `@buffcore/app-shell`, `@buffcore/ui`, `@buffcore/sdk`, `react`, `expo-router`) are optional peers, and again dev dependencies for its tests. Copy `tsconfig.json` and `vitest.config.ts` from `packages/feedback` (the views run on the view-test preset; a server test starts with `// @vitest-environment node`). Inside a product, its `vitest.config.ts` imports only `coverage` from `../../vitest.shared.ts` (the product's has no `maxWorkers`: drop that import and its line). Its coverage floors are that file's `coverage({ lines, branches, functions, statements })`: set them from the first run's numbers, and raise them in the same commit whenever coverage rises.
2. **Its key starts everything it names.** The key is lowercase letters and digits (`feedback`). Tables `<key>_…`; events and jobs `<key>.…`; every string `<key>.…`; routes under `/v1/ext/<key>/` (the console's under `/v1/admin/ext/<key>/`, with `roles: ['owner']`: its console routes and screens are the Owner's); anything it adds to another package's registry, keyed `<key>.…` (an action's default rule is keyed by the action, `<key>.<name>`, already). The app refuses to start on anything else and names it.
3. **The server entry** (`src/server.ts`: `export default defineExtension({ key, description, requires: { buffcore: '<range>' }, reads, hosts, entities, migrations, routes, events, contributes, catalog })`), as the ape-add-module skill builds a module:
   - for cooperation by key, list its own described actions or reads in `offers`, other packages' keys in `uses`, and call `useAction(ctx, key, input?)` (`@buffcore/server`); handle `done`, `waiting` and `missing`, with no install dependency (see "Extensions using each other" in the extension guide);
   - an entity with its sensitive marks, and `reads` naming every kind its marks and its routes' `carries` hold (`content` for people's own words);
   - Every route has an English AI `description` (outcome, input, answer and when to use it; one to three sentences, at least 40 characters), and either `mcp: true` or a short `closedBecause` reason, never both (CONNECT.md, The AI door).
   - routes with a `name` each (the ape-add-route skill); an action machines may call has `action` and `mcp: true`;
   - its event declared in `events` and recorded with `emit` from `@buffcore/modules/events`, in the write's transaction;
   - a default rule for an action, `defaultRules` from `@buffcore/modules/rules`, in `contributes`;
   - a line on Operations › Status when it runs something (a sync, a queue): `statusChecks` from `@buffcore/modules/ops`, `statusChecks.add({ '<key>.<name>': { name, check, screen } })` in `contributes`; its check runs as the extension, so `outbound(ctx)` reaches only its hosts (`packages/payments/src/status.ts` is one);
   - with tables, privacy's export and delete: `onExportAccount` and `onDeleteAccount` from `@buffcore/modules/privacy`, in `contributes` (the app refuses to start without both);
   - outside calls only through `outbound` from `@buffcore/server`, in its handlers and jobs: `outbound(ctx).request({ url })` reaches only its `hosts`, refusing any other before it sends; `ape check boundaries` refuses `fetch` and imports of `node:http`, `node:https`, `node:net`, `node:dgram`, `node:child_process`, `node:fs` and `node:worker_threads` in its code (tests and tools aside). No `plugin` (raw HTTP) and no `hooks` (the kernel's hook points).
4. **The `./admin` and `./app` entries hold views only at first**, so the prototype can show them (step 7). `./admin` (`src/admin/index.ts`): the view (props in, UI out) exported by name, its strings as `catalog`, and `export default defineAdminExtension({ key, sections: [], catalog })` with `defineAdminExtension` from `@buffcore/admin-shell`. `./app` (`src/app/index.ts`): the view exported by name, its `catalog`, and `export default defineAppExtension({ key, catalog })` with `defineAppExtension` from `@buffcore/app-shell`. The wired screens come in step 8, once the look is approved.
5. **Install it** in the product now: the prototype reads the extension's views and strings through the generated `extensions.gen.ts`, so its scenes show only once it is installed. `pnpm ape add ./packages/<key>` (a folder inside the product's repository) or `pnpm ape add <name>` (`<name>@<version>` for one version; any name outside `@buffcore/*` comes only from the signed catalog, its integrity and licence checked once installed). A git URL, a tarball and a folder outside the repository are refused: publish it to a library's catalog instead (see "The catalog" in the extension guide). It shows what it asks for (with its places and its package.json's `license`) and asks (`--yes` when nobody is there to answer), adds the dependency to each surface, writes the grant into `buffcore.config.ts` and one generated list per surface (`src/extensions.gen.ts` in `apps/api`, `apps/admin` and `apps/app`: never edit them; the product's `apps/api/src/app.ts`, admin and app shell already read them), and migrates the development database.
6. **Its first migration:** with its entities written and `migrations/index.ts` exporting `[]`, run `pnpm ape migrate create <key> init`, add the file to `migrations/index.ts`, and round-trip it: `pnpm ape migrate`, `pnpm ape migrate down`, `pnpm ape migrate` (the ape-migration skill). A migration clash names the key, migration and both packages. It stops the migration and blocks deploy.
7. **Its screens are approved in the product's prototype first** (the ape-prototype skill): list the views in the product's `apps/admin/src/prototype/views.ts` and `apps/app/src/prototype/views.ts`, add their scenes to `prototype/scenes.ts`, snapshot, commit, get the commit approved. An approved view changes only through the prototype, so a link to the new app screen from one of the product's existing screens is a prototype change too; until then the screen is reached by its route.
8. **Wire the screens** once approved. `./admin`: the wired screen (`useAdmin` and `usePagedRoute` from `@buffcore/admin-shell`) and its section in `sections`, replacing `[]`. The section's key starts with its key, its screens' paths start with `/ext/<key>`, and its strings with `<key>.`; the section shows after the product's. To put it under a heading, give it `group`: a key of its own (`<key>.admin.group`, in its catalog) or one of BuffCore's (`admin.rail.group.members`, `.product`, `.system`), whose end it joins. Its `icon` is an `IconName`, listed in `packages/admin-shell/src/components/icons.ts` (the console's set; see the ape-admin-screen skill). `./app`: the wired screen (`useShell` and `errorText` from `@buffcore/app-shell`, `useAction` from `@buffcore/sdk/react`, `router` from `expo-router` for back); its icons are `IconName`s listed in `packages/ui/src/icons.ts` (the app's set, which differs from the console's). Then give the app screen a route, one line: `apps/app/src/app/<key>.tsx` holding `export { <Screen> as default } from '<name>/app';`.
9. **Test it:** a server test on its own small product, never the product's `buffcore.config.ts` (a package any product can add depends on no one product): an inline `defineProduct({ name: 'test', buffcore: BUFFCORE_VERSION, platforms: ['web'], locales: ['en', 'es'], features: ['api-keys'], extensions: { <key>: { package: '<name>', reads: [...], hosts: [...] } } })` with its own grant, and `createProductTestApp({ product, modules: [...buffcoreModules(product), <extension>] })` from `@buffcore/modules/testing`, as `packages/feedback/src/feedback.test.ts` does. Through each door: a member's call, the Owner's, a machine's (`{ kind: 'client', via: 'api-key', … }`) meeting the default rule; privacy's export and delete; its views as HTML in English, Spanish and `en-XA`, as `packages/feedback/src/views.test.tsx` does. A machine's call needs the `api-keys` feature, which is why the test product turns it on.
10. **Check it:** `pnpm ape manifest` lists it with `owner: extension` and what it reads and calls; `pnpm verify` passes (`ape check boundaries` holds it to the module rules too, and to `outbound(ctx)`).

**Take it out:** `pnpm ape remove <key>` removes its grant, its generated imports and its dependencies, and names the files that still import it (its route line). It refuses while the development database still holds its tables; `--drop-tables` drops them first with its own down migrations, and its data goes with them.

**Rename its key** by editing the literal grant in `buffcore.config.ts`, then running `ape add` with the package name or path. `ape add` and `ape remove` regenerate the imports from the config text and apply pending migrations using the new lists. Pass `--no-migrate` to defer applying pending migrations, then run `ape migrate`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.