Authoritative reference for building Obsidian plugins (TypeScript, Plugin lifecycle, manifest.json, commands, settings, modals, views, ribbon/status bar) and themes (CSS variables, theme.css). Covers Vault/Editor APIs, event system, Markdown post-processing, CodeMirror 6 extensions, and community submission.
Ships in obsidian-dev-rules. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Obsidian is extended two ways: plugins (TypeScript against the Obsidian API) and themes/snippets
(CSS). This skill mirrors the official developer docs at https://docs.obsidian.md so you can build and
review Obsidian plugins/themes without re-fetching. The API ships as the obsidian npm package; the
canonical starting point is the obsidian-sample-plugin.
theme.css, manifest) or snippets.| File | Covers |
|---|---|
references/plugin-basics.md | Project setup, manifest.json, Plugin lifecycle (onload/onunload), resource registration & cleanup, events, dev workflow / hot reload, debugging |
references/vault-and-editor.md | Vault API (read/cachedRead/create/modify/process/delete, TFile/TFolder, adapter, normalizePath), Editor API, Markdown post-processing & code-block processors, CodeMirror 6 editor extensions |
references/ui.md | Commands (callback variants, hotkeys), Settings (PluginSettingTab, load/saveData, Setting controls), Modals (Modal/SuggestModal/FuzzySuggestModal), Views (ItemView, registerView, workspace leaves), ribbon/status bar |
references/themes-and-release.md | Themes (CSS variables, theme.css/manifest, body classes, snippets), submitting plugins & themes, developer policies & guidelines |
import { Plugin, Notice, MarkdownView, TFile, normalizePath } from 'obsidian';
export default class MyPlugin extends Plugin {
async onload() {
await this.loadSettings();
this.addRibbonIcon('dice', 'Greet', () => new Notice('Hello!'));
this.addCommand({ id: 'do-x', name: 'Do X', callback: () => {/* ... */} });
this.addSettingTab(new MySettingTab(this.app, this));
// Auto-cleaned on unload — always register through these:
this.registerEvent(this.app.vault.on('modify', (f) => {/* ... */}));
this.registerInterval(window.setInterval(() => {/* ... */}, 1000));
this.registerDomEvent(document, 'click', () => {/* ... */});
}
onunload() { /* release anything NOT registered via register*/ }
}
// Vault: prefer process() over read()+modify(); use cachedRead() for display only.
const file = this.app.vault.getFileByPath('Notes/x.md');
await this.app.vault.process(file, (data) => data.replace('foo', 'bar'));
// Editor of the active note (preserves cursor/selection):
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
view?.editor.replaceSelection(view.editor.getSelection().toUpperCase());
Plugin files: manifest.json + main.js (+ optional styles.css) in <vault>/.obsidian/plugins/<id>/.
Theme files: manifest.json + theme.css in <vault>/.obsidian/themes/<name>/.
this.app, never the global app (global exists for debugging only and may be removed).registerEvent / registerInterval /
registerDomEvent / addCommand / registerView / registerMarkdownPostProcessor — Obsidian
auto-cleans those on unload. Manually release anything else in onunload(). Leaked listeners/
intervals degrade Obsidian after the plugin is disabled.innerHTML / outerHTML / insertAdjacentHTML with dynamic content — build DOM with
createEl() / createDiv() / createSpan().getFileByPath() (not iterate-all); always
normalizePath() user-supplied paths. Use process() (atomic) instead of sequential
read()+modify() to avoid data loss; cachedRead() only when you won't write it back.Vault.modify — it preserves the
cursor and selection.getLeavesOfType() / getActiveViewOfType().manifest.json required fields: id, name, version (semver x.y.z), minAppVersion,
description, author, isDesktopOnly. id must not contain "obsidian"; name is Basic-Latin,
no emoji/punctuation except hyphens.version, with main.js,
manifest.json, and optional styles.css attached as individual binary assets (not zipped).async/await (not Promise chains); const/let (not var).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/obsidian-dev-rules:obsidian-dev-rulesfrom obsidian-dev-rules
npx claudepluginhub agents365-ai/365-skills --plugin obsidian-dev-rulesOther plugins' skills for the same job