agents365-ai/365-skills

obsidian-dev-rules

Authoritative reference and rules for developing for Obsidian — building TypeScript plugins (Plugin lifecycle, manifest.json, commands, settings, modals, views, ribbon/status bar), the Vault and Editor APIs, the event system, Markdown post-processing & code…

查看源码
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

Obsidian Dev Rules

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`.

When to use this skill

  • Building, debugging, or reviewing an Obsidian plugin (lifecycle, commands, settings, UI, views).
  • Reading/writing notes via the Vault API; manipulating the active note via the Editor API.
  • Subscribing to events, registering Markdown post-processors / code-block processors, or

CodeMirror 6 editor extensions.

  • Building a theme (CSS variables, theme.css, manifest) or snippets.
  • Releasing/submitting a plugin or theme to the community directory.

Reference index — load the file you need

FileCovers
references/plugin-basics.mdProject setup, manifest.json, Plugin lifecycle (onload/onunload), resource registration & cleanup, events, dev workflow / hot reload, debugging
references/vault-and-editor.mdVault 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.mdCommands (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.mdThemes (CSS variables, theme.css/manifest, body classes, snippets), submitting plugins & themes, developer policies & guidelines

Cheat sheet

ts
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*/ }
}
ts
// 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>/.

Hard rules

  • Use `this.app`, never the global `app` (global exists for debugging only and may be removed).
  • Register everything that needs teardown via 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.

  • Never use innerHTML / outerHTML / insertAdjacentHTML with dynamic content — build DOM with

createEl() / createDiv() / createSpan().

  • Prefer the Vault API over the Adapter API; use 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.

  • For the active note, edit via the Editor interface, not Vault.modify — it preserves the

cursor and selection.

  • Don't store references to view instances; Obsidian may recreate them — fetch with

getLeavesOfType() / getActiveViewOfType().

  • Don't set default hotkeys for distributed plugins (OS-dependent, conflict-prone). UI text is

sentence case. Use CSS classes + Obsidian CSS variables, not hardcoded inline styles.

  • `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.

  • Release: GitHub release whose tag equals the manifest `version`, with main.js,

manifest.json, and optional styles.css attached as individual binary assets (not zipped).

  • Use async/await (not Promise chains); const/let (not var).
来自同一仓库

更多 Skills

全部 Skills
agents365-ai
社区

mermaid-skill

Generate Mermaid diagrams (.mmd) and export to PNG/SVG/PDF using mmdc CLI or Kroki API. USE THIS SKILL when user mentions diagram, flowchart, sequence diagram, class diagram, ER diagram, state machine, architecture, visualize, git graph, 画图, 架构图, 流程图, 时序图, 类图, ER图, 甘特图, 状态机. PROACTIVELY USE when explaining ANY system with 3+ components, API flows, authentication sequences, class hierarchies, database schemas, or state machines. Supports 17+ diagram types with fully automatic layout.

安装量
1
GitHub Stars
84
最近更新
10月3日
agents365-ai
社区

drawio-skill

Create, edit, synchronize, inspect, test, and publish editable draw.io diagrams. Use when the user explicitly requests draw.io/diagrams.net, needs a polished architecture, ERD, UML, sequence, C4, SysML, BPMN, network, swimlane, ML, or infrastructure diagram, wants code/IaC/SQL/OpenAPI/AsyncAPI/Protobuf converted into a diagram, or wants an existing diagram queried, reviewed, diffed, restyled, kept in sync, or made interactive. Prefer Mermaid/PlantUML elsewhere when the requested artifact is diag

安装量
9
GitHub Stars
48
最近更新
9月11日
agents365-ai
社区

agent-native-design

Use when designing, reviewing, or refactoring a CLI that must serve AI agents alongside humans, or when converting an API or SDK into an agent-usable CLI interface.

安装量
3
GitHub Stars
48
最近更新
9月11日
agents365-ai
社区

assetseeker

Search free commercial-use creative assets across multiple online sources — photos, illustrations, icons, video footage, music, sound effects, and fonts. Use when the user needs to find assets for videos, PPTs, articles, or any content creation. Trigger on phrases like "find me a photo of", "search for icons", "I need background music", "find video footage", "search fonts", "找一张图片", "搜素材", "帮我找图标/视频/音乐/字体". Covers Pexels, Unsplash, Pixabay, Iconify, Freesound, Google Fonts and more — with API-ba

安装量
3
GitHub Stars
48
最近更新
9月11日