| name | obsidian-hello-world |
| description | Create a minimal working Obsidian plugin with commands, settings, modals, and ribbon icons.
Use when building your first plugin feature, testing your setup,
or learning basic Obsidian plugin patterns.
Trigger with phrases like "obsidian hello world", "first obsidian plugin",
"obsidian quick start", "simple obsidian plugin".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Glob |
| version | 1.13.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","obsidian","testing","getting-started"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Obsidian Hello World
Overview
Build a minimal working Obsidian plugin demonstrating the five core building blocks: commands (palette + editor + checkCallback), settings tab with typed config, ribbon icons, modals, and status bar. Every snippet uses real Obsidian API.
Prerequisites
- Completed
obsidian-install-auth setup (symlinked dev vault, npm run dev working)
- Build pipeline producing
main.js from src/main.ts
Instructions
Step 1: Define Typed Settings
import {
App, Editor, MarkdownView, Modal, Notice,
Plugin, PluginSettingTab, Setting, TFile
} from 'obsidian';
interface MyPluginSettings {
greeting: string;
showRibbon: boolean;
dateFormat: string;
}
const DEFAULT_SETTINGS: MyPluginSettings = {
greeting: 'Hello, Obsidian!',
showRibbon: true,
dateFormat: 'YYYY-MM-DD',
};
Step 2: Create the Plugin Class with Commands
export default class MyPlugin extends Plugin {
settings: ;
() {
.();
(..) {
.(, , {
(..);
});
}
.({
: ,
: ,
: (..),
});
.({
: ,
: ,
: {
editor.(..);
},
});
.({
: ,
: ,
: {
view = ...();
(view) {
(!checking) {
text = view..();
count = text.().().;
();
}
;
}
;
},
});
.({
: ,
: ,
: (., ..).(),
});
.({
: ,
: ,
: {
today = ().().(, );
editor.(today);
},
});
statusEl = .();
statusEl.();
.(
...(, {
view = ...();
(view) {
count = view..().().().;
statusEl.();
} {
statusEl.();
}
})
);
.( (., ));
.();
}
() {
.();
}
() {
. = .({}, , .());
}
() {
.(.);
}
}