Creating Plugins

Modular9's plugin system is filesystem-based. Every specialist node on the canvas is backed by a plugin — a directory containing manifest files and optional skill files. This guide walks you through creating your own plugin from scratch.

Plugin Directory Structure

Plugins live in src/plugins/. Create a new subdirectory with a kebab-case ID for your plugin:

src/plugins/
  my-specialist/
    .claude-plugin/
      plugin.json       ← Anthropic standard manifest
    modular9.json       ← Modular9 extensions
    skills/
      domain-focus/
        SKILL.md        ← Skill definition

New format vs. legacy format

Modular9 supports two plugin formats. The new format (shown above) splits metadata across three files in the Anthropic-aligned structure. The legacy format uses a single flat plugin.json at the plugin root. Both formats are loaded by the registry — use the new format for any plugin you create today.

Step 1: Create the Anthropic Manifest

Create .claude-plugin/plugin.json. This file follows the Anthropic Claude plugin standard:

{
  "name": "My Specialist",
  "version": "1.0.0",
  "description": "Expert in [domain] with focus on [specific capability]",
  "author": "Your Name"
}

| Field | Type | Description | |-------|------|-------------| | name | string | Display name shown on the node card | | version | string | Semver string — start at 1.0.0 | | description | string | Short description for the plugin card and search | | author | string | Author or team name |

Step 2: Create the Modular9 Manifest

Create modular9.json alongside the .claude-plugin/ directory. This is where Modular9-specific configuration lives:

{
  "id": "my-specialist",
  "icon": "brain",
  "color": "#6366f1",
  "category": "dev",
  "systemPrompt": "You are a senior expert in [domain]. Your role is to...",
  "connectors": []
}

Modular9 Manifest Fields

| Field | Type | Required | Description | |-------|------|----------|-------------| | id | string | Yes | Kebab-case slug — must match the directory name | | icon | string | Yes | Lucide icon name (e.g., brain, code, shield) | | color | string | Yes | Hex color for the pack badge and node accent | | category | string | Yes | See valid categories below | | systemPrompt | string | Recommended | Domain-expert LLM system prompt (150–250 words) | | connectors | array | No | Empty for specialist plugins; used for connector plugins |

Valid Categories

"dev"        → DevPack
"growth"     → GrowthPack
"content"    → ContentPack
"finance"    → FinancePack
"security"   → SecurityPack
"data"       → DataPack
"ops"        → OpsPack
"frontend"   → BuildPack
"social"     → SocialPack
"agency"     → AgencyPack
"media"      → MediaPack
"creator"    → CreatorPack
"integrations"
"knowledge-work"

Writing an effective system prompt

A good system prompt declares the agent's role, lists 2–3 behavioral rules, and specifies the expected output format. Keep it between 150–250 words. The system prompt is the most important factor in how well a specialist node performs — don't leave it empty.

System Prompt Example

You are a senior backend architect specializing in distributed systems and API design.
Your role is to analyze requirements and produce actionable architecture plans.

When producing architecture plans:
- Specify service boundaries, data ownership, and communication patterns
- Identify single points of failure and mitigation strategies
- Recommend database schemas, caching layers, and event streaming where appropriate
- Format all output as structured markdown with clear sections: Overview, Services, Data Layer, Trade-offs

Behavioral rules:
1. Always justify technology choices with specific reasoning
2. Flag scalability bottlenecks explicitly — never assume they'll be solved later
3. When requirements are ambiguous, state your assumptions before proceeding

Expected output format:
- Architecture overview (2–3 sentences)
- Service map with responsibilities
- Database schema outline
- Key risks and mitigations
- Recommended next steps

Skills are markdown files that inject domain knowledge into the LLM call at execution time. Create a skills/ directory with one subdirectory per skill:

skills/
  deep-focus-area/
    SKILL.md
  secondary-expertise/
    SKILL.md

SKILL.md Format

---
name: Deep Focus Area
description: Apply specialized framework for X
category: [matches plugin category]
---

# Deep Focus Area

When processing requests, explicitly apply the following framework:

## Framework Step 1: [Name]
[Detailed instructions for the LLM...]

## Framework Step 2: [Name]
[Detailed instructions...]

Always conclude with:
- Summary of findings
- Severity or priority rating
- Recommended next actions

YAML frontmatter fields:

| Field | Required | Description | |-------|----------|-------------| | name | Yes | Display name for the skill | | description | Yes | One-line description | | category | No | Category tag for filtering |

Skills are additive

