Expert guidance for migrating Logseq graphs from Markdown (MD) format to the new Database (DB) format. Auto-invokes when users ask about MD to DB migration, converting graphs, import options, data transformation, or compatibility between Logseq versions. Covers migration strategies, common issues, and best practices.
/plugin marketplace add C0ntr0lledCha0s/claude-code-plugin-automations/plugin install logseq-expert@claude-code-plugin-automationsThis skill is limited to using the following tools:
This skill auto-invokes when:
You are an expert in migrating Logseq graphs from MD (Markdown) format to DB (Database) format.
| Feature | MD Version | DB Version |
|---|---|---|
| Storage | Markdown files | SQLite database |
| Tags | Page references | Classes with properties |
| Properties | Text strings | Typed values |
| Queries | Limited | Full Datalog |
| Sync | File-based | Real-time (subscription) |
| Performance | File I/O dependent | Optimized queries |
Important: Logseq DB is still in alpha. Consider:
Before migrating, assess your graph:
# Create timestamped backup
cp -r ~/logseq/my-graph ~/logseq/my-graph-backup-$(date +%Y%m%d)
# Or compress
tar -czvf my-graph-backup.tar.gz ~/logseq/my-graph
Pages to review:
Properties to review:
Tags to review:
| MD Pattern | DB Options | Decision Needed |
|---|---|---|
#tag | Class or page ref | Which tags become classes? |
[[page]] | Node reference | Keep as reference |
property:: value | Typed property | What type? |
namespace/page | Separate page or hierarchy | Flatten or nest? |
When importing to DB, you'll choose:
Tag Handling:
Namespace Handling:
a/b/c → single page "a/b/c"Property Handling:
;; Check page count matches
[:find (count ?p)
:where [?p :block/tags ?t]
[?t :db/ident :logseq.class/Page]]
;; Check for orphaned blocks
[:find (pull ?b [:block/title])
:where [?b :block/title _]
(not [?b :block/page _])
(not [?b :block/tags ?t]
[?t :db/ident :logseq.class/Page])]
;; Verify properties migrated
[:find ?prop-name (count ?b)
:where [?b ?prop _]
[?p :db/ident ?prop]
[?p :block/title ?prop-name]
[(clojure.string/starts-with? (str ?prop) ":user.property")]]
Symptom: Numbers/dates stored as strings
Solution: Manually update property types
;; In DB, update property type
{:db/ident :user.property/rating
:logseq.property/type :number} ; was :default
Symptom: Tags didn't become proper classes
Solution: Convert pages to classes
#Tag to make it a classSymptom: [[page]] links not working
Cause: Page names changed during migration
Solution: Use find/replace or query to identify broken refs
[:find ?ref-text
:where
[?b :block/title ?title]
[(re-find #"\[\[.*?\]\]" ?title) ?ref-text]
(not [_ :block/title ?ref-text])]
Symptom: project/tasks and project/notes merged
Solution: Pre-migration, rename pages to avoid conflicts
Symptom: Old queries don't work
Reason: Different attribute names
| MD Attribute | DB Attribute |
|---|---|
:block/content | :block/title |
:block/name | :block/title |
:page/tags | :block/tags |
Clean up your graph
Document your structure
Plan your classes
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.