obsidian-bases

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

obsidian-bases: Obsidian's Database Layer

obsidian-bases: Obsidian的数据库层

Obsidian Bases (launched 2025) turns vault notes into queryable, dynamic views. Tables, cards, lists, maps. Defined in
.base
files. No plugin required; it is a core Obsidian feature.
Substrate preference (v1.7+): This skill is a self-contained fallback. Prefer
kepano/obsidian-skills
as the authoritative substrate — its
obsidian-bases
skill is the canonical reference for Bases YAML, formulas, and view definitions. If you see an
obsidian-bases
skill available without the
claude-obsidian:
namespace, that is kepano's version: use it. The reference below is provided so the plugin remains functional when kepano's marketplace is not installed. Install:
claude plugin marketplace add kepano/obsidian-skills
. Official Bases docs: https://help.obsidian.md/bases/syntax

Obsidian Bases(2025年推出)可将库笔记转换为可查询的动态视图,支持表格、卡片、列表、地图等形式。通过
.base
文件定义,无需安装插件,是Obsidian的核心功能。
Substrate偏好(v1.7+):本技能是一个独立的备用方案。**优先使用
kepano/obsidian-skills
**作为权威基础库——其
obsidian-bases
技能是Bases YAML、公式和视图定义的标准参考。如果您看到不带
claude-obsidian:
命名空间的
obsidian-bases
技能,那就是kepano的版本,请使用它。提供以下参考是为了当kepano的市场插件未安装时,本插件仍能正常运行。安装方式:
claude plugin marketplace add kepano/obsidian-skills
。官方Bases文档:https://help.obsidian.md/bases/syntax

File Format

文件格式

.base
files contain valid YAML. The root keys are
filters
,
formulas
,
properties
,
summaries
, and
views
.
yaml
undefined
.base
文件包含有效的YAML。根键为
filters
formulas
properties
summaries
views
yaml
undefined

Global filters: apply to ALL views

Global filters: apply to ALL views

filters: and: - file.hasTag("wiki") - 'status != "archived"'
filters: and: - file.hasTag("wiki") - 'status != "archived"'

Computed properties

Computed properties

formulas: age_days: '(now() - file.ctime).days.round(0)' status_icon: 'if(status == "mature", "✅", "🔄")'
formulas: age_days: '(now() - file.ctime).days.round(0)' status_icon: 'if(status == "mature", "✅", "🔄")'

Display name overrides for properties panel

Display name overrides for properties panel

properties: status: displayName: "Status" formula.age_days: displayName: "Age (days)"
properties: status: displayName: "Status" formula.age_days: displayName: "Age (days)"

One or more views

One or more views

views:
  • type: table name: "All Pages" order:
    • file.name
    • type
    • status
    • updated
    • formula.age_days

---
views:
  • type: table name: "All Pages" order:
    • file.name
    • type
    • status
    • updated
    • formula.age_days

---

Filters

Filters(筛选器)

Filters select which notes appear. Applied globally or per-view.
yaml
undefined
Filters用于选择要显示的笔记,可全局应用或按视图应用。
yaml
undefined

Single string filter

Single string filter

filters: 'status == "current"'
filters: 'status == "current"'

AND: all must be true

AND: all must be true

filters: and: - 'status != "archived"' - file.hasTag("wiki")
filters: and: - 'status != "archived"' - file.hasTag("wiki")

OR: any can be true

OR: any can be true

filters: or: - file.hasTag("concept") - file.hasTag("entity")
filters: or: - file.hasTag("concept") - file.hasTag("entity")

NOT: exclude matches

NOT: exclude matches

filters: not: - file.inFolder("wiki/meta")
filters: not: - file.inFolder("wiki/meta")

Nested

Nested

filters: and: - file.inFolder("wiki/") - or: - 'type == "concept"' - 'type == "entity"'
undefined
filters: and: - file.inFolder("wiki/") - or: - 'type == "concept"' - 'type == "entity"'
undefined

Filter operators

Filter运算符

==
!=
>
<
>=
<=
==
!=
>
<
>=
<=

Useful filter functions

实用Filter函数

FunctionExample
file.hasTag("x")
Notes with tag
x
file.inFolder("path/")
Notes in folder
file.hasLink("Note")
Notes linking to Note

函数示例
file.hasTag("x")
带有标签
x
的笔记
file.inFolder("path/")
指定文件夹中的笔记
file.hasLink("Note")
链接到Note的笔记

Properties

Properties(属性)

Three types:
  • Note properties: from frontmatter:
    status
    ,
    type
    ,
    updated
  • File properties: metadata:
    file.name
    ,
    file.mtime
    ,
    file.size
    ,
    file.ctime
    ,
    file.tags
    ,
    file.folder
  • Formula properties: computed:
    formula.age_days

