微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🗂️

Obsidian 数据库视图构建专家

Obsidian Bases (kepano) · v1.0.0
入口已确认,内容待校验 文件树里有 SKILL.md,但正文还没采回,frontmatter 未核对。
效率 安全 S+ 级 作者 hoyaryyj 公开目录收录
705 下载 0 安装 3k 收藏 4 浏览

简介

官方 Obsidian Bases 技能,通过 YAML 配置为笔记创建多视图数据库,支持筛选、公式计算与动态汇总,实现笔记的 Notion 级结构化管理与可视化分析。

原始描述

Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries. Use when working with .base files, creating database-like views of...

通过你的 Agent 添加

安装目录:obsidian-bases-kepano/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/obsidian-bases-kepano/
Codex CLI~/.codex/skills/obsidian-bases-kepano/
DeepSeek Harness~/.agents/skills/obsidian-bases-kepano/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

Obsidian Bases 是一项专为 Obsidian 知识库设计的结构化数据管理技能,允许用户通过创建 .base 文件,将散落的 Markdown 笔记转化为具有数据库功能的动态视图。其核心工作流程包括六个步骤:创建 .base 文件、定义全局筛选器(filters)以确定纳入范围的笔记、可选地配置公式(formulas)计算派生属性、设置多种视图类型(table/table/cards/list/map)、进行 YAML 语法校验,最终在 Obsidian 客户端中验证渲染效果。

该技能采用声明式 YAML 配置,用户无需编写代码即可实现复杂的查询与计算逻辑。全局筛选器支持 and/or/not 嵌套组合,可基于标签、文件夹、属性或日期等多维度过滤笔记。公式系统内置丰富的函数库,支持日期运算、字符串格式化、条件判断及聚合计算,并能通过 formula.X 语法在视图中引用。视图配置灵活,可自定义显示字段、排序规则、分组方式及摘要统计,满足不同场景下的数据呈现需求。

显著优点

深度原生集成:作为 Obsidian 官方生态组件,Bases 与笔记系统无缝融合,直接操作本地 Markdown 文件,无需导出或同步外部数据库,保障数据主权与隐私安全。

低门槛高表达力:YAML 声明式配置大幅降低了数据库使用门槛,同时通过公式引擎保留了足够的灵活性,从简单的任务清单到复杂的项目仪表盘均可构建。

多视图协同:单一 .base 文件可同时承载表格、卡片、列表、地图四种视图,并支持视图级独立筛选,实现"同一份数据,多种视角"的灵活分析。

实时动态计算:公式属性随笔记内容自动更新,摘要统计即时反映数据变化,无需手动刷新或重新计算。

