Learn-skills.dev logseq-plugin-dev
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.
install
source · Clone the upstream repo
git clone https://github.com/NeverSight/learn-skills.dev
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/0xrichardh/agent-skills/logseq-plugin-dev" ~/.claude/skills/neversight-learn-skills-dev-logseq-plugin-dev && rm -rf "$T"
manifest:
data/skills-md/0xrichardh/agent-skills/logseq-plugin-dev/SKILL.mdsource content
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
with apackage.json
field.logseq - SDK: Use
to interact with Logseq.@logseq/libs - Lifecycle: Use
to initialize your plugin.logseq.ready(main)
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
, thenSettings -> Plugins -> Developer Mode
and select your plugin directory.Load unpacked plugin
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
to inject HTML orlogseq.provideUI
to show a full-screen app.logseq.showMainUI - Theming: Use Logseq CSS variables (e.g.,
) for consistency.--ls-primary-background-color
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.