/obsidian-pack:obsidian-local-dev-loopfrom obsidian-pack
Sets up a fast Obsidian plugin development loop: clone sample plugin, esbuild watch, symlink into vault, Ctrl+R hot reload, Chrome DevTools debugging, vitest testing.
Ships in obsidian-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Establish a fast edit-build-test cycle for Obsidian plugins. Clone the official sample plugin, run esbuild in watch mode, symlink into a dev vault, hot-reload with Ctrl+R, debug with Chrome DevTools, and run tests with vitest. Aimed at sub-second feedback from save to reload.
Start from the maintained template rather than from scratch:
set -euo pipefail
git clone https://github.com/obsidianmd/obsidian-sample-plugin.git my-plugin
cd my-plugin
rm -rf .git
git init
npm install
The sample includes esbuild.config.mjs, tsconfig.json, manifest.json, and
a working src/main.ts.
Keep a vault just for testing. Pre-populate it with sample notes.
set -euo pipefail
DEV_VAULT="$HOME/ObsidianDev"
mkdir -p "$DEV_VAULT/.obsidian/plugins"
mkdir -p "$DEV_VAULT/Test Notes"
cat > "$DEV_VAULT/Test Notes/Sample.md" << 'EOF'
---
tags: [test, sample]
---
# Sample Note
This note exists for plugin development testing.
## Section A
Some content with a [[link]] and a #tag.
## Section B
- Item 1
- Item 2
- Item 3
EOF
echo "Dev vault ready at $DEV_VAULT"
Open this vault in Obsidian: File > Open vault > select ~/ObsidianDev.
Instead of copying files after every build, symlink the entire project directory.
The build outputs main.js at the project root, right where Obsidian expects it.
set -euo pipefail
DEV_VAULT="$HOME/ObsidianDev"
PLUGIN_DIR="$(pwd)"
PLUGIN_ID=$(node -e "console.log(require('./manifest.json').id)")
# Symlink project root into vault plugins folder
ln -sfn "$PLUGIN_DIR" "$DEV_VAULT/.obsidian/plugins/$PLUGIN_ID"
# Verify
ls -la "$DEV_VAULT/.obsidian/plugins/$PLUGIN_ID/manifest.json"
echo "Symlinked $PLUGIN_ID into dev vault."
On Windows, use an admin terminal:
mklink /D "%USERPROFILE%\ObsidianDev\.obsidian\plugins\my-plugin" "%cd%"
Watch mode rebuilds main.js on every source file change (typically <50ms).
npm run dev
# esbuild watches src/ and rebuilds main.js on save
# Output: "build finished" messages in the terminal
The esbuild.config.mjs from the sample plugin already supports this.
Inline source maps are enabled in dev mode for accurate stack traces.
After esbuild rebuilds, reload the plugin in Obsidian:
Method A -- Keyboard (fastest):
Press Ctrl+R (or Cmd+R on macOS) to reload the app. This unloads all plugins
and reloads them, picking up the new main.js.
Method B -- Hot Reload plugin (automatic):
Install the Hot Reload community plugin.
It watches for main.js changes in plugin directories and auto-reloads only the
changed plugin. No manual refresh needed.
.hotreload file in your plugin directory: touch .hotreloadMethod C -- Command palette:
Press Ctrl+P, type "Reload app without saving", Enter.
Obsidian is an Electron app, so full Chrome DevTools are available.
Ctrl+Shift+I (or Cmd+Option+I on macOS) to open DevToolsconsole.log output from your pluginTips:
src/main.tsdebugger; statements in code for precise breakpointsconsole.log('[MyPlugin]', ...) prefix makes filtering easy// Add to onload() for development:
if (process.env.NODE_ENV !== "production") {
console.log("[MyPlugin] Dev mode active. Use Ctrl+Shift+I for DevTools.");
}
Obsidian plugins can be unit-tested by mocking the obsidian module.
set -euo pipefail
npm install --save-dev vitest
Create vitest.config.ts:
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
globals: true,
environment: "node",
},
});
Create a mock for the obsidian module at __mocks__/obsidian.ts:
export class Plugin {
app = {};
loadData = vi.fn().mockResolvedValue({});
saveData = vi.fn().mockResolvedValue(undefined);
addCommand = vi.fn();
addRibbonIcon = vi.fn();
addSettingTab = vi.fn();
addStatusBarItem = vi.fn().mockReturnValue({ setText: vi.fn() });
registerEvent = vi.fn();
registerInterval = vi.fn();
}
export class Notice {
constructor(public message: string) {}
}
export class PluginSettingTab {
containerEl = { empty: vi.fn(), createEl: vi.fn() };
constructor(public app: any, public plugin: any) {}
display() {}
}
export class Setting {
constructor(el: any) {}
setName = vi.fn().mockReturnThis();
setDesc = vi.fn().mockReturnThis();
addText = vi.fn().mockReturnThis();
addToggle = vi.fn().mockReturnThis();
}
export class Modal {
app: any;
contentEl = { createEl: vi.fn(), empty: vi.fn() };
constructor(app: any) { this.app = app; }
open = vi.fn();
close = vi.fn();
onOpen() {}
onClose() {}
}
Write a test:
// src/__tests__/main.test.ts
import { describe, it, expect, vi } from "vitest";
vi.mock("obsidian");
describe("Plugin settings", () => {
it("merges defaults with saved data", async () => {
const { Plugin } = await import("obsidian");
const { default: MyPlugin } = await import("../main");
const plugin = new MyPlugin() as any;
plugin.loadData = vi.fn().mockResolvedValue({ greeting: "Custom" });
plugin.saveData = vi.fn();
await plugin.loadSettings();
expect(plugin.settings.greeting).toBe("Custom");
expect(plugin.settings.showRibbon).toBe(true); // default preserved
});
});
Run tests:
npx vitest run # single run
npx vitest --watch # watch mode alongside npm run dev
Add to package.json:
{
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "node esbuild.config.mjs production",
"test": "vitest run",
"test:watch": "vitest --watch"
}
}
After completing all steps:
~/ObsidianDev with test notesnpm run dev for sub-second rebuilds on savenpm run dev, terminal 2 runs npx vitest --watch| Error | Cause | Fix |
|---|---|---|
| Symlink not working | Permission denied (Windows) | Run terminal as Administrator |
| Plugin not in list | Symlink target wrong | Verify ls -la shows correct target |
| Hot Reload not triggering | Missing .hotreload file | touch .hotreload in plugin dir |
| Source maps not showing | sourcemap: false in config | Set sourcemap: "inline" for dev |
| Build not watching | Used build instead of dev | Run npm run dev (watch mode) |
| Tests fail with import errors | Missing vitest mock | Create __mocks__/obsidian.ts |
| DevTools won't open | Keyboard shortcut conflict | Use menu: View > Toggle Developer Tools |
Quick dev startup script (dev.sh):
#!/usr/bin/env bash
set -euo pipefail
# Terminal 1: esbuild watch
npm run dev &
ESBUILD_PID=$!
# Terminal 2: vitest watch
npx vitest --watch &
VITEST_PID=$!
echo "Dev servers running. Ctrl+C to stop."
trap "kill $ESBUILD_PID $VITEST_PID" EXIT
wait
VSCode task for integrated dev:
{
"version": "2.0.0",
"tasks": [{
"label": "Obsidian Dev",
"type": "npm",
"script": "dev",
"isBackground": true,
"problemMatcher": {
"pattern": { "regexp": "^x]$" },
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "build finished"
}
}
}]
}
obsidian-core-workflow-bobsidian-sdk-patternsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
24 skills in this plugin
/obsidian-ci-integrationSet up GitHub Actions CI/CD for Obsidian plugin development.
Use when automating builds, tests, and releases for your plugin,
or setting up continuous integration for Obsidian projects.
Trigger with phrases like "obsidian CI", "obsidian github actions",
"obsidian automated build", "obsidian CI/CD".
/obsidian-common-errorsDiagnose and fix common Obsidian plugin errors and exceptions.
Use when encountering plugin errors, debugging failed operations,
or troubleshooting Obsidian plugin issues.
Trigger with phrases like "obsidian error", "fix obsidian plugin",
"obsidian not working", "debug obsidian plugin".
/obsidian-core-workflow-aCreate an Obsidian plugin from scratch with full project scaffolding.
Covers Plugin class, ribbon icons, commands, settings tab, esbuild config,
manifest.json, and building/testing. Use when starting a new plugin,
scaffolding a project, or learning the plugin lifecycle.
Trigger with "create obsidian plugin", "scaffold obsidian plugin",
"new obsidian plugin", "obsidian plugin from scratch".
/obsidian-core-workflow-bBuild advanced Obsidian plugin features: custom views (ItemView), modals,
editor commands with selection manipulation, status bar, context menus,
and Vault API file creation/modification. Use when adding UI components
to a plugin, building sidebar views, or creating modal dialogs.
Trigger with "obsidian modal", "obsidian custom view", "obsidian sidebar",
"obsidian context menu", "obsidian editor command", "obsidian UI".
/obsidian-cost-tuningOptimize Obsidian resource usage, sync storage, Publish hosting, and
third-party plugin API costs. Use when managing vault size, reducing
Sync bandwidth, controlling Publish costs, or optimizing external API
consumption from community plugins.
Trigger with phrases like "obsidian costs", "obsidian sync storage",
"optimize obsidian", "reduce obsidian costs", "obsidian publish costs".
/obsidian-data-handlingImplement vault data backup, sync, and recovery strategies.
Use when building backup features, implementing data export,
or handling vault synchronization in your plugin.
Trigger with phrases like "obsidian backup", "obsidian sync",
"obsidian data export", "vault backup strategy".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin obsidian-packOther plugins' skills for the same job