refern.
Extensions

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.

refern extensions add themes, tools and file formats to the app. There are three tiers. Each one is a folder with a manifest.json, packed into one .refernplugin file that people install on the Extensions page.

To see what others have made, or to install one in a click, browse the extension directory.

TierkindYou writeIt canTemplate
1themeJSON (colors as "R G B") and fontsRecolor refern and set its fonts, in a light and a dark palettetheme-starter
2appHTML, TypeScript, React (any web code)Add commands, context menu entries, dialogs, sidebar panels and overlays; read and change the library within granted scopes; call allowed web APIsapp-plugin-starter
3formatRust (or any language) to WebAssemblyMake thumbnails for file types refern does not knowwasm-decoder-starter

Which tier do I need?

  • You want refern to look different: Tier 1, a theme. No code.
  • You want to do something with the library (tag, search, import from a web service, show extra information, add a menu or a shortcut): Tier 2, an app plugin.
  • You want thumbnails for a file format (a game's sprite format, a scientific image, a font): Tier 3, a format decoder.

An extension runs in a sandbox and only gets what it asks for and the user grants. See the security model.

Start with one prompt (AI coding agents)

You can build an extension with an AI coding agent such as Claude Code, Cursor, Antigravity, Windsurf or GitHub Copilot. Open a copy of a starter template as your project, give the agent the one-file reference llms-full.md, and paste one of these prompts. Each template also has an AGENTS.md (and a CLAUDE.md that points to it) with the template's rules. The quickstart shows the steps for each tool.

Tier 1: a theme

 You are helping me build a refern theme extension (Tier 1). This folder is a copy of refern's theme-starter template. Read AGENTS.md in this folder and llms-full.md (attached) before you change anything. My theme: <describe the look, for example "a warm sepia dark theme with teal accents, and a light version">. 1. Change the id in manifest.json to "<yourname>.<theme-name>" and set name, author and description. 2. Write theme-dark.json and theme-light.json. Every color is an "R G B" triplet. Compute the WCAG contrast of every text and background pair in AGENTS.md and keep each at 4.5:1 or more. 3. Keep or remove the font (fonts list and fonts/ folder) as I asked. 4. Run: npx @refern/cli plugin validate . Fix every error and warning. 5. Tell me how to load the folder in refern and where to choose the theme. 

Tier 2: an app plugin

 You are helping me build a refern app plugin (Tier 2): TypeScript, React and Vite in a sandboxed iframe, using @refern/plugin-sdk and the controls from @refern/plugin-sdk/ui. This folder is a copy of refern's app-plugin-starter template. Read AGENTS.md in this folder and llms-full.md (attached) before you change anything. Use only the APIs and manifest keys they list. What I want: <describe the feature, for example "a command on the item context menu that finds similar images and tags them 'similar'">. 1. Change id, name, author and description in manifest.json. Ask only for the scopes and network hosts the feature needs. 2. Change the commands, menus, panels and settings in manifest.json, and the pages in src/ and vite.config.ts to match. No fetch(), no localStorage, no external URLs: use refern.net.fetch, refern.storage and bundled files. 3. Run: npm install, npm run typecheck, npm run build, npm run validate. Fix every error until all four pass. 4. Tell me how to load the folder in refern (Load Developer Folder... on the Extensions page), how to try the feature, and how to reload after a change. 

Tier 3: a format decoder

 You are helping me build a refern format decoder (Tier 3): Rust compiled to wasm32-unknown-unknown, with no imports, that turns a file's bytes into an RGBA thumbnail. This folder is a copy of refern's wasm-decoder-starter template (it decodes QOI). Read AGENTS.md in this folder and llms-full.md (attached) before you change anything. Keep src/abi.rs as it is. My format: <name, file extensions, and a link to its specification>. 1. Change id, name, description and contributes.formats[0].extensions in manifest.json, and the crate name in Cargo.toml. 2. Rewrite src/decode.rs for my format. Return Fail::Unsupported when the magic bytes do not match, never panic, and check every length. 3. Replace selfTest in check-decoder.mjs with real and broken files of my format. Run: node build.mjs and node check-decoder.mjs until it passes, then npx @refern/cli plugin validate . 4. Keep each decode within refern's limits (500,000,000 fuel, 128 MiB) and answer Unsupported for files that are too large. Measure with fuel-check if Rust can build it here. 5. Tell me how to load the folder in refern and test it. 

Get the templates

The three starter templates are in plugins/templates/ of refern-labs/refern-extensions: theme-starter, app-plugin-starter and wasm-decoder-starter. Copy the one you need to a new folder. Each one builds, validates and packs as it is.

For a minimal skeleton instead, run:

 npx @refern/cli plugin init my-plugin --template app # or theme, wasm-format 

What you need

  • refern with the Extensions page (refern 1.13 or later).
  • Node 20 or later, for refern-cli and app plugins.
  • Rust 1.90 or later with the wasm32-unknown-unknown target, for format decoders.

Reference implementations

refern's own extensions are built with the same SDK and rules. Read them for complete, tested examples in refern-labs/refern-extensions.

ExtensionTierShows how to
refern.exiftool-writer (plugins/exiftool-writer)2A metadata sidebar panel, several dialogs from one page, select and boolean settings, item and folder menus, Managed ExifTool (tools.exiftool.*).
refern.pie-menu (plugins/pie-menu)2An overlay at the pointer with a default shortcut, running app commands (commands.list, commands.execute), refern.storage.
refern.reverse-image-search (plugins/reverse-image-search)2net.fetch to several hosts, a secret setting (settings.getSecret), thumbnails as bytes, ui.openExternal, when on commands and menus, linking a better copy to the original.
refern.stock-import (plugins/stock-import)2An import dialog, imports.enqueueUrls and imports.checkOrigins, API keys sent as {{secret:...}} headers, tests of its security rules.
refern.aseprite-decoder (plugins/aseprite-decoder)3One decoder for two formats that share an extension, the pixelated flag, a viewer page.
refern.font-preview (plugins/font-preview)3Settings passed to the decoder (cfg), memory guards for compressed input, a viewer page.
Themes (plugins/themes/)1refern.theme-studio-clay, refern.theme-oled-midnight, refern.theme-daylight-paper, refern.theme-solarized-slate (a dark and a light palette in one package), and refern.theme-twilight-sky (two palettes and a backgroundImage).

In these docs

Extensions, Local API and MCP

Install extensions and themes, connect scripts and assistant apps to your library with the Local API and the built-in MCP server, open files in other apps, and set your own shortcuts.

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.

On this page

Which tier do I need?Start with one prompt (AI coding agents)Get the templatesWhat you needReference implementationsIn these docs