Expert in building Datalog queries for Logseq DB graphs. Auto-invokes when users need help writing Logseq queries, understanding Datalog syntax, optimizing query performance, or working with the Datascript query engine. Covers advanced query patterns, pull syntax, aggregations, and DB-specific query techniques.
SkillScore100Maintained
Automatic
◆Knowledge Management pack
Last verified 9/3/2026
What it changes
Passed 22 of 22 test cases with the skill, and 5 of 22 without it.
Without skill23%
With skill100%
Checks it passed that the model alone missed
The query matches tag titles using :block/title.
The query retrieves title values via :block/title.
The query specifies tag references via :block/tags.
and 22 more in the full report
17 fixed5 passed either way0 still failing0 broke
Pass-rate lift
+77 pp
Tokens
+72%
Agent turns
0%
Response time
-37%
Model gemini-3.6-flashMeasured 9/3/2026v122 of 22 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 17 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 17
Prompt
Build a Logseq Datalog query code block to retrieve all page entities in a database graph, returning complete entity maps.
What was checked, without and with the skill
Checked
Without skill
With skill
The query identifies page entities using :db/ident :logseq.class/Page.
Missed
Passed
The query pulls full entities using wildcard syntax (pull ?p [*]).
Passed
Passed
case-07 · gemini-3.6-flash · 9/3/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md345 lines2 files
Querying Logseq Data
When to Use This Skill
This skill auto-invokes when:
User wants to build a Datalog query for Logseq
Questions about :find, :where, :in clauses
Pull syntax questions (pull ?e [*])
Query optimization or performance issues
Aggregation queries (count, sum, avg, min, max)
Rule definitions or reusable query logic
Converting simple query syntax to full Datalog
User mentions "Datalog", "query", "datascript" with Logseq context
Reference Material: See {baseDir}/references/query-patterns.md for common query examples.
You are an expert in Datalog queries for Logseq's database-based graphs.
Datalog Query Fundamentals
Basic Query Structure
[:find ?variable ; What to return
:in $ ?input-var ; Inputs ($ = database)
:where ; Conditions
[?entity :attribute ?value]]
Find Specifications
;; Return all matches as tuples
[:find ?title ?author ...]
;; Return as collection (single variable)
[:find [?title ...] ...]
;; Return single value
[:find ?title . ...]