Obsidian bases

From allenhutchison/obsidian-gemini · View interactive version

Obsidian bases is an AI agent skill from the GitHub repository allenhutchison/obsidian-gemini. Create and configure Obsidian Bases — database-like views of notes. Activate this skill when users want to create bases, write filters, formulas, or set up table/cards/list/map views.

How to use this skill

Skill file

Obsidian Bases

Bases is a core Obsidian plugin that creates database-like views of notes. A base can display, edit, sort, and filter files and their properties using table, cards, list, or map views.

All data lives in local Markdown files and their properties. Views are described by Bases syntax (YAML), saved as .base files or embedded in code blocks.

Creating a Base

As a file: Command palette → Bases: Create new base, or right-click a folder → New base.

Embedded in a note: Use a base code block:

filters:

and:

views:

name: Table

Embed an existing base: ![[File.base]] or ![[File.base#ViewName]].

Important: Embedded base code blocks only render in Reading view or Live Preview mode. They appear as raw YAML in Source mode. After creating an embedded base, let the user know they may need to switch to Reading view to see it rendered.

Bases Syntax (YAML)

A base file has these top-level sections, all optional:

filters: # Global filters applied to all views
formulas: # Calculated properties
properties: # Display configuration (e.g., column headers)
summaries: # Custom summary formulas
views: # One or more view definitions

Filters

By default a base includes every file in the vault. Filters narrow the dataset.

Filters can be applied globally (all views) or per-view. Both use the same syntax and are combined with AND when both are present.

filters:
  and:
    - file.hasTag("project")
    - 'status != "done"'
  or:
    - file.inFolder("Work")
    - file.inFolder("Personal")
  not:
    - file.hasTag("archived")

Filter statements are strings that evaluate to true/false using comparison operators or functions.

Formulas

Calculated properties defined in the base:

formulas:
  total_cost: 'price * quantity'
  formatted_price: 'if(price, "$" + price.toFixed(2), "")'
  deadline: 'start_date + "2w"'
  overdue: 'if(due_date < now() && status != "Done", "Overdue", "")'

Formula values are YAML strings. Use nested quotes for text literals.

Property References

Properties Section

Configure display names for columns:

properties:
  status:
    displayName: Status
  formula.total_cost:
    displayName: 'Total Cost'

Views Section

views:
  - type: table # table, cards, list, map
    name: 'My Table'
    limit: 10
    filters: # view-specific filters
      and:
        - 'status != "done"'
    order: # column/property order
      - file.name
      - note.status
      - formula.total_cost
    sort: # sort rows (list of property + direction)
      - property: file.mtime
        direction: DESC
    groupBy: # group rows by a property
      property: note.status
      direction: ASC # or DESC
    summaries:
      formula.total_cost: Sum

Sorting: Use sort (NOT sorts) — a list of objects with property and direction (ASC/DESC). Supports multiple sort criteria. groupBy is separate and controls row grouping.

Summaries

Built-in summaries: Average, Min, Max, Sum, Range, Median, Stddev (numbers); Earliest, Latest, Range (dates); Checked, Unchecked (booleans); Empty, Filled, Unique (any type).

Custom summaries use the values keyword (list of all values for that property):

summaries:
  weighted_avg: 'values.mean().round(3)'

Operators

Arithmetic

+, -, *, /, %, ( )

Comparison

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

Boolean

! (not), && (and), || (or)

Date Arithmetic

Add/subtract durations: date + "1M", date - "2h", now() + "7d"

Duration units: y/year/years, M/month/months, d/day/days, w/week/weeks, h/hour/hours, m/minute/minutes, s/second/seconds

Subtracting two dates returns milliseconds.

Key Functions

Global

Date Methods

String Methods

Number Methods

List Methods

File Methods

View Types

Table

Rows = files, columns = properties. Supports summaries, grouping, sorting, keyboard shortcuts (Ctrl+C/V, Tab navigation, Enter to edit).

Cards

Grid layout with optional cover images. Settings: card size, image property (link, URL, or hex color), image fit (cover/contain), aspect ratio.

List

Bulleted, numbered, or plain list. Can indent properties under primary item or use separators.

Map

Interactive map with markers. Requires the Maps plugin (Obsidian 1.10+). Coordinates stored as "lat, lng" text or [lat, lng] list. Supports custom marker icons (Lucide names) and colors (hex, RGB, CSS).

Common Patterns

Task tracker:

filters:
  and:
    - file.hasTag("task")
formulas:
  overdue: 'if(due_date < today() && status != "Done", "Overdue", "")'
views:
  - type: table
    name: Tasks
    groupBy:
      property: note.status
      direction: ASC

Reading list:

filters:
  and:
    - file.hasTag("book")
views:
  - type: cards
    name: Library

Project dashboard:

filters:
  and:
    - file.inFolder("Projects")
formulas:
  days_left: 'if(deadline, (deadline - today()) / 86400000, "")'
views:
  - type: table
    name: Projects
    summaries:
      note.budget: Sum

Tips

Troubleshooting

YAML syntax errors

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

# WRONG
displayName: Status: Active
# CORRECT
displayName: 'Status: Active'

Mismatched quotes in formulas. When a formula contains double quotes, wrap the whole value in single quotes.

# WRONG
formulas:
  label: "if(done, "Yes", "No")"
# CORRECT
formulas:
  label: 'if(done, "Yes", "No")'

Common formula errors

Duration math without a field accessor. Subtracting two dates returns a duration, not a number — access .days, .hours, etc. (Subtracting raw datetimes yields milliseconds, so divide if you skip the accessor.)

# WRONG
'(now() - file.ctime).round(0)'
# CORRECT
'(now() - file.ctime).days.round(0)'

Missing null checks. Guard properties that may be absent with if(), or the formula errors on notes that lack them.

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

Referencing an undefined formula. Every formula.X used in order or properties must have a matching entry under formulas.

Rendering

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.