Agent Skills
› NeverSight/learn-skills.dev
› logseq-plugin-dev
logseq-plugin-dev
GitHub提供Logseq插件开发指南,涵盖使用@logseq/libs SDK创建、调试及重构插件。指导通过RPC通信、注册命令、操作数据块及注入UI,包含环境搭建与API参考资源。
Trigger Scenarios
创建新的Logseq插件
使用Logseq Plugin API实现功能
调试或重构现有插件
设置Logseq插件开发环境
Install
npx skills add NeverSight/learn-skills.dev --skill logseq-plugin-dev -g -y
SKILL.md
Frontmatter
{
"name": "logseq-plugin-dev",
"description": "Comprehensive guide and resources for developing Logseq plugins. Use this skill when asked to: (1) Create a new Logseq plugin, (2) Implement features using the Logseq Plugin API (Editor, App, DB, UI), (3) Debug or refactor existing Logseq plugins, (4) Set up a development environment for Logseq plugins."
}
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.
Version History
- e0220ca Current 2026-07-05 20:37


