Expert in reading data from Logseq DB graphs via HTTP API or CLI. Auto-invokes when users want to fetch pages, blocks, or properties from Logseq, execute Datalog queries against their graph, search content, or retrieve backlinks and relationships. Provides the logseq-client library for operations.
Reads data from Logseq graphs via HTTP API or CLI, executing Datalog queries, searching content, and fetching pages, blocks, or backlinks.
npx claudepluginhub c0ntr0lledcha0s/claude-code-plugin-automationsThis skill is limited to using the following tools:
references/read-operations.mdscripts/logseq-client.pytemplates/query-template.ednThis skill auto-invokes when:
Client Library: See {baseDir}/scripts/logseq-client.py for the unified API.
| Operation | Description |
|---|---|
get_page(title) | Get page content and properties |
get_block(uuid) | Get block with children |
search(query) | Full-text search across graph |
datalog_query(query) | Execute Datalog query |
list_pages() | List all pages |
get_backlinks(title) | Find pages linking to this one |
get_graph_info() | Get current graph metadata |
from logseq_client import LogseqClient
client = LogseqClient()
page = client.get_page("My Page")
print(f"Title: {page['title']}")
print(f"Properties: {page['properties']}")
# Find all books with rating >= 4
results = client.datalog_query('''
[:find (pull ?b [:block/title :user.property/rating])
:where
[?b :block/tags ?t]
[?t :block/title "Book"]
[?b :user.property/rating ?r]
[(>= ?r 4)]]
''')
for book in results:
print(f"{book['block/title']}: {book['user.property/rating']} stars")
# Search for mentions of "project"
results = client.search("project")
for block in results:
print(f"Found in: {block['page']}")
print(f"Content: {block['content'][:100]}...")
[:find (pull ?p [:block/title])
:where
[?p :block/tags ?t]
[?t :db/ident :logseq.class/Page]]
[:find (pull ?b [*])
:where
[?b :block/tags ?t]
[?t :block/title "Book"]]
[:find ?title ?author
:where
[?b :block/title ?title]
[?b :user.property/author ?author]
[?b :block/tags ?t]
[?t :block/title "Book"]]
[:find (pull ?t [:block/title :logseq.property/status])
:where
[?t :block/tags ?tag]
[?tag :db/ident :logseq.class/Task]
[?t :logseq.property/status ?s]
[?s :block/title "In Progress"]]
[:find (pull ?b [:block/title {:block/page [:block/title]}])
:in $ ?page-title
:where
[?p :block/title ?page-title]
[?b :block/refs ?p]]
;; Count books per author
[:find ?author (count ?b)
:where
[?b :block/tags ?t]
[?t :block/title "Book"]
[?b :user.property/author ?author]]
from logseq_client import LogseqClient
# Auto-detect backend
client = LogseqClient()
# Force specific backend
client = LogseqClient(backend="http")
# Custom URL/token
client = LogseqClient(
url="http://localhost:12315",
token="your-token"
)
try:
page = client.get_page("Nonexistent Page")
except client.NotFoundError:
print("Page doesn't exist")
except client.ConnectionError:
print("Cannot connect to Logseq")
except client.AuthError:
print("Invalid token")
# Get multiple pages efficiently
pages = ["Page1", "Page2", "Page3"]
results = [client.get_page(p) for p in pages]
# Or use a single query
query = '''
[:find (pull ?p [*])
:in $ [?titles ...]
:where
[?p :block/title ?titles]]
'''
results = client.datalog_query(query, [pages])
(pull ?e [:needed :fields]) vs [*]:in clauseIf HTTP API unavailable, the client falls back to CLI:
# CLI mode (automatic if HTTP fails)
client = LogseqClient(backend="cli", graph_path="/path/to/graph")
# Query still works the same way
results = client.datalog_query("[:find ?title :where [?p :block/title ?title]]")
Returns Python dicts/lists directly from API.
# Get normalized output
page = client.get_page("My Page", normalize=True)
# Returns: {"title": "...", "uuid": "...", "properties": {...}, "blocks": [...]}
{baseDir}/references/read-operations.md for all operations{baseDir}/templates/query-template.edn for query patternsActivates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
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.