Agent skill

Logseq Plugin SDK

by logseq in logseq/logseq

Build, debug, or review Logseq plugins with the @logseq/libs SDK (TypeScript/JavaScript, iframe/shadow sandboxed).

AGPL-3.0Auto-check passedKnowledge Management

Install Logseq Plugin SDK

skills CLI
$ npx skills add logseq/logseq --skill logseq-plugin-sdk -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install logseq/logseq logseq-plugin-sdk --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/logseq/logseq.git skills-src && mkdir -p .claude/skills && cp -r skills-src/libs .claude/skills/logseq-plugin-sdk && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
logseq-plugin-sdk
GitHub stars
45k
Token cost
~2.3k tokens
SKILL.md length
752 words
Files
58 (incl. scripts)
Skills in repo
12
Repo updated
First seen
Licence
AGPL-3.0

At a glance

Build, debug, or review Logseq plugins with the @logseq/libs SDK (TypeScript/JavaScript, iframe/shadow sandboxed).

  • Works in 8 steps: Always await logseq.ready(main) before… → Detect graph mode before using DB-only… → Clean up listeners in… → …
  • The task involves writing plugin entry code
  • SKILL.md covers When to use, Golden rules, Canonical plugin skeleton and Workflow, plus 5 more sections
  • Runs JavaScript scripts from its folder; calls yarn and npm

What it does

Logseq Plugin SDK is an agent skill from logseq/logseq. Build, debug, or review Logseq plugins with the @logseq/libs SDK (TypeScript/JavaScript, iframe/shadow sandboxed). Use when the task involves writing plugin entry code, registering slash/command/UI items, provideUI/provideStyle/provideModel, settings schema, macro renderers, DB-graph properties & tags, Datascript/DSL queries, experimental APIs, theme plugins, or the logseq/ CLJS facade generated under this package.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 61 other files, including scripts (for example `.prettierrc.js`, `CHANGELOG.md` and `README.md`).

It sits in Knowledge Management, covering Hooks and plugins. It works with JavaScript, TypeScript, npm and Git. The repository describes itself as: A privacy-first, open-source platform for knowledge management and collaboration. Download link: http://github.com/logseq/logseq/releases. roadmap: https://logseq.io/p/NX4mcggEV. The licence is AGPL-3.0.

When your agent uses it

  • The task involves writing plugin entry code
  • Registering slash/command/UI items
  • ProvideUI/provideStyle/provideModel
  • Settings schema

Example prompts

  • “/logseq-plugin-sdk”

Requirements

  • Node.js

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. Always await logseq.ready(main) before touching any API. Most SDK calls are async RPC over postMessage.
  2. Detect graph mode before using DB-only APIs: await logseq.App.checkCurrentIsDbGraph(). IBatchBlock.properties is not supported for DB…
  3. Clean up listeners in logseq.beforeunload (collect the off functions returned by every onXxx hook).
  4. Batch mutations (Editor.insertBatchBlock) and debounce DB.onChanged / onBlockChanged handlers — they fire on every keystroke.
  5. Prefer CSS variables (--ls-primary-text-color, --ls-primary-background-color, --ls-border-color, …) over hard-coded colors so plugins…
  6. Unique plugin id in package.json > logseq.id; keep it lowercase-kebab. main/entry must point at a built HTML file.
  7. Experimental APIs (logseq.Experiments.*) are unstable — only use when no stable API exists and document the reason.
  8. Idents are identity. For built-in or cross-graph stable references, use idents (:logseq.property/created-at, :plugin.property./) instead…

What it can do on your machine