可嵌入性:支持通过 ![[BaseName.base#View]] 语法嵌入任意 Markdown 笔记,便于构建个性化仪表板与报告文档。

潜在缺点与局限性

YAML 语法敏感性:配置错误(如特殊字符未加引号、引号嵌套冲突)会导致整个 Base 无法渲染,且错误提示较为晦涩,调试成本较高。公式中的 Duration 类型运算规则(必须先访问 .days 等字段再执行数值操作)也易造成新手困惑。

功能边界限制:当前不支持跨库查询、外部 API 数据源接入,以及复杂的关联查询(如 SQL 式的 JOIN 操作)。公式引擎虽丰富,但相比 Python/JavaScript 等通用语言仍有表达力上限。

性能考量:当纳入笔记数量庞大(数千条以上)或公式计算复杂时,渲染延迟可能明显,极端情况下可能影响 Obsidian 客户端响应速度。

生态依赖:地图视图需额外安装 Maps 社区插件,部分高级函数需查阅独立参考文档,完整功能体验存在碎片化门槛。

适合的目标群体

  • 知识管理重度用户:已积累大量笔记,急需从"搜索驱动"转向"视图驱动"的第二代知识管理方式
  • 项目与任务管理者:需要跨笔记聚合任务、跟踪进度、计算工期,但不愿离开 Obsidian 生态
  • 内容创作者与研究者:管理文献库、阅读清单、写作素材,需要按状态、主题、日期等多维度动态组织
  • 数据可视化爱好者:追求 Notion/Airtable 式数据库体验,同时坚持本地优先、Markdown 原生原则的隐私敏感用户

使用风险

数据完整性风险:错误的 YAML 配置或公式引用可能导致视图空白或计算异常,虽不会损坏源笔记,但可能影响依赖该视图的工作流程。建议关键 Base 配置纳入版本控制。

性能与稳定性:大量笔记的复杂查询可能触发 Obsidian 的渲染性能瓶颈,建议对高频访问的大型 Base 设置合理的 limit 限制,并避免过度嵌套筛选条件。

可迁移性风险:.base 文件为 Obsidian 专有格式,公式语法具有平台特异性,未来若需迁移至其他工具,视图逻辑与计算规则需重新实现。

学习曲线:YAML 语法、公式函数库、Duration 类型运算等概念需要一定时间掌握,建议从官方示例模板起步,逐步迭代复杂配置。

技能正文


name: obsidian-bases description: Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries. Use when working with .base files, creating database-like views of notes, or when the user mentions Bases, table views, card views, filters, or formulas in Obsidian.

Obsidian Bases Skill

Workflow

  1. Create the file: Create a .base file in the vault with valid YAML content
  2. Define scope: Add filters to select which notes appear (by tag, folder, property, or date)
  3. Add formulas (optional): Define computed properties in the formulas section
  4. Configure views: Add one or more views (table, cards, list, or map) with order specifying which properties to display
  5. Validate: Verify the file is valid YAML with no syntax errors. Check that all referenced properties and formulas exist. Common issues: unquoted strings containing special YAML characters, mismatched quotes in formula expressions, referencing formula.X without defining X in formulas
  6. Test in Obsidian: Open the .base file in Obsidian to confirm the view renders correctly. If it shows a YAML error, check quoting rules below

Schema

Base files use the .base extension and contain valid YAML.

# Global filters apply to ALL views in the base
filters:
  # Can be a single filter string
  # OR a recursive filter object with and/or/not
  and: []
  or: []
  not: []

# Define formula properties that can be used across all views
formulas:
  formula_name: 'expression'

# Configure display names and settings for properties
properties:
  property_name:
    displayName: "Display Name"
  formula.formula_name:
    displayName: "Formula Display Name"
  file.ext:
    displayName: "Extension"

# Define custom summary formulas
summaries:
  custom_summary_name: 'values.mean().round(3)'

# Define one or more views
views:
  - type: table | cards | list | map
    name: "View Name"
    limit: 10                    # Optional: limit results
    groupBy:                     # Optional: group results
      property: property_name
      direction: ASC | DESC
    filters:                     # View-specific filters
      and: []
    order:                       # Properties to display in order
      - file.name
      - property_name
      - formula.formula_name
    summaries:                   # Map properties to summary formulas
      property_name: Average

Filter Syntax

Filters narrow down results. They can be applied globally or per-view.

Filter Structure

# Single filter
filters: 'status == "done"'

# AND - all conditions must be true
filters:
  and:
    - 'status == "done"'
    - 'priority > 3'

# OR - any condition can be true
filters:
  or:
    - 'file.hasTag("book")'
    - 'file.hasTag("article")'

# NOT - exclude matching items
filters:
  not:
    - 'file.hasTag("archived")'

# Nested filters
filters:
  or:
    - file.hasTag("tag")
    - and:
        - file.hasTag("book")
        - file.hasLink("Textbook")
    - not:
        - file.hasTag("book")
        - file.inFolder("Required Reading")

Filter Operators

Operator Description
== equals
!= not equal
> greater than
< less than
>= greater than or equal
<= less than or equal
&& logical and
|| logical or
! logical not

Properties

Three Types of Properties

  1. Note properties - From frontmatter: note.author or just author
  2. File properties - File metadata: file.name, file.mtime, etc.
  3. Formula properties - Computed values: formula.my_formula

File Properties Reference

Property Type Description
file.name String File name
file.basename String File name without extension
file.path String Full path to file
file.folder String Parent folder path
file.ext String File extension
file.size Number File size in bytes
file.ctime Date Created time
file.mtime Date Modified time
file.tags List All tags in file
file.links List Internal links in file
file.backlinks List Files linking to this file
file.embeds List Embeds in the note
file.properties Object All frontmatter properties

The this Keyword

  • In main content area: refers to the base file itself
  • When embedded: refers to the embedding file
  • In sidebar: refers to the active file in main content

Formula Syntax

Formulas compute values from properties. Defined in the formulas section.

formulas:
  # Simple arithmetic
  total: "price * quantity"

  # Conditional logic
  status_icon: 'if(done, "✅", "⏳")'

  # String formatting
  formatted_price: 'if(price, price.toFixed(2) + " dollars")'

  # Date formatting
  created: 'file.ctime.format("YYYY-MM-DD")'

  # Calculate days since created (use .days for Duration)
  days_old: '(now() - file.ctime).days'

  # Calculate days until due date
  days_until_due: 'if(due_date, (date(due_date) - today()).days, "")'

Key Functions

Most commonly used functions. For the complete reference of all types (Date, String, Number, List, File, Link, Object, RegExp), see FUNCTIONS_REFERENCE.md.

Function Signature Description
date() date(string): date Parse string to date (YYYY-MM-DD HH:mm:ss)
now() now(): date Current date and time
today() today(): date Current date (time = 00:00:00)
if() if(condition, trueResult, falseResult?) Conditional
duration() duration(string): duration Parse duration string
file() file(path): file Get file object
link() link(path, display?): Link Create a link

Duration Type

When subtracting two dates, the result is a Duration type (not a number).

Duration Fields: duration.days, duration.hours, duration.minutes, duration.seconds, duration.milliseconds

IMPORTANT: Duration does NOT support .round(), .floor(), .ceil() directly. Access a numeric field first (like .days), then apply number functions.

# CORRECT: Calculate days between dates
"(date(due_date) - today()).days"                    # Returns number of days
"(now() - file.ctime).days"                          # Days since created
"(date(due_date) - today()).days.round(0)"           # Rounded days

# WRONG - will cause error:
# "((date(due) - today()) / 86400000).round(0)"      # Duration doesn't support division then round

Date Arithmetic

# Duration units: y/year/years, M/month/months, d/day/days,
#                 w/week/weeks, h/hour/hours, m/minute/minutes, s/second/seconds
"now() + \"1 day\""       # Tomorrow
"today() + \"7d\""        # A week from today
"now() - file.ctime"      # Returns Duration
"(now() - file.ctime).days"  # Get days as number

View Types

Table View

views:
  - type: table
    name: "My Table"
    order:
      - file.name
      - status
      - due_date
    summaries:
      price: Sum
      count: Average

Cards View

views:
  - type: cards
    name: "Gallery"
    order:
      - file.name
      - cover_image
      - description

List View

views:
  - type: list
    name: "Simple List"
    order:
      - file.name
      - status

Map View

Requires latitude/longitude properties and the Maps community plugin.

views:
  - type: map
    name: "Locations"
    # Map-specific settings for lat/lng properties

Default Summary Formulas

Name Input Type Description
Average Number Mathematical mean
Min Number Smallest number
Max Number Largest number
Sum Number Sum of all numbers
Range Number Max - Min
Median Number Mathematical median
Stddev Number Standard deviation
Earliest Date Earliest date
Latest Date Latest date
Range Date Latest - Earliest
Checked Boolean Count of true values
Unchecked Boolean Count of false values
Empty Any Count of empty values
Filled Any Count of non-empty values
Unique Any Count of unique values

Complete Examples

Task Tracker Base

filters:
  and:
    - file.hasTag("task")
    - 'file.ext == "md"'

formulas:
  days_until_due: 'if(due, (date(due) - today()).days, "")'
  is_overdue: 'if(due, date(due) < today() && status != "done", false)'
  priority_label: 'if(priority == 1, "🔴 High", if(priority == 2, "🟡 Medium", "🟢 Low"))'

properties:
  status:
    displayName: Status
  formula.days_until_due:
    displayName: "Days Until Due"
  formula.priority_label:
    displayName: Priority

views:
  - type: table
    name: "Active Tasks"
    filters:
      and:
        - 'status != "done"'
    order:
      - file.name
      - status
      - formula.priority_label
      - due
      - formula.days_until_due
    groupBy:
      property: status
      direction: ASC
    summaries:
      formula.days_until_due: Average

  - type: table
    name: "Completed"
    filters:
      and:
        - 'status == "done"'
    order:
      - file.name
      - completed_date

Reading List Base

filters:
  or:
    - file.hasTag("book")
    - file.hasTag("article")

formulas:
  reading_time: 'if(pages, (pages * 2).toString() + " min", "")'
  status_icon: 'if(status == "reading", "📖", if(status == "done", "✅", "📚"))'
  year_read: 'if(finished_date, date(finished_date).year, "")'

properties:
  author:
    displayName: Author
  formula.status_icon:
    displayName: ""
  formula.reading_time:
    displayName: "Est. Time"

views:
  - type: cards
    name: "Library"
    order:
      - cover
      - file.name
      - author
      - formula.status_icon
    filters:
      not:
        - 'status == "dropped"'

  - type: table
    name: "Reading List"
    filters:
      and:
        - 'status == "to-read"'
    order:
      - file.name
      - author
      - pages
      - formula.reading_time

Daily Notes Index

filters:
  and:
    - file.inFolder("Daily Notes")
    - '/^\d{4}-\d{2}-\d{2}$/.matches(file.basename)'

formulas:
  word_estimate: '(file.size / 5).round(0)'
  day_of_week: 'date(file.basename).format("dddd")'

properties:
  formula.day_of_week:
    displayName: "Day"
  formula.word_estimate:
    displayName: "~Words"

views:
  - type: table
    name: "Recent Notes"
    limit: 30
    order:
      - file.name
      - formula.day_of_week
      - formula.word_estimate
      - file.mtime

Embedding Bases

Embed in Markdown files:

![[MyBase.base]]

<!-- Specific view -->
![[MyBase.base#View Name]]

YAML Quoting Rules

  • Use single quotes for formulas containing double quotes: 'if(done, "Yes", "No")'
  • Use double quotes for simple strings: "My View Name"
  • Escape nested quotes properly in complex expressions

Troubleshooting

YAML Syntax Errors

Unquoted special characters: Strings containing :, {, }, [, ], ,, &, *, #, ?, |, -, <, >, =, !, %, @, ` must be quoted.

# WRONG - colon in unquoted string
displayName: Status: Active

# CORRECT
displayName: "Status: Active"

Mismatched quotes in formulas: When a formula contains double quotes, wrap the entire formula in single quotes.

# WRONG - double quotes inside double quotes
formulas:
  label: "if(done, "Yes", "No")"

# CORRECT - single quotes wrapping double quotes
formulas:
  label: 'if(done, "Yes", "No")'

Common Formula Errors

Duration math without field access: Subtracting dates returns a Duration, not a number. Always access .days, .hours, etc.

# WRONG - Duration is not a number
"(now() - file.ctime).round(0)"

# CORRECT - access .days first, then round
"(now() - file.ctime).days.round(0)"

Missing null checks: Properties may not exist on all notes. Use if() to guard.

# WRONG - crashes if due_date is empty
"(date(due_date) - today()).days"

# CORRECT - guard with if()
'if(due_date, (date(due_date) - today()).days, "")'

Referencing undefined formulas: Ensure every formula.X in order or properties has a matching entry in formulas.

# This will fail silently if 'total' is not defined in formulas
order:
  - formula.total

# Fix: define it
formulas:
  total: "price * quantity"

References

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

docsproductivitydata-analyticsdatabaseproject-program-managementcontent-medianotes-management

同类 Skill