分为三种类型:
  • 笔记属性:来自前置元数据:
    status
    type
    updated
  • 文件属性:元数据:
    file.name
    file.mtime
    file.size
    file.ctime
    file.tags
    file.folder
  • 公式属性:计算得出:
    formula.age_days

Formulas

Formulas(公式)

Defined in
formulas:
. Referenced as
formula.name
in
order:
and
properties:
.
yaml
formulas:
  # Days since created
  age_days: '(now() - file.ctime).days.round(0)'

  # Days until a date property
  days_until: 'if(due_date, (date(due_date) - today()).days, "")'

  # Conditional label
  status_icon: 'if(status == "mature", "✅", if(status == "developing", "🔄", "🌱"))'

  # Word count estimate
  word_est: '(file.size / 5).round(0)'
Key rule: Subtracting two dates returns a
Duration
. Not a number. Always access
.days
first:
yaml
undefined
formulas:
中定义,在
order:
properties:
中通过
formula.name
引用。
yaml
formulas:
  # Days since created
  age_days: '(now() - file.ctime).days.round(0)'

  # Days until a date property
  days_until: 'if(due_date, (date(due_date) - today()).days, "")'

  # Conditional label
  status_icon: 'if(status == "mature", "✅", if(status == "developing", "🔄", "🌱"))'

  # Word count estimate
  word_est: '(file.size / 5).round(0)'
关键规则:两个日期相减会返回
Duration
类型,而非数字。必须先访问
.days
属性:
yaml
undefined

CORRECT

CORRECT

age: '(now() - file.ctime).days'
age: '(now() - file.ctime).days'

WRONG: crashes

WRONG: crashes

age: '(now() - file.ctime).round(0)'

**Always guard nullable properties with `if()`**:
```yaml
age: '(now() - file.ctime).round(0)'

**始终用`if()`处理可空属性**:
```yaml

CORRECT

CORRECT

days_left: 'if(due_date, (date(due_date) - today()).days, "")'

---
days_left: 'if(due_date, (date(due_date) - today()).days, "")'

---

View Types

视图类型

Table

表格(Table)

yaml
views:
  - type: table
    name: "Wiki Index"
    limit: 100
    order:
      - file.name
      - type
      - status
      - updated
    groupBy:
      property: type
      direction: ASC
yaml
views:
  - type: table
    name: "Wiki Index"
    limit: 100
    order:
      - file.name
      - type
      - status
      - updated
    groupBy:
      property: type
      direction: ASC

Cards

卡片(Cards)

yaml
views:
  - type: cards
    name: "Gallery"
    order:
      - file.name
      - tags
      - status
yaml
views:
  - type: cards
    name: "Gallery"
    order:
      - file.name
      - tags
      - status

List

列表(List)

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

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

Wiki Vault Templates

Wiki库模板

Wiki content dashboard (all non-meta pages)

Wiki内容仪表盘(所有非元数据页面)

yaml
filters:
  and:
    - file.inFolder("wiki/")
    - not:
        - file.inFolder("wiki/meta")

formulas:
  age: '(now() - file.ctime).days.round(0)'

properties:
  formula.age:
    displayName: "Age (days)"

views:
  - type: table
    name: "All Wiki Pages"
    order:
      - file.name
      - type
      - status
      - updated
      - formula.age
    groupBy:
      property: type
      direction: ASC
yaml
filters:
  and:
    - file.inFolder("wiki/")
    - not:
        - file.inFolder("wiki/meta")

formulas:
  age: '(now() - file.ctime).days.round(0)'

properties:
  formula.age:
    displayName: "Age (days)"

views:
  - type: table
    name: "All Wiki Pages"
    order:
      - file.name
      - type
      - status
      - updated
      - formula.age
    groupBy:
      property: type
      direction: ASC

Entity index (people, orgs, repos)

实体索引(人物、组织、仓库)

yaml
filters:
  and:
    - file.inFolder("wiki/entities/")
    - 'file.ext == "md"'

views:
  - type: table
    name: "Entities"
    order:
      - file.name
      - entity_type
      - status
      - updated
    groupBy:
      property: entity_type
      direction: ASC
yaml
filters:
  and:
    - file.inFolder("wiki/entities/")
    - 'file.ext == "md"'

views:
  - type: table
    name: "Entities"
    order:
      - file.name
      - entity_type
      - status
      - updated
    groupBy:
      property: entity_type
      direction: ASC

Recent ingests

近期导入内容

yaml
filters:
  and:
    - file.inFolder("wiki/sources/")