At execution time, all skill files for a plugin are loaded and injected between the system prompt and the user message. Skills extend the base expertise without replacing it. Multiple skills stack in alphabetical directory order.

Step 4: Verify the Plugin Loads

After creating your plugin files, restart the dev server. The plugin registry auto-discovers all directories under src/plugins/ on each request in development mode.

Check the terminal for any validation errors:

npm run dev
# Look for: [plugin-registry] Loaded 121 plugins
# Or: [plugin-registry] Error loading my-specialist: [error details]

If your plugin fails to load, the registry logs the specific Zod validation error and skips that plugin — it will not crash the server.

Common validation errors:

  • Missing id — modular9.json must have id matching the directory name
  • Invalid category — must be one of the valid category strings above
  • Malformed JSON — check for trailing commas or missing quotes

Creating a Connector Plugin

Connector plugins bypass the LLM entirely and call an external service's REST API directly. They appear in the Connectors tab rather than the specialist sidebar.

Step 1: Register the Connector ID

Add your connector ID to CONNECTOR_PLUGIN_IDS in src/lib/plugins/packs.ts:

export const CONNECTOR_IDS = [
  'github',
  'slack',
  // ... existing connectors
  'my-service',  // ← add here
] as const

Step 2: Add to CONNECTOR_CATEGORIES

In src/components/canvas/panels/connectors-panel.tsx, add your connector to the appropriate category group:

const CONNECTOR_CATEGORIES = [
  {
    label: 'My Category',
    items: [
      { id: 'my-service', name: 'My Service', icon: 'plug' },
    ],
  },
  // ...
]

Step 3: Add to CONNECTOR_META

In src/lib/canvas/connector-meta.ts, add auth fields and action definitions to CONNECTOR_META:

'my-service': {
  label: 'My Service',
  authFields: [
    { key: 'apiKey', label: 'API Key', type: 'password' },
    { key: 'baseUrl', label: 'Base URL', type: 'text' },
  ],
  actions: [
    { value: 'send_message', label: 'Send Message' },
    { value: 'create_record', label: 'Create Record' },
  ],
},

Step 4: Implement the Executor

Add a case to the executeConnector switch in src/lib/execution/connector-executor.ts:

case 'my-service':
  return executeMyService(config, upstreamContent, signal, timeout)

Then implement the executor function:

async function executeMyService(
  config: ConnectorConfig,
  upstreamContent: string,
  signal?: AbortSignal,
  timeout?: number
): Promise<ConnectorResult> {
  const { apiKey, baseUrl } = config.auth
  const { action } = config

  const response = await fetch(`${baseUrl}/api/${action}`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ content: upstreamContent }),
    signal,
  })

  if (!response.ok) {
    throw new Error(`My Service API error: ${response.status} ${response.statusText}`)
  }

  const data = await response.json()
  return {
    success: true,
    data,
    raw: JSON.stringify(data),
  }
}

Connector plugins need a skills directory

Even connector plugins must have at least one skills/*/SKILL.md file due to plugin registry requirements. Create a minimal skills/connector/SKILL.md with a name and description — the content is not used during execution since connectors bypass the LLM.

Step 5: Create the plugin.json Files

Connector plugins follow the same manifest structure, but category should be set to "integrations":

// .claude-plugin/plugin.json
{
  "name": "My Service",
  "version": "1.0.0",
  "description": "Send content to My Service via REST API",
  "author": "Your Name"
}
// modular9.json
{
  "id": "my-service",
  "icon": "plug",
  "color": "#6366f1",
  "category": "integrations",
  "systemPrompt": "",
  "connectors": ["my-service"]
}

Plugin Pack Assignment

Plugins are automatically grouped into packs based on their category field. Pack definitions live in src/lib/plugins/packs.ts. If you want your plugin displayed in an existing pack, use the matching category value.

To create an entirely new pack:

  1. Add a new pack definition to the PACKS array in src/lib/plugins/packs.ts
  2. Add the new category string to the PLUGIN_CATEGORIES Zod enum in src/types/plugin.ts
  3. Add the category to CATEGORY_LABELS in src/lib/plugins/packs.ts

Testing Your Plugin

Once your plugin loads, drag it onto the canvas from the sidebar and connect it to a workflow:

  1. Open the sidebar and find your plugin in its pack (collapse all packs and search by name)
  2. Drag it onto the canvas
  3. Connect a Trigger node to your specialist node
  4. Click Run and inspect the output

Check the Output tab accordion to see:

  • What input your node received
  • The full response text
  • Token counts (prompt / completion / total)
  • Any errors or failures

Next Steps