dataview

GitHub

基于 Dataview 插件查询和分析笔记元数据,支持生成表格、列表及数据聚合。适用于从 Vault 中提取结构化信息、执行过滤排序及高级脚本分析。

integration/S2B Test Vault/Agents/Skills/dataview/SKILL.md s2b-dev/smart-second-brain

Trigger Scenarios

需要以表格或列表形式展示笔记数据 根据标签、文件夹或属性筛选笔记 对笔记元数据进行统计分析

Install

npx skills add s2b-dev/smart-second-brain --skill dataview -g -y
More Options

Non-standard path

npx skills add https://github.com/s2b-dev/smart-second-brain/tree/main/integration/S2B Test Vault/Agents/Skills/dataview -g -y

Use without installing

npx skills use s2b-dev/smart-second-brain@dataview

指定 Agent (Claude Code)

npx skills add s2b-dev/smart-second-brain --skill dataview -a claude-code -g -y

安装 repo 全部 skill

npx skills add s2b-dev/smart-second-brain --all -g -y

预览 repo 内 skill

npx skills add s2b-dev/smart-second-brain --list

SKILL.md

Frontmatter
{
    "name": "dataview",
    "license": "MIT",
    "metadata": {
        "author": "Smart2Brain",
        "version": "1.0",
        "displayName": "dataview",
        "linkedPlugin": "dataview"
    },
    "description": "Query and analyze notes using Dataview DQL language. Use when user needs tables, lists, or data analysis from vault metadata and frontmatter properties. Requires Dataview plugin.",
    "compatibility": "Requires Dataview plugin to be installed and enabled in Obsidian"
}

Dataview Integration

You have access to the execute_dataview_query tool for running Dataview DQL queries.

Default Result Size

Always include LIMIT 10 in Dataview DQL (queries you show or run) unless the user asks for more or specifies a different limit. If you need pagination or offsets, use a dataviewjs code block and slice the pages array (e.g., .slice(offset, offset + limit)).

Dataview DQL Cheat Sheet

  • Query types: LIST or TABLE field1, field2
  • FROM sources: #tag, "Folder", "path/to/file"
  • Exclusions: AND !#tag, AND !"Folder"
  • Note: Tag/folder exclusions belong in FROM, not WHERE. For WHERE, use expressions like !contains(file.tags, "#Template").
  • Combine: A AND B, A OR B
  • WHERE: WHERE prop (exists), WHERE prop = "value", WHERE numProp > 3
  • SORT: SORT field asc|desc
  • GROUP BY: GROUP BY prop then use rows (e.g., rows.file.name)
  • FLATTEN: FLATTEN multiProp
  • LIMIT: LIMIT 10 (default) or user-specified
  • Display helper: choice(boolProp, "Yes", "No") as "Label"

Minimal Example

TABLE Title, Author
FROM #library AND !"Templates"
WHERE Rating > 3
SORT file.mtime desc
LIMIT 10

Data Analysis

If you need to SEE the results to answer a question or perform analysis, use the execute_dataview_query tool (supports DQL only).

Scripting the Dataview API (advanced)

Because this skill is enabled and the Dataview plugin exposes a public API, you likely also have an exec_dataview tool (check your available tools) that runs JavaScript against Dataview's api object (the same API dataviewjs blocks use) on the main thread. Use it for anything DQL can't express — aggregation, custom filtering, computing statistics across pages.

  • api is the Dataview API; app is the Obsidian app.
  • Prefer execute_dataview_query (DQL) for simple tables/lists; reach for exec_dataview only when you need programmatic logic.
  • Keep snippets read-only unless the user asked to modify data. Awaited work times out; this is not sandboxed.
// Count pages per tag under a folder
const pages = api.pages('"Projects"');
const byStatus = {};
for (const p of pages) byStatus[p.status ?? "none"] = (byStatus[p.status ?? "none"] ?? 0) + 1;
return byStatus;

Displaying Lists/Tables

If you want to SHOW the user a list or table (e.g. 'List all my books'), simply output the Dataview DQL query in a markdown code block. The chat interface will render the result automatically.

  • Do NOT repeat the rendered results in plain text.
  • Do NOT tell the user to run the query in a note; it has already been run and rendered here.
  • When generating a view, introduce it as "Here is the list:" or "I have generated the view below:".

Version History

  • 2.0.5 Current 2026-09-08 21:09

Same Skill Collection

.claude/skills/dispatch/SKILL.md
.github/skills/obsidian-integration-test/SKILL.md
integration/S2B Test Vault/.obsidian/skills/bases/SKILL.md
integration/S2B Test Vault/.obsidian/skills/canvas/SKILL.md
integration/S2B Test Vault/.obsidian/skills/dataview/SKILL.md
integration/S2B Test Vault/.obsidian/skills/notebook-navigator/SKILL.md
integration/S2B Test Vault/.obsidian/skills/obsidian-charts/SKILL.md
integration/S2B Test Vault/.obsidian/skills/tasknotes/SKILL.md
integration/S2B Test Vault/.obsidian/skills/tasks/SKILL.md
integration/S2B Test Vault/Agents/Skills/bases/SKILL.md
integration/S2B Test Vault/Agents/Skills/canvas/SKILL.md
integration/S2B Test Vault/Agents/Skills/explore-vault/SKILL.md
integration/S2B Test Vault/Agents/Skills/manage-notes/SKILL.md
integration/S2B Test Vault/Agents/Skills/manage-skills/SKILL.md
integration/S2B Test Vault/Agents/Skills/notebook-navigator/SKILL.md
integration/S2B Test Vault/Agents/Skills/obsidian-charts/SKILL.md
integration/S2B Test Vault/Agents/Skills/tasknotes/SKILL.md
integration/S2B Test Vault/Agents/Skills/tasks/SKILL.md
integration/S2B Test Vault/Agents/Skills/web/SKILL.md
src/skills/defaults/explore-vault/SKILL.md
src/skills/defaults/manage-notes/SKILL.md
src/skills/defaults/manage-skills/SKILL.md
src/skills/defaults/web/SKILL.md
src/skills/integrations/bases/SKILL.md
src/skills/integrations/canvas/SKILL.md
src/skills/integrations/dataview/SKILL.md
src/skills/integrations/obsidian-charts/SKILL.md
src/skills/integrations/tasknotes/SKILL.md
src/skills/integrations/tasks/SKILL.md

Metadata

Files
0
Version
2.0.5
Hash
1852a054
Indexed
2026-09-08 21:09

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-10 03:40
浙ICP备14020137号-1 $bản đồ khách truy cập$