refern.
Extensions

Quickstart

Build, load and change your first refern extension in about five minutes with a developer folder, then pack it to share. Includes steps for AI coding agents.

This walkthrough uses the app plugin template (Tier 2). The theme and decoder templates work the same way; see the end of this page.

You need refern 1.13 or later and Node 20 or later.

1. Copy the template

Copy app-plugin-starter from the starter templates (plugins/templates/ in refern-labs/refern-extensions) to a new folder, for example color-tools. Open a terminal in it.

 npm install npm run build # writes dist/index.html and dist/sidebar.html 

2. Load it as a developer folder

  1. In refern, open the Extensions page.
  2. Select Load Developer Folder... and choose the folder that holds manifest.json.
  3. refern shows what the extension may do (here: read your library). Select Install.

The extension now shows in the Installed list, turned on. A developer folder is loaded in place: refern reads its files from this folder, so you never pack or install again while you work.

3. Try it

  1. Select a few items in the grid, right-click one and choose Show Selection Summary.... A dialog lists the items and their most used tags.
  2. Select one item and open the metadata sidebar. The Starter Details panel at the end shows its thumbnail, size and tags.
  3. On the Extensions page, the extension has a setting, Items to list in the summary. Change it and open the dialog again.
  4. In Settings > Shortcuts > Extensions and tools, give Show Selection Summary... a key.

4. Change it

Open src/summary.tsx and change a label, then:

 npm run dev # rebuilds dist/ each time you save 
You changedTo see it
Code, HTML or CSS (anything in dist/)Close and open the dialog again. For a sidebar panel, select another item and back.
manifest.json (commands, panels, scopes, settings)On the Extensions page, turn the extension off and on, or select Load Developer Folder... again.
A theme file (Tier 1)In Settings > General > Custom Theme, choose Built-in, then your theme again.
decoder.wasm (Tier 3)Select Load Developer Folder... again (or turn it off and on). New files get the new decoder; to redo files it already previewed, raise version in manifest.json first.

After a manifest change, check it:

 npm run validate # refern-cli plugin validate . 

5. Make it yours

  1. In manifest.json, set your own id (lowercase reverse-domain, such as yourname.color-tools), name, author and description. The id is permanent: an update must keep it.
  2. Ask only for the scopes you need (read, write, organize) and list each web host you call in permissions.network.
  3. Build your feature with the SDK reference. Remove the starter's command, panels and setting that you do not use from the manifest, and their pages from vite.config.ts.

6. Pack and share

 npm run build npm run pack # writes yourname.color-tools-0.1.0.refernplugin 

Others install that file with Install from File... on the Extensions page. Raise version in manifest.json for each new release.

To list it in the extension directory, where people install it with one click and get your updates, see Publish to the extension directory.

Theme and decoder in brief

Theme (theme-starter). No build step. Load the folder with Load Developer Folder..., then choose it in Settings > General > Custom Theme. Edit theme-dark.json and theme-light.json; check with npx @refern/cli plugin validate . (it checks the colors and their contrast).

Format decoder (wasm-decoder-starter). Needs Rust 1.90 or later:

 rustup target add wasm32-unknown-unknown node build.mjs # builds decoder.wasm node check-decoder.mjs # runs it the way refern does npx @refern/cli plugin validate . 

Load the folder with Load Developer Folder... and add a .qoi image to your library: its thumbnail comes from your decoder.

Build with an AI coding agent

The templates are ready for AI coding agents. Each has an AGENTS.md with the rules for that tier, and a CLAUDE.md that includes it. Give the agent llms-full.md too: it is the whole reference in one file. Then paste a prompt from Start with one prompt.

ToolSteps
Claude CodeRun claude in the template folder. It reads CLAUDE.md, which includes AGENTS.md. Paste the prompt and add llms-full.md to the folder or the message.
CursorOpen the template folder. Add llms-full.md to the chat with @ (or put it in the folder), and paste the prompt in Agent mode.
AntigravityOpen the template folder as the workspace, add llms-full.md to it, and give the agent the prompt.
WindsurfOpen the template folder, add llms-full.md to the folder or mention it in Cascade, and paste the prompt.
GitHub CopilotOpen the template folder in VS Code, use Copilot Chat in Agent mode, attach AGENTS.md and llms-full.md, and paste the prompt.

Many agents read AGENTS.md by themselves. If yours does not, attach it to the chat. Let the agent run the build and validate in its terminal; you load the folder in refern (step 2) and reload after each change (step 4). When something fails, paste refern's message or the validator's output to the agent.

When something goes wrong

What you seeWhat to do
"This is not a valid refern extension." when you load the folderRun npx @refern/cli plugin validate . and fix what it lists.
"needs refern X or later" (app_too_old)Lower minAppVersion to your refern version, or update refern.
A dialog or panel stays emptyRun npm run build: the manifest names files in dist/ that are not there yet.
scope_required or forbidden from a callAdd the scope to permissions.scopes, then turn the extension off and on.
network_refused from refern.net.fetchAdd the exact host to permissions.network; use https:.
needs_user_actionCall ui.openDialog, ui.openExternal or ui.pickExportFolder from a click.
no_host ("This page is not running inside refern.")The page runs in a browser tab. Load it in refern instead.
A decoder makes no thumbnailsRun node check-decoder.mjs; check that the module imports nothing and that the extension is turned on.

Build refern extensions

Themes, app plugins and file format decoders for refern: how the three tiers work, which to choose, working templates, and prompts for AI coding agents.

Manifest reference

Every key of a refern extension's manifest.json (apiVersion 1), its limits and checks, contribution points, and .refernplugin packaging.

On this page

1. Copy the template2. Load it as a developer folder3. Try it4. Change it5. Make it yours6. Pack and shareTheme and decoder in briefBuild with an AI coding agentWhen something goes wrong