[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M793PZFH2R5DSDRD8DFHQFTT":3,"skill-same:01M793PZFH2R5DSDRD8DFHQFTT":58},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":6,"ownerHtmlUrl":40,"ownerBlogUrl":41,"ownerDescription":42,"updatedAt":43,"install":44,"resources":57},"01M793PZFH2R5DSDRD8DFHQFTT","obsidian-core-workflow-b",null,"Build advanced Obsidian plugin features: custom views (ItemView), modals,\neditor commands with selection manipulation, status bar, context menus,\nand Vault API file creation\u002Fmodification. Use when adding UI components\nto a plugin, building sidebar views, or creating modal dialogs.\nTrigger with \"obsidian modal\", \"obsidian custom view\", \"obsidian sidebar\",\n\"obsidian context menu\", \"obsidian editor command\", \"obsidian UI\".","jukeyman\u002Fjukeyman-skills","jukeyman","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142960420?v=4","01M78FR4Y3DHMMCBCC0GXXNB3F","RICK JEFFERSON","01M78FR4Z8RVQRAD31Y5J7V6EB",1,"MIT","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--obsidian-pack--obsidian-core-workflow-b\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: obsidian-core-workflow-b\ndescription: |\n  Build advanced Obsidian plugin features: custom views (ItemView), modals,\n  editor commands with selection manipulation, status bar, context menus,\n  and Vault API file creation\u002Fmodification. Use when adding UI components\n  to a plugin, building sidebar views, or creating modal dialogs.\n  Trigger with \"obsidian modal\", \"obsidian custom view\", \"obsidian sidebar\",\n  \"obsidian context menu\", \"obsidian editor command\", \"obsidian UI\".\nallowed-tools: Read, Write, Edit, Bash(npm:*), Grep\nversion: 2.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\ncompatible-with: claude-code, codex, openclaw\ntags: [obsidian, ui-components, views, modals, editor]\n---\n\n# Obsidian Core Workflow B: Advanced Plugin Features\n\n## Overview\n\nAdd production UI to an existing Obsidian plugin: custom sidebar views,\nmodal dialogs with forms, fuzzy-search suggestion popups, editor commands\nthat manipulate selections, status bar widgets, context menus, and\nprogrammatic file creation via the Vault API. Every snippet is a complete,\ncopy-pasteable class.\n\n## Prerequisites\n\n- A working plugin built with `obsidian-core-workflow-a` (or equivalent)\n- `npm install --save-dev obsidian` already done\n- Familiarity with the Plugin lifecycle (`onload` \u002F `onunload`)\n\n## Instructions\n\n### Step 1: Custom sidebar view (ItemView)\n\nA custom view registers a new panel type that can live in the left or right sidebar.\n\n```typescript\n\u002F\u002F src\u002Fviews\u002FStatsView.ts\nimport { ItemView, WorkspaceLeaf, TFile } from \"obsidian\";\n\nexport const STATS_VIEW_TYPE = \"vault-stats-view\";\n\nexport class StatsView extends ItemView {\n  constructor(leaf: WorkspaceLeaf) {\n    super(leaf);\n  }\n\n  getViewType(): string {\n    return STATS_VIEW_TYPE;\n  }\n\n  getDisplayText(): string {\n    return \"Vault Stats\";\n  }\n\n  getIcon(): string {\n    return \"bar-chart-2\";\n  }\n\n  async onOpen() {\n    const container = this.containerEl.children[1];\n    container.empty();\n    container.addClass(\"stats-view\");\n\n    container.createEl(\"h4\", { text: \"Vault Statistics\" });\n    const listEl = container.createEl(\"ul\");\n\n    const files = this.app.vault.getMarkdownFiles();\n    let totalWords = 0;\n\n    for (const file of files) {\n      const content = await this.app.vault.cachedRead(file);\n      totalWords += content.split(\u002F\\s+\u002F).filter(Boolean).length;\n    }\n\n    listEl.createEl(\"li\", { text: `Notes: ${files.length}` });\n    listEl.createEl(\"li\", { text: `Total words: ${totalWords.toLocaleString()}` });\n    listEl.createEl(\"li\", {\n      text: `Avg words\u002Fnote: ${files.length ? Math.round(totalWords \u002F files.length) : 0}`,\n    });\n\n    \u002F\u002F Refresh button\n    const btn = container.createEl(\"button\", { text: \"Refresh\" });\n    btn.addEventListener(\"click\", () => this.onOpen());\n  }\n\n  async onClose() {\n    \u002F\u002F cleanup if needed\n  }\n}\n```\n\nRegister and open it from your main plugin:\n\n```typescript\n\u002F\u002F In your Plugin's onload():\nimport { StatsView, STATS_VIEW_TYPE } from \".\u002Fviews\u002FStatsView\";\n\nthis.registerView(STATS_VIEW_TYPE, (leaf) => new StatsView(leaf));\n\nthis.addCommand({\n  id: \"open-stats-view\",\n  name: \"Open vault stats\",\n  callback: () => this.activateStatsView(),\n});\n\nthis.addRibbonIcon(\"bar-chart-2\", \"Vault Stats\", () => this.activateStatsView());\n\n\u002F\u002F Helper to open or reveal the view\nasync activateStatsView() {\n  const { workspace } = this.app;\n  let leaf = workspace.getLeavesOfType(STATS_VIEW_TYPE)[0];\n\n  if (!leaf) {\n    const rightLeaf = workspace.getRightLeaf(false);\n    if (rightLeaf) {\n      await rightLeaf.setViewState({ type: STATS_VIEW_TYPE, active: true });\n      leaf = rightLeaf;\n    }\n  }\n  if (leaf) workspace.revealLeaf(leaf);\n}\n\n\u002F\u002F In onunload():\nthis.app.workspace.detachLeavesOfType(STATS_VIEW_TYPE);\n```\n\n### Step 2: Modal dialogs\n\n**Confirmation modal** -- returns a boolean via callback:\n\n```typescript\n\u002F\u002F src\u002Fmodals\u002FConfirmModal.ts\nimport { App, Modal, Setting } from \"obsidian\";\n\nexport class ConfirmModal extends Modal {\n  private resolved = false;\n  constructor(\n    app: App,\n    private message: string,\n    private onResult: (confirmed: boolean) => void\n  ) {\n    super(app);\n  }\n\n  onOpen() {\n    const { contentEl } = this;\n    contentEl.createEl(\"h3\", { text: \"Confirm\" });\n    contentEl.createEl(\"p\", { text: this.message });\n\n    new Setting(contentEl)\n      .addButton((btn) =>\n        btn.setButtonText(\"Cancel\").onClick(() => this.close())\n      )\n      .addButton((btn) =>\n        btn\n          .setButtonText(\"Confirm\")\n          .setCta()\n          .onClick(() => {\n            this.resolved = true;\n            this.close();\n          })\n      );\n  }\n\n  onClose() {\n    this.onResult(this.resolved);\n    this.contentEl.empty();\n  }\n}\n```\n\n**Text input modal** -- collects a single string:\n\n```typescript\n\u002F\u002F src\u002Fmodals\u002FInputModal.ts\nimport { App, Modal, Setting } from \"obsidian\";\n\nexport class InputModal extends Modal {\n  private value = \"\";\n  constructor(\n    app: App,\n    private title: string,\n    private placeholder: string,\n    private onSubmit: (value: string | null) => void\n  ) {\n    super(app);\n  }\n\n  onOpen() {\n    const { contentEl } = this;\n    contentEl.createEl(\"h3\", { text: this.title });\n\n    new Setting(contentEl).addText((text) =>\n      text\n        .setPlaceholder(this.placeholder)\n        .onChange((v) => (this.value = v))\n    );\n\n    new Setting(contentEl)\n      .addButton((btn) =>\n        btn.setButtonText(\"Cancel\").onClick(() => {\n          this.onSubmit(null);\n          this.close();\n        })\n      )\n      .addButton((btn) =>\n        btn\n          .setButtonText(\"OK\")\n          .setCta()\n          .onClick(() => {\n            this.onSubmit(this.value);\n            this.close();\n          })\n      );\n  }\n\n  onClose() {\n    this.contentEl.empty();\n  }\n}\n```\n\n### Step 3: Fuzzy suggestion modal (SuggestModal)\n\nOpens a searchable list. Users type to filter, then pick an item.\n\n```typescript\n\u002F\u002F src\u002Fmodals\u002FNotePicker.ts\nimport { App, FuzzySuggestModal, TFile } from \"obsidian\";\n\nexport class NotePicker extends FuzzySuggestModal\u003CTFile> {\n  constructor(app: App, private onPick: (file: TFile) => void) {\n    super(app);\n  }\n\n  getItems(): TFile[] {\n    return this.app.vault.getMarkdownFiles();\n  }\n\n  getItemText(file: TFile): string {\n    return file.path;\n  }\n\n  onChooseItem(file: TFile): void {\n    this.onPick(file);\n  }\n}\n\n\u002F\u002F Usage in a command:\nthis.addCommand({\n  id: \"pick-note\",\n  name: \"Pick a note\",\n  callback: () => {\n    new NotePicker(this.app, (file) => {\n      new Notice(`Selected: ${file.basename}`);\n    }).open();\n  },\n});\n```\n\n### Step 4: Editor commands with selection manipulation\n\n`editorCallback` gives you the CodeMirror `Editor` and the active `MarkdownView`.\n\n```typescript\n\u002F\u002F Wrap selection in callout\nthis.addCommand({\n  id: \"wrap-callout\",\n  name: \"Wrap selection in callout\",\n  editorCallback: (editor, view) => {\n    const selection = editor.getSelection();\n    if (!selection) {\n      new Notice(\"Select text first\");\n      return;\n    }\n    const callout = `> [!note]\\n> ${selection.split(\"\\n\").join(\"\\n> \")}`;\n    editor.replaceSelection(callout);\n  },\n});\n\n\u002F\u002F Insert ISO timestamp at cursor\nthis.addCommand({\n  id: \"insert-timestamp\",\n  name: \"Insert timestamp\",\n  editorCallback: (editor) => {\n    const now = new Date().toISOString().slice(0, 19).replace(\"T\", \" \");\n    editor.replaceSelection(now);\n  },\n});\n\n\u002F\u002F Sort selected lines alphabetically\nthis.addCommand({\n  id: \"sort-lines\",\n  name: \"Sort selected lines\",\n  editorCallback: (editor) => {\n    const selection = editor.getSelection();\n    if (!selection) return;\n    const sorted = selection.split(\"\\n\").sort((a, b) => a.localeCompare(b)).join(\"\\n\");\n    editor.replaceSelection(sorted);\n  },\n});\n```\n\n### Step 5: Status bar items\n\nStatus bar items sit at the bottom of the Obsidian window.\n\n```typescript\n\u002F\u002F In onload():\nconst statusEl = this.addStatusBarItem();\nstatusEl.setText(\"Words: --\");\n\n\u002F\u002F Update word count when active file changes\nthis.registerEvent(\n  this.app.workspace.on(\"active-leaf-change\", async () => {\n    const view = this.app.workspace.getActiveViewOfType(MarkdownView);\n    if (view) {\n      const content = view.editor.getValue();\n      const count = content.split(\u002F\\s+\u002F).filter(Boolean).length;\n      statusEl.setText(`Words: ${count}`);\n    } else {\n      statusEl.setText(\"Words: --\");\n    }\n  })\n);\n```\n\n### Step 6: Context menus\n\nAdd items to the file explorer right-click menu and the editor right-click menu.\n\n```typescript\n\u002F\u002F File explorer context menu -- only on markdown files\nthis.registerEvent(\n  this.app.workspace.on(\"file-menu\", (menu, file) => {\n    if (file instanceof TFile && file.extension === \"md\") {\n      menu.addItem((item) => {\n        item\n          .setTitle(\"Copy note title\")\n          .setIcon(\"clipboard-copy\")\n          .onClick(async () => {\n            await navigator.clipboard.writeText(file.basename);\n            new Notice(`Copied: ${file.basename}`);\n          });\n      });\n    }\n  })\n);\n\n\u002F\u002F Editor context menu -- insert current date\nthis.registerEvent(\n  this.app.workspace.on(\"editor-menu\", (menu, editor) => {\n    menu.addItem((item) => {\n      item\n        .setTitle(\"Insert today's date\")\n        .setIcon(\"calendar\")\n        .onClick(() => {\n          const today = new Date().toISOString().slice(0, 10);\n          editor.replaceSelection(today);\n        });\n    });\n  })\n);\n```\n\n### Step 7: File creation and modification via Vault API\n\nProgrammatically create, read, and modify notes.\n\n```typescript\n\u002F\u002F Create a daily note if it doesn't exist\nasync ensureDailyNote(): Promise\u003CTFile> {\n  const today = new Date().toISOString().slice(0, 10);\n  const path = `Daily\u002F${today}.md`;\n\n  const existing = this.app.vault.getAbstractFileByPath(path);\n  if (existing instanceof TFile) return existing;\n\n  \u002F\u002F Ensure folder\n  const folder = this.app.vault.getAbstractFileByPath(\"Daily\");\n  if (!folder) await this.app.vault.createFolder(\"Daily\");\n\n  const content = `# ${today}\\n\\n## Tasks\\n\\n- [ ] \\n\\n## Notes\\n\\n`;\n  return this.app.vault.create(path, content);\n}\n\n\u002F\u002F Append text to the end of a note\nasync appendToNote(file: TFile, text: string): Promise\u003Cvoid> {\n  const current = await this.app.vault.read(file);\n  await this.app.vault.modify(file, current + \"\\n\" + text);\n}\n\n\u002F\u002F Batch-update frontmatter tag across files\nasync addTagToFolder(folder: string, tag: string): Promise\u003Cnumber> {\n  const files = this.app.vault.getMarkdownFiles()\n    .filter((f) => f.path.startsWith(folder + \"\u002F\"));\n\n  let count = 0;\n  for (const file of files) {\n    let content = await this.app.vault.read(file);\n    if (content.startsWith(\"---\")) {\n      \u002F\u002F Has frontmatter -- insert tag\n      content = content.replace(\n        \u002F^(---\\n[\\s\\S]*?)(---)$\u002Fm,\n        `$1tags:\\n  - ${tag}\\n$2`\n      );\n    } else {\n      \u002F\u002F No frontmatter -- add it\n      content = `---\\ntags:\\n  - ${tag}\\n---\\n${content}`;\n    }\n    await this.app.vault.modify(file, content);\n    count++;\n  }\n  return count;\n}\n```\n\n## Output\n\nAfter applying these patterns your plugin gains:\n- A sidebar panel (ItemView) with live vault statistics\n- Confirmation and text-input modal dialogs\n- A fuzzy-search note picker\n- Editor commands that transform selected text\n- A live word-count status bar widget\n- Right-click context menu extensions\n- Vault API helpers for file creation and batch modification\n\n## Error Handling\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| View not appearing | Forgot `registerView` in `onload` | Must register before opening |\n| `getRightLeaf` returns null | No sidebar available | Guard with `if (leaf)` |\n| Modal closes without callback | Event order issue | Set result before calling `this.close()` |\n| `editorCallback` greyed out | No active markdown editor | Use `callback` instead for non-editor commands |\n| Context menu item missing | Wrong event name | `file-menu` for explorer, `editor-menu` for editor |\n| `vault.create` throws | File already exists at path | Check with `getAbstractFileByPath` first |\n| Stale `cachedRead` data | Cache not yet updated | Use `vault.read` when freshness matters |\n\n## Examples\n\n**Open a view in a new tab instead of sidebar:**\n```typescript\nconst leaf = this.app.workspace.getLeaf(\"tab\");\nawait leaf.setViewState({ type: STATS_VIEW_TYPE, active: true });\n```\n\n**Promise-based confirm modal:**\n```typescript\nfunction confirm(app: App, msg: string): Promise\u003Cboolean> {\n  return new Promise((resolve) => {\n    new ConfirmModal(app, msg, resolve).open();\n  });\n}\n\n\u002F\u002F Usage:\nif (await confirm(this.app, \"Delete all empty notes?\")) {\n  \u002F\u002F proceed\n}\n```\n\n## Resources\n\n- [ItemView API](https:\u002F\u002Fdocs.obsidian.md\u002FReference\u002FTypeScript+API\u002FItemView)\n- [Modal API](https:\u002F\u002Fdocs.obsidian.md\u002FReference\u002FTypeScript+API\u002FModal)\n- [FuzzySuggestModal](https:\u002F\u002Fdocs.obsidian.md\u002FReference\u002FTypeScript+API\u002FFuzzySuggestModal)\n- [Editor API](https:\u002F\u002Fdocs.obsidian.md\u002FReference\u002FTypeScript+API\u002FEditor)\n- [Vault API](https:\u002F\u002Fdocs.obsidian.md\u002FReference\u002FTypeScript+API\u002FVault)\n- [Lucide Icons](https:\u002F\u002Flucide.dev\u002Ficons\u002F)\n\n## Next Steps\n\n- Set up hot-reload development: see `obsidian-local-dev-loop`\n- Apply production safety patterns: see `obsidian-sdk-patterns`\n- Handle common errors: see `obsidian-common-errors`\n","# Obsidian Core Workflow B: Advanced Plugin Features\n\n## Overview\n\nAdd production UI to an existing Obsidian plugin: custom sidebar views,\nmodal dialogs with forms, fuzzy-search suggestion popups, editor commands\nthat manipulate selections, status bar widgets, context menus, and\nprogrammatic file creation via the Vault API. Every snippet is a complete,\ncopy-pasteable class.\n\n## Prerequisites\n\n- A working plugin built with `obsidian-core-workflow-a` (or equivalent)\n- `npm install --save-dev obsidian` already done\n- Familiarity with the Plugin lifecycle (`onload` \u002F `onunload`)\n\n## Instructions\n\n### Step 1: Custom sidebar view (ItemView)\n\nA custom view registers a new panel type that can live in the left or right sidebar.\n\n```typescript\n\u002F\u002F src\u002Fviews\u002FStatsView.ts\nimport { ItemView, WorkspaceLeaf, TFile } from \"obsidian\";\n\nexport const STATS_VIEW_TYPE = \"vault-stats-view\";\n\nexport class StatsView extends ItemView {\n  constructor(leaf: WorkspaceLeaf) {\n    super(leaf);\n  }\n\n  getViewType(): string {\n    return STATS_VIEW_TYPE;\n  }\n\n  getDisplayText(): string {\n    return \"Vault Stats\";\n  }\n\n  getIcon(): string {\n    return \"bar-chart-2\";\n  }\n\n  async onOpen() {\n    const container = this.containerEl.children[1];\n    container.empty();\n    container.addClass(\"stats-view\");\n\n    container.createEl(\"h4\", { text: \"Vault Statistics\" });\n    const listEl = container.createEl(\"ul\");\n\n    const files = this.app.vault.getMarkdownFiles();\n    let totalWords = 0;\n\n    for (const file of files) {\n      const content = await this.app.vault.cachedRead(file);\n      totalWords += content.split(\u002F\\s+\u002F).filter(Boolean).length;\n    }\n\n    listEl.createEl(\"li\", { text: `Notes: ${files.length}` });\n    listEl.createEl(\"li\", { text: `Total words: ${totalWords.toLocaleString()}` });\n    listEl.createEl(\"li\", {\n      text: `Avg words\u002Fnote: ${files.length ? Math.round(totalWords \u002F files.length) : 0}`,\n    });\n\n    \u002F\u002F Refresh button\n    const btn = container.createEl(\"button\", { text: \"Refresh\" });\n    btn.addEventListener(\"click\", () => this.onOpen());\n  }\n\n  async onClose() {\n    \u002F\u002F cleanup if needed\n  }\n}\n```\n\nRegister and open it from your main plugin:\n\n```typescript\n\u002F\u002F In your Plugin's onload():\nimport { StatsView, STATS_VIEW_TYPE } from \".\u002Fviews\u002FStatsView\";\n\nthis.registerView(STATS_VIEW_TYPE, (leaf) => new StatsView(leaf));\n\nthis.addCommand({\n  id: \"open-stats-view\",\n  name: \"Open vault stats\",\n  callback: () => this.activateStatsView(),\n});\n\nthis.addRibbonIcon(\"bar-chart-2\", \"Vault Stats\", () => this.activateStatsView());\n\n\u002F\u002F Helper to open or reveal the view\nasync activateStatsView() {\n  const { workspace } = this.app;\n  let leaf = workspace.getLeavesOfType(STATS_VIEW_TYPE)[0];\n\n  if (!leaf) {\n    const rightLeaf = workspace.getRightLeaf(false);\n    if (rightLeaf) {\n      await rightLeaf.setViewState({ type: STATS_VIEW_TYPE, active: true });\n      leaf = rightLeaf;\n    }\n  }\n  if (leaf) workspace.revealLeaf(leaf);\n}\n\n\u002F\u002F In onunload():\nthis.app.workspace.detachLeavesOfType(STATS_VIEW_TYPE);\n```\n\n### Step 2: Modal dialogs\n\n**Confirmation modal** -- returns a boolean via callback:\n\n```typescript\n\u002F\u002F src\u002Fmodals\u002FConfirmModal.ts\nimport { App, Modal, Setting } from \"obsidian\";\n\nexport class ConfirmModal extends Modal {\n  private resolved = false;\n  constructor(\n    app: App,\n    private message: string,\n    private onResult: (confirmed: boolean) => void\n  ) {\n    super(app);\n  }\n\n  onOpen() {\n    const { contentEl } = this;\n    contentEl.createEl(\"h3\", { text: \"Confirm\" });\n    contentEl.createEl(\"p\", { text: this.message });\n\n    new Setting(contentEl)\n      .addButton((btn) =>\n        btn.setButtonText(\"Cancel\").onClick(() => this.close())\n      )\n      .addButton((btn) =>\n        btn\n          .setButtonText(\"Confirm\")\n          .setCta()\n          .onClick(() => {\n            this.resolved = true;\n            this.close();\n          })\n      );\n  }\n\n  onClose() {\n    this.onResult(this.resolved);\n    this.contentEl.empty();\n  }\n}\n```\n\n**Text input modal** -- collects a single string:\n\n```typescript\n\u002F\u002F src\u002Fmodals\u002FInputModal.ts\nimport { App, Modal, Setting } from \"obsidian\";\n\nexport class InputModal extends Modal {\n  private value = \"\";\n  constructor(\n    app: App,\n    private title: string,\n    private placeholder: string,\n    private onSubmit: (value: string | null) => void\n  ) {\n    super(app);\n  }\n\n  onOpen() {\n    const { contentEl } = this;\n    contentEl.createEl(\"h3\", { text: this.title });\n\n    new Setting(contentEl).addText((text) =>\n      text\n        .setPlaceholder(this.placeholder)\n        .onChange((v) => (this.value = v))\n    );\n\n    new Setting(contentEl)\n      .addButton((btn) =>\n        btn.setButtonText(\"Cancel\").onClick(() => {\n          this.onSubmit(null);\n          this.close();\n        })\n      )\n      .addButton((btn) =>\n        btn\n          .setButtonText(\"OK\")\n          .setCta()\n          .onClick(() => {\n            this.onSubmit(this.value);\n            this.close();\n          })\n      );\n  }\n\n  onClose() {\n    this.contentEl.empty();\n  }\n}\n```\n\n### Step 3: Fuzzy suggestion modal (SuggestModal)\n\nOpens a searchable list. Users type to filter, then pick an item.\n\n```typescript\n\u002F\u002F src\u002Fmodals\u002FNotePicker.ts\nimport { App, FuzzySuggestModal, TFile } from \"obsidian\";\n\nexport class NotePicker extends FuzzySuggestModal\u003CTFile> {\n  constructor(app: App, private onPick: (file: TFile) => void) {\n    super(app);\n  }\n\n  getItems(): TFile[] {\n    return this.app.vault.getMarkdownFiles();\n  }\n\n  getItemText(file: TFile): string {\n    return file.path;\n  }\n\n  onChooseItem(file: TFile): void {\n    this.onPick(file);\n  }\n}\n\n\u002F\u002F Usage in a command:\nthis.addCommand({\n  id: \"pick-note\",\n  name: \"Pick a note\",\n  callback: () => {\n    new NotePicker(this.app, (file) => {\n      new Notice(`Selected: ${file.basename}`);\n    }).open();\n  },\n});\n```\n\n### Step 4: Editor commands with selection manipulation\n\n`editorCallback` gives you the CodeMirror `Editor` and the active `MarkdownView`.\n\n```typescript\n\u002F\u002F Wrap selection in callout\nthis.addCommand({\n  id: \"wrap-callout\",\n  name: \"Wrap selection in callout\",\n  editorCallback: (editor, view) => {\n    const selection = editor.getSelection();\n    if (!selection) {\n      new Notice(\"Select text first\");\n      return;\n    }\n    const callout = `> [!note]\\n> ${selection.split(\"\\n\").join(\"\\n> \")}`;\n    editor.replaceSelection(callout);\n  },\n});\n\n\u002F\u002F Insert ISO timestamp at cursor\nthis.addCommand({\n  id: \"insert-timestamp\",\n  name: \"Insert timestamp\",\n  editorCallback: (editor) => {\n    const now = new Date().toISOString().slice(0, 19).replace(\"T\", \" \");\n    editor.replaceSelection(now);\n  },\n});\n\n\u002F\u002F Sort selected lines alphabetically\nthis.addCommand({\n  id: \"sort-lines\",\n  name: \"Sort selected lines\",\n  editorCallback: (editor) => {\n    const selection = editor.getSelection();\n    if (!selection) return;\n    const sorted = selection.split(\"\\n\").sort((a, b) => a.localeCompare(b)).join(\"\\n\");\n    editor.replaceSelection(sorted);\n  },\n});\n```\n\n### Step 5: Status bar items\n\nStatus bar items sit at the bottom of the Obsidian window.\n\n```typescript\n\u002F\u002F In onload():\nconst statusEl = this.addStatusBarItem();\nstatusEl.setText(\"Words: --\");\n\n\u002F\u002F Update word count when active file changes\nthis.registerEvent(\n  this.app.workspace.on(\"active-leaf-change\", async () => {\n    const view = this.app.workspace.getActiveViewOfType(MarkdownView);\n    if (view) {\n      const content = view.editor.getValue();\n      const count = content.split(\u002F\\s+\u002F).filter(Boolean).length;\n      statusEl.setText(`Words: ${count}`);\n    } else {\n      statusEl.setText(\"Words: --\");\n    }\n  })\n);\n```\n\n### Step 6: Context menus\n\nAdd items to the file explorer right-click menu and the editor right-click menu.\n\n```typescript\n\u002F\u002F File explorer context menu -- only on markdown files\nthis.registerEvent(\n  this.app.workspace.on(\"file-menu\", (menu, file) => {\n    if (file instanceof TFile && file.extension === \"md\") {\n      menu.addItem((item) => {\n        item\n          .setTitle(\"Copy note title\")\n          .setIcon(\"clipboard-copy\")\n          .onClick(async () => {\n            await navigator.clipboard.writeText(file.basename);\n            new Notice(`Copied: ${file.basename}`);\n          });\n      });\n    }\n  })\n);\n\n\u002F\u002F Editor context menu -- insert current date\nthis.registerEvent(\n  this.app.workspace.on(\"editor-menu\", (menu, editor) => {\n    menu.addItem((item) => {\n      item\n        .setTitle(\"Insert today's date\")\n        .setIcon(\"calendar\")\n        .onClick(() => {\n          const today = new Date().toISOString().slice(0, 10);\n          editor.replaceSelection(today);\n        });\n    });\n  })\n);\n```\n\n### Step 7: File creation and modification via Vault API\n\nProgrammatically create, read, and modify notes.\n\n```typescript\n\u002F\u002F Create a daily note if it doesn't exist\nasync ensureDailyNote(): Promise\u003CTFile> {\n  const today = new Date().toISOString().slice(0, 10);\n  const path = `Daily\u002F${today}.md`;\n\n  const existing = this.app.vault.getAbstractFileByPath(path);\n  if (existing instanceof TFile) return existing;\n\n  \u002F\u002F Ensure folder\n  const folder = this.app.vault.getAbstractFileByPath(\"Daily\");\n  if (!folder) await this.app.vault.createFolder(\"Daily\");\n\n  const content = `# ${today}\\n\\n## Tasks\\n\\n- [ ] \\n\\n## Notes\\n\\n`;\n  return this.app.vault.create(path, content);\n}\n\n\u002F\u002F Append text to the end of a note\nasync appendToNote(file: TFile, text: string): Promise\u003Cvoid> {\n  const current = await this.app.vault.read(file);\n  await this.app.vault.modify(file, current + \"\\n\" + text);\n}\n\n\u002F\u002F Batch-update frontmatter tag across files\nasync addTagToFolder(folder: string, tag: string): Promise\u003Cnumber> {\n  const files = this.app.vault.getMarkdownFiles()\n    .filter((f) => f.path.startsWith(folder + \"\u002F\"));\n\n  let count = 0;\n  for (const file of files) {\n    let content = await this.app.vault.read(file);\n    if (content.startsWith(\"---\")) {\n      \u002F\u002F Has frontmatter -- insert tag\n      content = content.replace(\n        \u002F^(---\\n[\\s\\S]*?)(---)$\u002Fm,\n        `$1tags:\\n  - ${tag}\\n$2`\n      );\n    } else {\n      \u002F\u002F No frontmatter -- add it\n      content = `---\\ntags:\\n  - ${tag}\\n---\\n${content}`;\n    }\n    await this.app.vault.modify(file, content);\n    count++;\n  }\n  return count;\n}\n```\n\n## Output\n\nAfter applying these patterns your plugin gains:\n- A sidebar panel (ItemView) with live vault statistics\n- Confirmation and text-input modal dialogs\n- A fuzzy-search note picker\n- Editor commands that transform selected text\n- A live word-count status bar widget\n- Right-click context menu extensions\n- Vault API helpers for file creation and batch modification\n\n## Error Handling\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| View not appearing | Forgot `registerView` in `onload` | Must register before opening |\n| `getRightLeaf` returns null | No sidebar available | Guard with `if (leaf)` |\n| Modal closes without callback | Event order issue | Set result before calling `this.close()` |\n| `editorCallback` greyed out | No active markdown editor | Use `callback` instead for non-editor commands |\n| Context menu item missing | Wrong event name | `file-menu` for explorer, `editor-menu` for editor |\n| `vault.create` throws | File already exists at path | Check with `getAbstractFileByPath` first |\n| Stale `cachedRead` data | Cache not yet updated | Use `vault.read` when freshness matters |\n\n## Examples\n\n**Open a view in a new tab instead of sidebar:**\n```typescript\nconst leaf = this.app.workspace.getLeaf(\"tab\");\nawait leaf.setViewState({ type: STATS_VIEW_TYPE, active: true });\n```\n\n**Promise-based confirm modal:**\n```typescript\nfunction confirm(app: App, msg: string): Promise\u003Cboolean> {\n  return new Promise((resolve) => {\n    new ConfirmModal(app, msg, resolve).open();\n  });\n}\n\n\u002F\u002F Usage:\nif (await confirm(this.app, \"Delete all empty notes?\")) {\n  \u002F\u002F proceed\n}\n```\n\n## Resources\n\n- [ItemView API](https:\u002F\u002Fdocs.obsidian.md\u002FReference\u002FTypeScript+API\u002FItemView)\n- [Modal API](https:\u002F\u002Fdocs.obsidian.md\u002FReference\u002FTypeScript+API\u002FModal)\n- [FuzzySuggestModal](https:\u002F\u002Fdocs.obsidian.md\u002FReference\u002FTypeScript+API\u002FFuzzySuggestModal)\n- [Editor API](https:\u002F\u002Fdocs.obsidian.md\u002FReference\u002FTypeScript+API\u002FEditor)\n- [Vault API](https:\u002F\u002Fdocs.obsidian.md\u002FReference\u002FTypeScript+API\u002FVault)\n- [Lucide Icons](https:\u002F\u002Flucide.dev\u002Ficons\u002F)\n\n## Next Steps\n\n- Set up hot-reload development: see `obsidian-local-dev-loop`\n- Apply production safety patterns: see `obsidian-sdk-patterns`\n- Handle common errors: see `obsidian-common-errors`\n",{"name":5,"tags":24,"author":30,"license":15,"version":31,"description":32,"allowed-tools":33,"compatible-with":34},[25,26,27,28,29],"obsidian","ui-components","views","modals","editor","Jeremy Longshore \u003Cjeremy@intentsolutions.io>","2.0.0","Build advanced Obsidian plugin features: custom views (ItemView), modals,\neditor commands with selection manipulation, status bar, context menus,\nand Vault API file creation\u002Fmodification. Use when adding UI components\nto a plugin, building sidebar views, or creating modal dialogs.\nTrigger with \"obsidian modal\", \"obsidian custom view\", \"obsidian sidebar\",\n\"obsidian context menu\", \"obsidian editor command\", \"obsidian UI\".\n","Read, Write, Edit, Bash(npm:*), Grep","claude-code, codex, openclaw","main","99825ad3f3bcc6597ddcc7294a14e6e922f2b67b","skills\u002Fsaas-packs--obsidian-pack--obsidian-core-workflow-b",0,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills","https:\u002F\u002Fgithub.com\u002Fjukeyman","https:\u002F\u002FRJBUSINESSSOLUTIONS.ORG","Credit and Finance Expert | Developer\r\n\r\nI'm Rick Jefferson, a seasoned credit and finance expert with over a decade of experience in financial literacy,","2026-07-13 07:03:29",{"source":8,"skillName":5,"commands":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add jukeyman\u002Fjukeyman-skills --skill obsidian-core-workflow-b",{"tool":50,"command":51},"bunx","bunx skills add jukeyman\u002Fjukeyman-skills --skill obsidian-core-workflow-b",{"tool":53,"command":54},"pnpm","pnpm dlx skills add jukeyman\u002Fjukeyman-skills --skill obsidian-core-workflow-b","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--obsidian-pack--obsidian-core-workflow-b\u002FSKILL.md",true,[],[59,66,73,80,87,95],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M79ANS2SM329NEP5ZCX106RR","zustand-store-creator","Create zustand store creator operations. Auto-activating skill for Frontend Development.\nTriggers on: zustand store creator, zustand store creator\nPart of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like \"zustand store creator\", \"zustand creator\", \"zustand\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzustand-store-creator\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M79AMZKP4YDEZ7EHG1Y7PP74","zero-trust-config-helper","Configure with zero trust config helper operations. Auto-activating skill for Security Advanced.\nTriggers on: zero trust config helper, zero trust config helper\nPart of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like \"zero trust config helper\", \"zero helper\", \"zero\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-config-helper\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M79AMJSBCEJQNBTYNAHYN5HM","zapier-integration-helper","Assist with zapier integration helper operations. Auto-activating skill for Business Automation.\nTriggers on: zapier integration helper, zapier integration helper\nPart of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like \"zapier integration helper\", \"zapier helper\", \"zapier\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzapier-integration-helper\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M79AHJZGVMARS13VFQYRR1MP","yaml-config-validator","Validate yaml config validator operations. Auto-activating skill for DevOps Basics.\nTriggers on: yaml config validator, yaml config validator\nPart of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like \"yaml config validator\", \"yaml validator\", \"yaml\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fyaml-config-validator\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":91,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M79AHGDZRN0020RDQSQDPAM8","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M79AHCYJ9FV9RMHQ24HDRN33","xss-vulnerability-scanner","Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals.\nTriggers on: xss vulnerability scanner, xss vulnerability scanner\nPart of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like \"xss vulnerability scanner\", \"xss scanner\", \"xss\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxss-vulnerability-scanner\u002FSKILL.md",[],[]]