logseq
Provide commands for interacting with a local Logseq instance through its Plugin API. Use for creating pages, inserting blocks, querying the graph database, managing tasks, retrieving content, or automating workflows in Logseq. Only works with a locally running instance with the API enabled; default port or set path expected for [$API accessible skill].
What this skill does
# Logseq Plugin API
Interact with your local Logseq instance through its JavaScript Plugin API. This skill enables reading, writing, querying, and automating workflows in your Logseq graph.
## Prerequisites
**Logseq must be running locally** with a plugin that exposes the API. The standard way is:
1. **Install a bridge plugin** that exposes `logseq` API via HTTP (e.g., via a custom plugin or localhost endpoint)
2. **Alternative**: Use Node.js with `@logseq/libs` package to script against the running Logseq instance
The API is primarily designed for in-browser plugins, so accessing it from external scripts requires a bridge/proxy.
## Core API Namespaces
The Logseq Plugin API is organized into these main proxies:
### `logseq.App`
Application-level operations: getting app info, user configs, current graph, commands, UI state, external links.
**Key methods:**
- `getInfo()` - Get app version and info
- `getUserConfigs()` - Get user preferences (theme, format, language, etc.)
- `getCurrentGraph()` - Get current graph info (name, path, URL)
- `registerCommand(type, opts, action)` - Register custom commands
- `pushState(route, params, query)` - Navigate to routes
### `logseq.Editor`
Block and page editing operations: creating, updating, moving, querying content.
**Key methods:**
- `getBlock(uuid)` - Get block by UUID
- `getCurrentPage()` - Get current page entity
- `getCurrentPageBlocksTree()` - Get all blocks on current page
- `getPageBlocksTree(page)` - Get all blocks for a specific page
- `insertBlock(target, content, opts)` - Insert a new block
- `updateBlock(uuid, content)` - Update block content
- `createPage(pageName, properties, opts)` - Create a new page
- `deletePage(pageName)` - Delete a page
- `getPageLinkedReferences(page)` - Get backlinks to a page
- `registerSlashCommand(tag, action)` - Add custom slash commands
### `logseq.DB`
Database queries using Datalog.
**Key methods:**
- `q(query, ...inputs)` - Run Datalog query
- `datascriptQuery(query, ...inputs)` - Direct Datascript query
### `logseq.UI`
UI operations: messages, dialogs, main UI visibility.
**Key methods:**
- `showMsg(content, status)` - Show toast notification
- `queryElementById(id)` - Query DOM elements
### `logseq.Git`
Git operations for the current graph.
**Key methods:**
- `execCommand(args)` - Execute git command
### `logseq.Assets`
Asset management.
**Key methods:**
- `listFilesOfCurrentGraph(path)` - List files in graph
## Common Workflows
### Read Content
```javascript
// Get current page
const page = await logseq.Editor.getCurrentPage();
// Get all blocks on a page
const blocks = await logseq.Editor.getPageBlocksTree('Daily Notes');
// Get a specific block
const block = await logseq.Editor.getBlock('block-uuid-here');
// Query with Datalog
const results = await logseq.DB.q(`
[:find (pull ?b [*])
:where [?b :block/marker "TODO"]]
`);
```
### Write Content
```javascript
// Create a new page
await logseq.Editor.createPage('Project Notes', {
tags: 'project',
status: 'active'
}, { redirect: false });
// Insert a block
const block = await logseq.Editor.insertBlock(
'target-block-uuid',
'- New task item',
{ before: false, sibling: true }
);
// Update a block
await logseq.Editor.updateBlock('block-uuid', 'Updated content');
// Batch insert multiple blocks
const blocks = [
{ content: 'First item' },
{ content: 'Second item', children: [
{ content: 'Nested item' }
]}
];
await logseq.Editor.insertBatchBlock('parent-uuid', blocks, { sibling: false });
```
### Task Management
```javascript
// Find all TODO items
const todos = await logseq.DB.q(`
[:find (pull ?b [*])
:where
[?b :block/marker ?marker]
[(contains? #{"TODO" "DOING"} ?marker)]]
`);
// Mark task as DONE
await logseq.Editor.updateBlock('task-uuid', 'DONE Task content');
// Get tasks on current page
const page = await logseq.Editor.getCurrentPage();
const blocks = await logseq.Editor.getPageBlocksTree(page.name);
const tasks = blocks.filter(b => b.marker === 'TODO' || b.marker === 'DOING');
```
### Navigation and UI
```javascript
// Navigate to a page
logseq.App.pushState('page', { name: 'Project Notes' });
// Show notification
logseq.UI.showMsg('✅ Task completed!', 'success');
// Get app config
const configs = await logseq.App.getUserConfigs();
console.log('Theme:', configs.preferredThemeMode);
console.log('Format:', configs.preferredFormat);
```
## Implementation Approaches
Since Logseq's Plugin API is browser-based, you have several options:
### Option 1: Bridge Plugin
Create a minimal Logseq plugin that exposes API calls via HTTP:
```javascript
// In Logseq plugin (index.js)
logseq.ready(() => {
// Expose API endpoints
logseq.provideModel({
async handleAPICall({ method, args }) {
return await logseq.Editor[method](...args);
}
});
});
// Then call from external script via HTTP POST
```
### Option 2: Node.js Script with @logseq/libs
For automation scripts, use the `@logseq/libs` package:
```bash
npm install @logseq/libs
```
**Note:** This requires a running Logseq instance and proper connection setup.
### Option 3: Direct Plugin Development
Develop a full Logseq plugin following the plugin samples at:
https://github.com/logseq/logseq-plugin-samples
## API Reference
For complete API documentation, see:
- **API Docs**: https://logseq.github.io/plugins/
- **Plugin Samples**: https://github.com/logseq/logseq-plugin-samples
- **Type Definitions**: `references/api-types.md` (extracted from `@logseq/libs`)
## Key Data Structures
### BlockEntity
```typescript
{
id: number, // Entity ID
uuid: string, // Block UUID
content: string, // Block content
format: 'markdown' | 'org',
page: { id: number }, // Parent page
parent: { id: number }, // Parent block
left: { id: number }, // Previous sibling
properties: {}, // Block properties
marker?: string, // TODO/DOING/DONE
children?: [] // Child blocks
}
```
### PageEntity
```typescript
{
id: number,
uuid: string,
name: string, // Page name (lowercase)
originalName: string, // Original case
'journal?': boolean,
properties: {},
journalDay?: number, // YYYYMMDD for journals
}
```
## Tips & Best Practices
1. **Always check for null**: API methods may return `null` if entity doesn't exist
2. **Use UUIDs over IDs**: Block UUIDs are stable, entity IDs can change
3. **Batch operations**: Use `insertBatchBlock` for multiple inserts
4. **Query efficiently**: Datalog queries are powerful but can be slow on large graphs
5. **Properties are objects**: Access with `block.properties.propertyName`
6. **Format matters**: Respect user's preferred format (markdown vs org-mode)
7. **Async all the way**: All API calls return Promises
## Common Gotchas
- **Page names are lowercase**: When querying, use lowercase page names
- **Journal pages**: Use `journalDay` format (YYYYMMDD) not date strings
- **Block hierarchy**: Respect parent/child relationships when inserting
- **Format differences**: Markdown uses `-` for bullets, Org uses `*`
- **Properties syntax**: Different between markdown (`prop::`) and org (`:PROPERTIES:`)
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.