A comprehensive Claude skill for developing Logseq plugins that work with DB (database) graphs.
This is a Claude skill that provides essential knowledge for developing Logseq plugins specifically for DB graphs. DB graphs use a fundamentally different architecture from the original markdown-based graphs, requiring different APIs and approaches.
| Feature | MD Graphs (File-based) | DB Graphs (Database) |
|---|---|---|
| Page creation | Simple properties in frontmatter | Schema-based with explicit types |
| Property storage | YAML frontmatter | Namespaced database entities (:plugin.property.{id}/name) |
| Tags | Can use properties or content | Must be in page title (#tag syntax) |
| HTML content | Direct insertion allowed | Must convert to markdown first |
| Duplicate detection | Check by filename | Query by unique property values |
| Class/tag pages | Not applicable | Support schema inheritance |
| Property types | Inferred from markdown | Explicit schema or type inference |
| Block properties | Frontmatter in markdown | Database properties |
- Tags must be in page title - No
addTag()API exists - Properties auto-namespaced - Can't modify built-in properties like
:block/tags - Schema at creation only - Must pass schema when creating pages, no API to add later
- HTML requires conversion - Use Turndown to convert HTML to markdown
- Query by properties - Use unique properties (DOI, URL) not page titles for duplicates
- Environment setup - Package.json, dependencies, build tools
- Page creation - Regular pages and class/tag pages with schemas (v0.2.3+)
- Property handling - Type system, namespacing, reserved names
- Block creation - Single blocks and batch operations
- Querying - Datalog queries for DB graphs
- Tag management - How to properly tag pages in DB graphs
- Common gotchas - Property validation, StrictMode, reserved names
- Best practices - Schema usage, duplicate detection, testing
Both regular and class pages support explicit schemas:
// Regular page with schema
const page = await logseq.Editor.createPage(
'Article Title',
{ year: 2025, title: 'Study' },
{
schema: {
year: { type: 'number' },
title: { type: 'string' }
}
} as any
)
// Class page with schema (enables tag-based property inheritance)
const tagPage = await logseq.Editor.createPage(
'research',
{},
{
class: true,
schema: {
year: { type: 'number' },
title: { type: 'string' }
}
} as any
)string- Textnumber- Numberscheckbox- Booleansurl- URLs (validated)date/datetime- Datespage- Page referencesnode- Block references
Tags must be in the page title:
// ✅ Correct
const page = await logseq.Editor.createPage(
'My Article #research #science',
{ year: 2025 }
)
// ❌ Wrong - creates custom property, not a tag
const page = await logseq.Editor.createPage(
'My Article',
{ tags: ['research'] }
)- Plugin developers building for Logseq DB graphs
- Developers migrating markdown-based plugins to DB graphs
- Anyone debugging plugin issues with properties, types, or schemas
- Claude Code users who want plugin development assistance
- Install to your skills directory:
cd ~/.claude/skills
git clone https://github.com/kerim/logseq-db-plugin-dev-skill.git logseq-db-plugin-dev- Use in your prompts:
Use the logseq-db-plugin-dev skill to help me create a Zotero import plugin
Claude Code will automatically load the skill and provide expert guidance.
Note: This skill is marked "Claude Code only" and may have limited functionality in Claude Desktop.
- Download this repository as a ZIP
- In Claude Desktop: Settings → Skills → Add Skill → Upload ZIP
- The skill will be available in all conversations
This skill is based on:
- Actual testing with @logseq/libs v0.2.3
- Official Logseq source code analysis
- Documented API differences between MD and DB graphs
- Best practices for DB graph development
It provides clear guidance on:
- Schema parameter usage (works in v0.2.3)
- Class page schema creation (works in v0.2.3)
- Property namespacing and limitations
- Reserved property names to avoid
- Proper tag insertion techniques
- HTML to Markdown conversion
- No tag insertion API - Must use
#tagin title - Reserved property names - Drop subsequent properties (
created,modified,updated) - No schema modification API - Must set during page creation
- TypeScript definitions incomplete -
schemaandclassparameters requireas any
- @logseq/libs: v0.2.3+
- Logseq: 0.11.0+ (for DB graphs)
- Build tool: vite-plugin-logseq recommended
- Node.js: For building plugins
Found an issue or have improvements? Contributions welcome!
- Test your changes with actual Logseq DB graphs
- Document what you tested and the results
- Submit a PR with clear explanations
MIT
Reflects @logseq/libs v0.2.3 and Logseq 0.11.0+ DB graphs. Will be updated as the API evolves.