Read from SKILL.md and the folder at commit 22a29b3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (JavaScript, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • yarn
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • plugins-doc.logseq.com
    • discord.gg

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Logseq Plugin SDK loads about 2.3k tokens when it runs. Until then it costs about 110 tokens; SKILL.md has 752 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~110
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from logseq/logseq at commit 22a29b3, republished under its AGPL-3.0 licence (© logseq). 752 words, ~2,288 tokens.

Download SKILL.mdSave it as .claude/skills/logseq-plugin-sdk/SKILL.md (or your agent's skills folder). This skill also uses 57 other files; get the full folder from GitHub.
name
logseq-plugin-sdk
description
Build, debug, or review Logseq plugins with the `@logseq/libs` SDK (TypeScript/JavaScript, iframe/shadow sandboxed). Use when the task involves writing plugin entry code, registering slash/command/UI items, provideUI/provideStyle/provideModel, settings schema, macro renderers, DB-graph properties & tags, Datascript/DSL queries, experimental APIs, theme plugins, or the `logseq/*` CLJS facade generated under this package.

Logseq Plugin SDK Skill

This skill governs work inside libs/ — the source of the npm package @logseq/libs and its CLJS facade under cljs-sdk/. Use it whenever the user is authoring, upgrading, or debugging a Logseq plugin, or extending the SDK itself.

When to use

Trigger this skill when the task mentions any of:

  • @logseq/libs, logseq.App, logseq.Editor, logseq.DB, logseq.UI, logseq.Assets, logseq.Git, logseq.Experiments
  • provideUI / provideStyle / provideModel / useSettingsSchema / onMacroRendererSlotted
  • registerSlashCommand, registerBlockContextMenuItem, registerCommandPalette, registerUIItem
  • Plugin package.json logseq block, themes, effect plugins, iframe/shadow sandbox
  • DB-graph properties, tags/classes, property idents (:logseq.property/*, :plugin.property.<id>/*)
  • Datascript / DSL queries through logseq.DB.q / logseq.DB.datascriptQuery
  • Regenerating the CLJS SDK (yarn run generate:schema, bb libs:generate-cljs-sdk)

If the user is editing core Logseq app code (not a plugin), prefer the repo-root AGENTS.md instead.

Golden rules

  1. Always await logseq.ready(main) before touching any API. Most SDK calls are async RPC over postMessage.
  2. Detect graph mode before using DB-only APIs: await logseq.App.checkCurrentIsDbGraph(). IBatchBlock.properties is not supported for DB graphs — use Editor.upsertBlockProperty / upsertProperty instead.
  3. Clean up listeners in logseq.beforeunload (collect the off functions returned by every onXxx hook).
  4. Batch mutations (Editor.insertBatchBlock) and debounce DB.onChanged / onBlockChanged handlers — they fire on every keystroke.
  5. Prefer CSS variables (--ls-primary-text-color, --ls-primary-background-color, --ls-border-color, …) over hard-coded colors so plugins follow the active theme.
  6. Unique plugin id in package.json > logseq.id; keep it lowercase-kebab. main/entry must point at a built HTML file.
  7. Experimental APIs (logseq.Experiments.*) are unstable — only use when no stable API exists and document the reason.
  8. Idents are identity. For built-in or cross-graph stable references, use idents (:logseq.property/created-at, :plugin.property.<plugin-id>/<key>) instead of display names.

Canonical plugin skeleton

ts
import '@logseq/libs'

const offHooks: Array<() => void> = []

async function main() {
  logseq.useSettingsSchema([
    { key: 'enabled', type: 'boolean', default: true, title: 'Enabled', description: '' },
  ])

  logseq.Editor.registerSlashCommand('My Command', async () => {
    await logseq.Editor.insertAtEditingCursor('Hello from my plugin!')
  })

  offHooks.push(
    logseq.DB.onChanged(({ blocks }) => {
      // debounce in real code
    }),
  )

  logseq.beforeunload(async () => {
    offHooks.forEach((off) => off())
  })
}

logseq.ready(main).catch(console.error)

Workflow

  1. Scope the request. Is it a new plugin, a change to an existing plugin, SDK-internal work, or the CLJS facade?
  2. Load the right reference file(s) from ./guides/ (see table below) before proposing code.
  3. For SDK-internal changes, open the matching TypeScript under ./src/ (LSPlugin.ts for types, LSPlugin.user.ts for the proxy implementation, modules/ for Experiments/Storage/Request).
  4. For CLJS facade changes, regenerate with:
    bash
    yarn run generate:schema          # dist/logseq-sdk-schema.json
    bb libs:generate-cljs-sdk         # target/generated-cljs/logseq/*.cljs
    Non-proxy methods land in logseq.core; each IXxxProxy gets its own namespace (logseq.app, logseq.editor, …).
  5. Validate. Build the plugin (npm run build / parcel build) and load it via Settings → Developer mode → t p → Load unpacked plugin. Use DevTools (Cmd+Shift+I) and logseq.UI.showMsg for quick feedback.
  6. Respect the package.json rules (see guides/AGENTS.md §Configuration Fields).

Reference map (./guides/)

Load these on demand — do not dump their full contents unless needed:

FileLoad when…
guides/AGENTS.mdAuthoritative overview of SDK namespaces, package.json > logseq schema, theme plugins, UI injection, macro renderers, lifecycle. Start here for most plugin tasks.
guides/custom_theme_guide.mdBuilding or reviewing Logseq theme plugins, custom theme CSS, logseq.themes, provideTheme, theme variables, light/dark mode styling, or UI selector/theme-token guidance.
guides/starter_guide.mdBootstrapping a new plugin project (Node/TS toolchain, desktop dev-mode loading, hello-world).
guides/commands_api_guide.mdlogseq.Commands unified command bus, placements, command execution, unregister handlers, and migration from legacy command APIs.
guides/db_properties_guide.mdConceptual model: file-graph vs DB-graph properties, schema vs values, tag/class modeling.
guides/db_properties_references.mdAPI reference for upsertProperty, upsertBlockProperty, property schemas/types/cardinality.
guides/db_tag_property_idents_guide.mdIdent naming rules (:logseq.property/*, :logseq.class/*, :plugin.property.<id>/*, :plugin.class.<id>/*) and when to use them.
guides/db_query_guide.mdDSL (logseq.DB.q) vs Datascript (logseq.DB.datascriptQuery) queries, parameters, change watchers.
guides/experiments_api_guide.mdlogseq.Experiments.* — React/ReactDOM reuse, internal components, CLJS interop, custom fenced-code / route / sidebar / property / block-body renderers.
Show full SKILL.md (231 more words)Show less

Core API quick index

Full code examples live in guides/AGENTS.md — use this table to jump to the right namespace:

  • logseq.App — info, graph, navigation, registerUIItem, registerCommandPalette, lifecycle hooks (onCurrentGraphChanged, onThemeModeChanged, onRouteChanged, onMacroRendererSlotted), checkCurrentIsDbGraph.
  • logseq.Editor — slash & context-menu commands, block CRUD, insertBatchBlock, pages, cursor/selection, upsertBlockProperty / getBlockProperties (DB).
  • logseq.DB — q, datascriptQuery, onChanged, onBlockChanged, getFileContent / setFileContent.
  • logseq.UI — showMsg, closeMsg, queryElementRect, queryElementById.
  • logseq.Assets — listFilesOfCurrentGraph, makeSandboxStorage, makeUrl, builtInOpen.
  • logseq.Git — execCommand, loadIgnoreFile, saveIgnoreFile (file graphs / desktop only).
  • logseq.Experiments — unstable; see the Experiments guide before using.
  • Top-level — provideUI, provideStyle, provideModel, useSettingsSchema, onSettingsChanged, updateSettings, showMainUI / hideMainUI / toggleMainUI / setMainUIInlineStyle, beforeunload, ready.

Common pitfalls

  • Forgetting await — nearly every API is async.
  • Using IBatchBlock.properties in a DB graph (silently ignored).
  • Treating block.content as current — it is deprecated; use block.title.
  • Registering the same key twice in provideUI / provideStyle without intending to replace.
  • Hard-coding colors instead of --ls-* CSS variables.
  • Leaking listeners (no cleanup in beforeunload).
  • Shipping plugins without logseq.id or with a non-unique id.
  • Assuming Git APIs exist on mobile / DB graphs.

When editing SDK source

  • Type definitions: src/LSPlugin.ts. Keep IAppProxy, IEditorProxy, IDBProxy, IUIProxy, IAssetsProxy, IGitProxy, IExperimentsProxy and the ILSPluginUser surface in sync.
  • User proxy implementation: src/LSPlugin.user.ts.
  • Modules: src/modules/ (Experiments, Storage, Request).
  • After changing the public surface, regenerate the CLJS facade (see Workflow step 4) and update CHANGELOG.md.
  • Follow the repo commit style: short imperative subjects, optional scope (e.g. enhance(libs): …, fix(libs): …).

Resources

© logseq, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 57 other files (scripts) in libs of logseq/logseq.

  • SKILL.md
  • .gitignore
  • .npmignore
  • .prettierrc.js
  • CHANGELOG.md
  • README.md
  • babel.config.json
  • cljs-sdk/.gitignore
  • cljs-sdk/LICENSE
  • cljs-sdk/bb.edn
  • cljs-sdk/build.clj
  • cljs-sdk/deps.edn
  • cljs-sdk/package.json
  • cljs-sdk/pnpm-lock.yaml
  • cljs-sdk/src/com/logseq/app.cljs
  • cljs-sdk/src/com/logseq/assets.cljs
  • cljs-sdk/src/com/logseq/commands.cljs
  • … and 41 more

Open the folder on GitHubat commit 22a29b3

Compare with similar skills

Logseq Plugin SDK next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Logseq Plugin SDK compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Logseq Plugin SDK this skilllogseq/logseq45k—~2.3kAutomated safety check: PassAGPL-3.0
Markbind Typescript MigrationMarkBind/markbind158—~2kAutomated safety check: PassMIT
Release TS SDKaptos-labs/aptos-ts-sdk116—~864Automated safety check: PassCustom licence
Check npmgrafana/skills278—~1.3kAutomated safety check: WarnApache-2.0
Compare Array Bundle SizePostHog/posthog-js613—~599Automated safety check: PassCustom licence
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT

Similar skills

  • Complete guide for migrating JavaScript files to TypeScript in the MarkBind project, including the two-commit strategy, import/export syntax conversion, and best practices.

    158 GitHub stars~2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Release TS SDK

    aptos-labs/aptos-ts-sdk

    A skill your agent uses when cutting a release of @aptos-labs/ts-sdk or @aptos-labs/confidential-asset.

    116 GitHub stars~864 tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Check npm

    grafana/skills

    Official

    Audit a JavaScript/TypeScript repo's npm, yarn, or pnpm configuration for supply-chain hardening: tool version, lifecycle scripts, unsafe dependency protocols, and minimum release age ≥3 days.

    278 GitHub stars~1.3k tokensUpdated today
    DevOps & CloudAuto-check: warnings
  • Compare Array Bundle Size

    PostHog/posthog-js

    Official

    Quickly compare the posthog-js array.js bundle size in the current working tree against a git baseline using the repository's esbuild proxy.

    613 GitHub stars~599 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Installs, updates or migrates the vendored anti-slop Oxlint plugin in a repository, keeping local rule changes and the plugin's license and provenance files.

    5.2k GitHub stars~2.2k tokensUpdated 27 days ago
    DevelopmentAuto-check passed

More from logseq/logseq

All 12 skills in this repo
  • Compare two revisions of the Logseq logseq-review-workflow skill by running the same review prompt against isolated before and after skill snapshots, collecting both outputs, and producing a…

    45k GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Esm Cjs Risk Scan

    logseq/logseq

    Scan Logseq ClojureScript Node/Electron targets for npm module loading risks, especially ESM-only packages that may fail when loaded through js/require or shadow-cljs require-based shims.

    45k GitHub stars~3.3k tokensUpdated today
    Auto-check passed
  • Logseq CLI

    logseq/logseq

    Operate the current Logseq command-line interface to inspect or modify graphs, pages, blocks, tasks, tags, and properties; run Datascript queries; show page/block trees; manage graphs; and manage…

    45k GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Audit, plan, and refresh dependency upgrades for the Logseq repository by scanning every non-gitignored package.json, deps.edn, bb.edn and nbb.edn manifest, checking latest upstream versions…

    45k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Logseq I18n

    logseq/logseq

    Logseq i18n workflow for adding, renaming, reviewing, or editing translation keys and user-facing strings.

    45k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Answer user questions about the Logseq repository by researching source code, docs, tests, runtime behavior, and local tools.

    45k GitHub stars~1.2k tokensUpdated today
    Auto-check: warnings

Questions about Logseq Plugin SDK

What does Logseq Plugin SDK do?

Build, debug, or review Logseq plugins with the @logseq/libs SDK (TypeScript/JavaScript, iframe/shadow sandboxed). Logseq Plugin SDK is an agent skill from logseq/logseq. Build, debug, or review Logseq plugins with the @logseq/libs SDK (TypeScript/JavaScript, iframe/shadow sandboxed).

When should I use Logseq Plugin SDK?

Logseq Plugin SDK fits situations like: the task involves writing plugin entry code; registering slash/command/UI items; provideUI/provideStyle/provideModel; settings schema.

How do I install Logseq Plugin SDK in Claude Code?

Run `npx skills add logseq/logseq --skill logseq-plugin-sdk -a claude-code`. Or copy the skill folder (libs in logseq/logseq) into .claude/skills/logseq-plugin-sdk in your project. Claude Code loads it when a task matches its description.

How do I install Logseq Plugin SDK in Codex?

Run `npx skills add logseq/logseq --skill logseq-plugin-sdk -a codex`. Or copy the skill folder (libs in logseq/logseq) into .agents/skills/logseq-plugin-sdk in your project. Codex loads it when a task matches its description.

Can I use Logseq Plugin SDK in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add logseq/logseq --skill logseq-plugin-sdk -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/logseq-plugin-sdk, .gemini/skills/logseq-plugin-sdk, .github/skills/logseq-plugin-sdk and .opencode/skills/logseq-plugin-sdk in your project.

What does Logseq Plugin SDK need to run?

Going by SKILL.md and its folder, Logseq Plugin SDK needs JavaScript for the scripts in its folder and the command-line tools its instructions call (yarn and npm). Our summary lists: Node.js.

Does Logseq Plugin SDK access the network?

SKILL.md names 3 domains. As links in the text: github.com, plugins-doc.logseq.com and discord.gg. This is read from the text; nothing was executed.

Is Logseq Plugin SDK safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Logseq Plugin SDK use?

Logseq Plugin SDK is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Logseq Plugin SDK use?

About 2.3k tokens (SKILL.md is roughly 9.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Logseq Plugin SDK?

Skills that share tags, products or a category with Logseq Plugin SDK: Markbind Typescript Migration (MarkBind/markbind, 158 stars), Release TS SDK (aptos-labs/aptos-ts-sdk, 116 stars), Check npm (grafana/skills, 278 stars) and Compare Array Bundle Size (PostHog/posthog-js, 613 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Logseq Plugin SDK?

logseq (a GitHub organization) maintains it in logseq/logseq, which has 45,158 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 7, 2026.

Source: logseq/logseq on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.