技能 编程开发 Obsidian 插件开发规范

Obsidian 插件开发规范

v20260311
obsidian-sdk-patterns
为 Obsidian 插件开发提供 TypeScript 模式,涵盖设置迁移、文件库操作、事件管理、视图状态和生命周期,便于安全重构与复杂特性实现。
获取技能
136 次下载
概览

Obsidian SDK Patterns

Overview

Production patterns for Obsidian plugin development using the Obsidian TypeScript API. Covers vault operations, workspace management, event handling, and UI components with proper lifecycle management.

Prerequisites

  • Obsidian development environment set up
  • TypeScript compilation configured
  • Understanding of Obsidian's plugin lifecycle

Instructions

Step 1: Type-Safe Settings with Migration

Step 2: Safe Vault Operations

Step 3: Event Registration with Cleanup

Step 4: Custom View with State Persistence

For full implementation details and code examples, load: references/implementation-guide.md

Error Handling

Error Cause Solution
null file reference File deleted between check and use Always re-check with getAbstractFileByPath
Stale metadata cache Cache not updated Use this.app.metadataCache.on('changed')
Settings lost on update Missing migration logic Version settings, migrate on load
Memory leak Unregistered events Use this.registerEvent() always

Resources

Output

  • Configuration files or code changes applied to the project
  • Validation report confirming correct implementation
  • Summary of changes made and their rationale

See Obsidian Sdk Patterns implementation details for output format specifications.

Examples

Basic usage: Apply obsidian sdk patterns to a standard project setup with default configuration options.

Advanced scenario: Customize obsidian sdk patterns for production environments with multiple constraints and team-specific requirements.

信息
Category 编程开发
Name obsidian-sdk-patterns
版本 v20260311
大小 3.16KB
更新时间 2026-03-12
语言