BD Brain Drip
Build a Claude Code Harness Extension

Step 2: Set Up Claude Code and the Plugin Skeleton

Install Claude Code, scaffold the harness-codereview plugin directory, and write the manifest that tells Claude Code which sub-agents, hooks, slash commands, and MCP servers the plugin will provide.

Prerequisites | Step 1 (architecture overview) an Anthropic API key

Install Claude Code

If you don’t already have it:

npm install -g @anthropic-ai/claude-code
claude --version

Set your API key:

export ANTHROPIC_API_KEY=sk-ant-...

Confirm Claude Code can run:

claude
> Hello!

If you see a response, you’re set. Quit with /exit.

Scaffold the Plugin Directory

Pick a working directory. The plugin lives outside any specific project so you can install it into many:

mkdir -p ~/dev/harness-codereview
cd ~/dev/harness-codereview
git init

Create the plugin’s directory layout:

mkdir -p .claude-plugin agents commands hooks skills mcp-server/src workers

Add a .gitignore:

cat > .gitignore <<'EOF'
node_modules/
dist/
*.log
.env
.env.local
EOF

The directory tree should now look like:

harness-codereview/
├── .claude-plugin/
├── .gitignore
├── agents/
├── commands/
├── hooks/
├── mcp-server/
│   └── src/
├── skills/
└── workers/

Write the Plugin Manifest

The manifest lives at .claude-plugin/plugin.json and tells Claude Code what the plugin provides. Create it:

{
  "name": "harness-codereview",
  "version": "0.1.0",
  "description": "A code-review swarm — three sub-agents (style, correctness, security) coordinated by hooks, plus a custom MCP tool server and a background audit worker.",
  "author": "Your Name",
  "license": "MIT",
  "provides": {
    "agents": [
      "style-reviewer",
      "correctness-reviewer",
      "security-reviewer"
    ],
    "commands": [
      "review",
      "review-strict",
      "review-explain"
    ],
    "hooks": [
      "PreToolUse",
      "PostToolUse",
      "Stop",
      "SessionStart"
    ],
    "mcpServers": [
      {
        "name": "harness-codereview-tools",
        "command": "node",
        "args": ["./mcp-server/dist/index.js"]
      }
    ]
  },
  "permissions": {
    "requires": [
      "Read",
      "Grep",
      "Bash"
    ],
    "denies": [
      "WebFetch"
    ]
  }
}

The provides section is documentation as much as wiring — it tells a user what they’re installing. The permissions section declares what the plugin’s hooks and sub-agents will need.

Add a Reference Settings File

Users installing the plugin need to know what settings.json configuration the plugin expects. Create settings.example.json at the plugin root:

{
  "$schema": "https://json.schemastore.org/claude-code-settings",
  "permissions": {
    "allow": ["Read", "Grep"],
    "ask": ["Edit", "Write", "Bash"],
    "deny": ["WebFetch"]
  },
  "hooks": {
    "PreToolUse": [
      { "matcher": "Bash", "command": "$CLAUDE_PLUGIN_ROOT/hooks/pre-tool-use.sh" }
    ],
    "PostToolUse": [
      { "matcher": "*", "command": "$CLAUDE_PLUGIN_ROOT/hooks/post-tool-use.sh" }
    ],
    "Stop": [
      { "command": "$CLAUDE_PLUGIN_ROOT/hooks/stop.sh" }
    ],
    "SessionStart": [
      { "command": "$CLAUDE_PLUGIN_ROOT/hooks/session-start.sh" }
    ]
  },
  "mcpServers": {
    "harness-codereview-tools": {
      "command": "node",
      "args": ["$CLAUDE_PLUGIN_ROOT/mcp-server/dist/index.js"]
    }
  }
}

$CLAUDE_PLUGIN_ROOT is a Claude Code variable that resolves to the plugin’s installation directory at runtime. Using it makes the plugin portable across user installations.

Add a README Stub

Even at this early step, write a README. Future-you will thank current-you:

# harness-codereview

A Claude Code plugin that turns Claude Code into a code-review swarm.

## Install

```bash
/plugin marketplace add <your-git-host>/harness-codereview
/plugin install harness-codereview@harness-codereview

Use

/review                    # full review on the current change
/review-strict             # extra-strict review
/review-explain <finding>  # explain a finding in detail

What’s inside

  • 3 sub-agents (style, correctness, security)
  • 4 hooks (PreToolUse, PostToolUse, Stop, SessionStart)
  • 3 slash commands
  • 1 MCP server exposing eslint / ruff / semgrep
  • 1 background audit worker (runs on session start)

## Verify the Skeleton

You should now have:

harness-codereview/ ├── .claude-plugin/plugin.json ├── .gitignore ├── README.md ├── agents/ (empty — Step 3) ├── commands/ (empty — Step 6) ├── hooks/ (empty — Step 4) ├── mcp-server/src/ (empty — Step 5) ├── settings.example.json ├── skills/ (empty) └── workers/ (empty — Step 7)


Commit:

```bash
git add .
git commit -m "Plugin skeleton: manifest, settings, README"

What This Step Did

You exercised two course concepts from Module 02:

You did not yet write any agent logic or hook code. That happens in the next steps. The skeleton is here so the rest of the work has a place to land.


Next: Step 3 - Define Three Sub-Agents →