logseq-plugin-dev
1
总安装量
1
周安装量
#54819
全站排名
安装命令
npx skills add https://github.com/neversight/skills.sh_feed --skill logseq-plugin-dev
Agent 安装分布
mcpjam
1
claude-code
1
kilo
1
replit
1
junie
1
windsurf
1
Skill 文档
Logseq Plugin Development
This skill helps you build high-quality plugins for Logseq using the @logseq/libs SDK.
Core Concepts
Logseq plugins run in a sandboxed iframe and communicate with the main Logseq application via an RPC bridge.
- Manifest: Every plugin needs a
package.jsonwith alogseqfield. - SDK: Use
@logseq/libsto interact with Logseq. - Lifecycle: Use
logseq.ready(main)to initialize your plugin.
Getting Started
- Scaffold:
- Basic TS:
assets/template/ - React + Vite:
assets/template-react/
- Basic TS:
- Install Dependencies:
npm install @logseq/libs. - Build: Use Vite or a similar bundler to package your JS/TS code.
- Load: In Logseq, go to
Settings -> Plugins -> Developer Mode, thenLoad unpacked pluginand select your plugin directory.
Common Workflows
1. Registering Commands
Use logseq.Editor.registerSlashCommand or logseq.App.registerCommandPalette.
2. Interacting with Content
- Read:
logseq.Editor.getCurrentPageBlocksTree() - Write:
logseq.Editor.insertBlock(parentBlockId, content) - Query:
logseq.DB.datascriptQuery(query)
3. UI and Theming
- UI: Use
logseq.provideUIto inject HTML orlogseq.showMainUIto show a full-screen app. - Theming: Use Logseq CSS variables (e.g.,
--ls-primary-background-color) for consistency.
Resources
- API Reference: See references/api.md for a detailed list of available methods and examples.
- Boilerplates:
- assets/template/ (Vanilla TS)
- assets/template-react/ (React + Vite)
- Examples: See references/examples.md for common patterns like mind maps and slash commands.