Agent skill · software engineering · jeremylongshore
obsidian-sdk-patterns
Production-ready Obsidian plugin patterns: typed settings with migration,
Why this skill is useful
Provides six production patterns for Obsidian plugin development that prevent common bugs and improve reliability, which the AI wouldn't generate on its own.
What it needs
About 7k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
Obsidian SDK Patterns Overview Six production patterns that prevent the most common Obsidian plugin bugs: lost settings on upgrade, null-reference crashes on deleted files, memory leaks from unregistered events, stale metadata, and UI jank from rapid file changes. Each pattern is self-contained and copy-pasteable. Prerequisites A working Obsidian plugin (see obsidian-core-workflow-a) TypeScript strict mode enabled ("strictNullChecks": true in tsconfig) Familiarity with Plugin.onload() / onunload() lifecycle Instructions Step 1: Typed settings with versioned migration Settings break when you add or rename fields between releases. Version the settings object and migrate on load so existing users keep their data. Why: Object.assign({}, DEFAULTS, raw) handles new fields added in patch releases. The explicit migration block handles renames and type changes between major versions. Step 2: Safe vault operations (check-before-act) The Vault API throws if you create a file that exists or read one that was deleted between your check and your call. Wrap every operation. Step 3: Event management with automatic cleanup Every this.registerEvent(...) call in onload() is automatically cleaned up when the plugin unloads. Never use raw addEventListener or app.vault.on() without registering -- those leak. Anti-pattern to avoid: Step 4: Workspace layout manipulation Open files in specific panes, split views, and restore layout state. Step 5: Metadata cache for fast queries metadataCache is Obsidian's pre-parsed index of all vault files. It avoids reading file content for frontmatter, tags, links, and headings. Step 6: Debounced file modification handlers Plugins that react to file changes (auto-save, indexing, sync) fire too often without debouncing. Obsidian's vault modify event fires on every keystroke when live preview is active. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/obsidian-sdk-patterns--3a0911