DEV Community

Cover image for Building my first Claude Code Plugin
Scott Raisbeck
Scott Raisbeck

Posted on

Building my first Claude Code Plugin

I built a Claude Code plugin for Forgetful.

Forgetful is a semantic memory system I've been working on — persistent knowledge that follows you across Claude Code sessions, auto-linking between related concepts, the ability to encode repositories into searchable memories. I wrote about it here when I first released it.

I'd been using it daily for weeks, but getting other people set up had friction. MCP configuration, environment variables, picking a database backend. The kind of thing where you send someone a README and never hear from them again.

I even produced some prompt exmaples as well

Claude Code plugins seemed like the answer.


If you haven't used them, plugins are how you extend Claude Code with custom slash commands, agents, skills, and MCP servers. You can bundle up a workflow and share it — someone runs /install your-plugin and they've got your setup.

That's what I wanted. One command to get Forgetful running, plus the slash commands I actually use day-to-day packaged up so others could try them.

The idea hit around Dec 17th. By the 21st I had something working. Four days, mostly evenings.


Here's what ended up in the plugin:

/forgetful-setup — configures the MCP connection

/memory-search — semantic search across your knowledge base

/memory-save — create a memory with the Zettelkasten constraints (one concept, under 400 words, importance score, proper context)

/memory-list — browse recent memories

/memory-explore — deep graph traversal, follows links and entities

/encode-repo — point it at a codebase, extract memories from it

Plus three skills that auto-activate: guidance on when to query vs create memories, how to curate and link things properly, how to explore the knowledge graph without getting lost.

These aren't designed from scratch. They're what I was already doing, just packaged.


Building it surfaced a few gotchas worth knowing about.

Config files don't survive updates.

I shipped the first version with an .mcp.json inside the plugin. Seemed logical — the plugin needs MCP config, put it in the plugin.

Pushed an update. Reinstalled. Config gone.

Claude Code plugins install to versioned directories: ~/.claude/plugins/forgetful-plugin@1.0.0/. When you update to 1.0.1, the old directory gets wiped. Clean install. Anything you'd stored in there disappears.

The fix: don't ship config in the plugin at all. I rewrote /forgetful-setup to run claude mcp add forgetful --scope user -- uvx forgetful-ai under the hood. That writes to ~/.claude.json — the user's global config, outside the plugin directory. Survives updates.

For custom setups (Postgres, remote hosting, auth tokens), the command fetches the live docs from GitHub and walks through the options. Didn't want to duplicate configuration guidance in the plugin where it'd go stale.

Expensive commands need subagents.

/memory-explore does a five-phase traversal: query → follow links → find entities → get relationships → pull entity-linked memories. Lots of tool calls.

First version had the main model running all of it. Sonnet or Opus chewing through the traversal, context window filling up with raw graph data.

Ripped it out, made it spawn a Haiku subagent instead. Let it explore aggressively in an isolated context, filter down to what matters, hand back a summary. Costs about a tenth as much and doesn't pollute the main conversation.

I could've shipped a custom agent with the plugin, tuned specifically for graph traversal. But every agent definition you ship adds to the context window. Went with general-purpose instead — it's always available, has access to all tools, and the command prompt gives it enough guidance. Lighter footprint.

Skills aren't just fancy prompts.

I didn't get skills at first. Thought they were basically prompt files with extra steps — write some instructions in markdown, Claude reads them, done.

What I'd missed: the YAML frontmatter description actually surfaces to the model. That's how Claude decides whether to activate a skill. It's not reading every skill file on every message — it's scanning descriptions and pulling in the ones that match what you're doing.

Once that clicked, I realised how powerful they could be. I am obsessed with keeping context window down, but a few lines of frontmatter feels like a worthwhile investment for the benefit you get from skills.

I did a bit of googling and asked Claudus to do some research around skill generation, that along with a bit of trial and error I found that
write a good description (third-person, specific about when it applies) and the skill just activates when relevant. Write a vague one and Claude never finds it. The description isn't documentation for humans — it's the trigger mechanism.


If you want to try it:

/plugin marketplace add ScottRBK/forgetful-plugin
/plugin install forgetful-plugin@forgetful-plugin
/forgetful-setup
Enter fullscreen mode Exit fullscreen mode

Standard setup takes about 30 seconds.

Plugin: github.com/ScottRBK/forgetful-plugin

Main project: github.com/ScottRBK/forgetful

Top comments (0)