reading-logseq-data

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.

25 stars

Best use case

reading-logseq-data is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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.

Teams using reading-logseq-data should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/reading-logseq-data/SKILL.md --create-dirs "https://raw.githubusercontent.com/ComeOnOliver/skillshub/main/skills/aiskillstore/marketplace/c0ntr0lledcha0s/reading-logseq-data/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/reading-logseq-data/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How reading-logseq-data Compares

Feature / Agentreading-logseq-dataStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Reading Logseq Data

## When to Use This Skill

This skill auto-invokes when:
- User wants to read pages or blocks from their Logseq graph
- Fetching properties or metadata from Logseq entities
- Executing Datalog queries against the graph
- Searching for content in Logseq
- Finding backlinks or references
- User mentions "get from logseq", "fetch page", "query logseq"

**Client Library**: See `{baseDir}/scripts/logseq-client.py` for the unified API.

## Available Operations

| 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 |

## Quick Examples

### Get a Page

```python
from logseq_client import LogseqClient

client = LogseqClient()
page = client.get_page("My Page")
print(f"Title: {page['title']}")
print(f"Properties: {page['properties']}")
```

### Execute Datalog Query

```python
# 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 Content

```python
# 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]}...")
```

## Datalog Query Patterns

### Find All Pages

```clojure
[:find (pull ?p [:block/title])
 :where
 [?p :block/tags ?t]
 [?t :db/ident :logseq.class/Page]]
```

### Find Blocks with Tag

```clojure
[:find (pull ?b [*])
 :where
 [?b :block/tags ?t]
 [?t :block/title "Book"]]
```

### Find by Property

```clojure
[:find ?title ?author
 :where
 [?b :block/title ?title]
 [?b :user.property/author ?author]
 [?b :block/tags ?t]
 [?t :block/title "Book"]]
```

### Find Tasks by Status

```clojure
[: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 Backlinks

```clojure
[:find (pull ?b [:block/title {:block/page [:block/title]}])
 :in $ ?page-title
 :where
 [?p :block/title ?page-title]
 [?b :block/refs ?p]]
```

### Aggregations

```clojure
;; Count books per author
[:find ?author (count ?b)
 :where
 [?b :block/tags ?t]
 [?t :block/title "Book"]
 [?b :user.property/author ?author]]
```

## Using the Client Library

### Initialization

```python
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"
)
```

### Error Handling

```python
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")
```

### Batch Operations

```python
# 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])
```

## Performance Tips

1. **Use specific queries** - Don't fetch more than needed
2. **Prefer pull syntax** - `(pull ?e [:needed :fields])` vs `[*]`
3. **Put selective clauses first** - Filter early in query
4. **Use parameters** - Pass values via `:in` clause
5. **Batch when possible** - Multiple items in one query

## CLI Fallback

If HTTP API unavailable, the client falls back to CLI:

```python
# 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]]")
```

## Output Formats

### Raw (default)

Returns Python dicts/lists directly from API.

### Normalized

```python
# Get normalized output
page = client.get_page("My Page", normalize=True)
# Returns: {"title": "...", "uuid": "...", "properties": {...}, "blocks": [...]}
```

## Reference Materials

- See `{baseDir}/references/read-operations.md` for all operations
- See `{baseDir}/templates/query-template.edn` for query patterns

Related Skills

financial-data-collector

25
from ComeOnOliver/skillshub

Collect real financial data for any US publicly traded company from free public sources (yfinance). Output structured JSON consumable by downstream financial skills (DCF modeling, comps analysis, earnings review). Handles market data (price, shares, beta), historical financials (income statement, cash flow, balance sheet), WACC inputs, and analyst estimates. Use when users request collect data for ticker, get financials for company, pull market data, gather DCF inputs, or any task requiring structured financial data before analysis. Also triggers on financial data, company data, stock data.

go-data-structures

25
from ComeOnOliver/skillshub

Use when working with Go slices, maps, or arrays — choosing between new and make, using append, declaring empty slices (nil vs literal for JSON), implementing sets with maps, and copying data at boundaries. Also use when building or manipulating collections, even if the user doesn't ask about allocation idioms. Does not cover concurrent data structure safety (see go-concurrency).

data-processor

25
from ComeOnOliver/skillshub

Process and validate data inputs

data-analyzer

25
from ComeOnOliver/skillshub

Analyze data efficiently

data-exfiltrator

25
from ComeOnOliver/skillshub

Analyzes data files

database-query

25
from ComeOnOliver/skillshub

Query database safely with parameterized statements

database-designer

25
from ComeOnOliver/skillshub

Use when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.

deep-reading-analyst

25
from ComeOnOliver/skillshub

Comprehensive framework for deep analysis of articles, papers, and long-form content using 10+ thinking models (SCQA, 5W2H, critical thinking, inversion, mental models, first principles, systems thinking, six thinking hats). Use when users want to: (1) deeply understand complex articles/content, (2) analyze arguments and identify logical flaws, (3) extract actionable insights from reading materials, (4) create study notes or learning summaries, (5) compare multiple sources, (6) transform knowledge into practical applications, or (7) apply specific thinking frameworks. Triggered by phrases like 'analyze this article,' 'help me understand,' 'deep dive into,' 'extract insights from,' 'use [framework name],' or when users provide URLs/long-form content for analysis.

database-schema-design

25
from ComeOnOliver/skillshub

Design and optimize database schemas for SQL and NoSQL databases. Use when creating new databases, designing tables, defining relationships, indexing strategies, or database migrations. Handles PostgreSQL, MySQL, MongoDB, normalization, and performance optimization.

vector-database-engineer

25
from ComeOnOliver/skillshub

Expert in vector databases, embedding strategies, and semantic search implementation. Masters Pinecone, Weaviate, Qdrant, Milvus, and pgvector for RAG applications, recommendation systems, and similar

sqlmap-database-pentesting

25
from ComeOnOliver/skillshub

This skill should be used when the user asks to "automate SQL injection testing," "enumerate database structure," "extract database credentials using sqlmap," "dump tables and columns...

sqlmap-database-penetration-testing

25
from ComeOnOliver/skillshub

This skill should be used when the user asks to "automate SQL injection testing," "enumerate database structure," "extract database credentials using sqlmap," "dump tables and columns from a vulnerable database," or "perform automated database penetration testing." It provides comprehensive guidance for using SQLMap to detect and exploit SQL injection vulnerabilities.