Agent skill · research science · aiskillstore
querying-logseq-data
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.
Why this skill is useful
Provides advanced Datalog query patterns and optimization techniques specific to Logseq that the AI wouldn't reliably generate on its own.
What it needs
About 4k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
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 Specifications Common Query Patterns Find All Pages Find Blocks with Specific Tag/Class Find by Property Value Find Tasks by Status Find with Date Ranges Advanced Query Techniques Aggregations Rules (Reusable Query Logic) Negation Or Clauses Recursive Queries Pull Syntax Selective Attributes Reverse References DB-Specific Query Patterns Working with Classes Working with Properties Journal Queries Query Optimization Tips 1. Put most selective clauses first - Narrow down results early 2. Use indexed attributes - :db/ident, :block/uuid are indexed 3. Avoid wildcards in pull - Specify needed attributes 4. Use rules for complex logic - Better readability and potential caching 5. Limit results when possible - Add limits for large datasets Logseq Query UI vs Raw Datalog Simple Query (UI) Equivalent Datalog Advanced Query Block Common Gotchas 1. MD vs DB attribute differences MD: :block/content, :block/name DB: :block/title, :block/tags 2. Property namespacing User properties: :user.property/name System properties: :logseq.property/name 3. Tag vs Class terminology In UI: "Tags" In schema: "Classes" (:logseq.class/) 4. Date handling Dates link to journal pages Compare using date functions, not strings
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/querying-logseq-data