views:
  - type: table
    name: "Sources"
    order:
      - file.name
      - source_type
      - created
      - status
    groupBy:
      property: source_type
      direction: ASC

yaml
filters:
  and:
    - file.inFolder("wiki/sources/")

views:
  - type: table
    name: "Sources"
    order:
      - file.name
      - source_type
      - created
      - status
    groupBy:
      property: source_type
      direction: ASC

Embedding in Notes

在笔记中嵌入

markdown
![[MyBase.base]]

![[MyBase.base#View Name]]

markdown
![[MyBase.base]]

![[MyBase.base#View Name]]

Where to Save

保存位置

Store
.base
files in
wiki/meta/
for vault dashboards:
  • wiki/meta/dashboard.base
    : main content view
  • wiki/meta/entities.base
    : entity tracker
  • wiki/meta/sources.base
    : ingestion log

.base
文件存储在
wiki/meta/
目录下用于库仪表盘:
  • wiki/meta/dashboard.base
    :主内容视图
  • wiki/meta/entities.base
    :实体追踪器
  • wiki/meta/sources.base
    :导入日志

YAML Quoting Rules

YAML引用规则

  • Formulas with double quotes → wrap in single quotes:
    'if(done, "Yes", "No")'
  • Strings with colons or special chars → wrap in double quotes:
    "Status: Active"
  • Unquoted strings with
    :
    break YAML parsing

  • 包含双引号的公式→用单引号包裹:
    'if(done, "Yes", "No")'
  • 包含冒号或特殊字符的字符串→用双引号包裹:
    "Status: Active"
  • 未加引号且包含
    :
    的字符串会破坏YAML解析

What Not to Do

注意事项

  • Do not use
    from:
    or
    where:
    : those are Dataview syntax, not Obsidian Bases
  • Do not use
    sort:
    at the root level: sorting is per-view via
    order:
    and
    groupBy:
  • Do not put
    .base
    files outside the vault: they only render inside Obsidian
  • Do not reference
    formula.X
    in
    order:
    without defining
    X
    in
    formulas:

  • 不要使用
    from:
    where:
    :这些是Dataview语法,而非Obsidian Bases语法
  • 不要在根级别使用
    sort:
    :排序需通过视图内的
    order:
    groupBy:
    实现
  • 不要将
    .base
    文件存储在库外:它们仅能在Obsidian内渲染
  • 不要在
    order:
    中引用未在
    formulas:
    中定义的
    formula.X

How to think (10-principle mapping)

思考原则(10-principle mapping)

When working on this skill, apply the 10-principle loop. See
skills/think/SKILL.md
for the canonical framework.
#PrincipleApplication here
1OBSERVE (ext)The
.base
YAML the user is composing — read it carefully before suggesting changes.
2OBSERVE (int)Am I documenting yesterday's spec or today's? Bases evolves fast post-GA.
3LISTENThe user's specific Bases use-case (dashboard, filter chain, computed property).
4THINKWhich filter operators, formula syntax, view types apply? Validate against the current spec.
5CONNECT (lat)How do Bases relate to Dataview queries? Properties? Canvas overlays? Map the deltas.
6CONNECT (sys)Obsidian Bases is post-1.10 GA; substrate-defer to kepano/obsidian-skills when present.
7FEELExamples that actually parse and render. Pseudo-syntax wastes the user.
8ACCEPTBases spec evolves; some features in this doc may have changed. Keep the version note current.
9CREATESchema docs + worked examples that render in the user's actual Obsidian version.
10GROWAs Bases features ship, refresh the reference. Track upstream releases.
使用本技能时,请遵循10原则循环。标准框架请参考
skills/think/SKILL.md
序号原则应用场景
1OBSERVE (ext)用户正在编写的
.base
YAML文件——在建议修改前仔细阅读。
2OBSERVE (int)我记录的是昨天的规范还是今天的?Bases在正式发布后迭代很快。
3LISTEN用户的具体Bases使用场景(仪表盘、筛选链、计算属性)。
4THINK哪些Filter运算符、公式语法、视图类型适用?对照当前规范验证。
5CONNECT (lat)Bases与Dataview查询、属性、Canvas叠加层有何关联?梳理差异。
6CONNECT (sys)Obsidian Bases是1.10版本后正式发布的;当存在kepano/obsidian-skills时,优先使用其作为基础库。
7FEEL提供能实际解析和渲染的示例,伪语法对用户毫无用处。
8ACCEPTBases规范不断演进;本文档中的部分功能可能已变更。请保持版本说明的时效性。
9CREATE提供能在用户实际Obsidian版本中渲染的架构文档和实用示例。
10GROW随着Bases功能发布,更新参考文档,追踪上游版本。