obsidian

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Obsidian Vault

Obsidian Vault

Use this skill for filesystem-first Obsidian vault work: reading notes, listing notes, searching note files, creating notes, appending content, and adding wikilinks.
使用此技能进行以文件系统优先的Obsidian库操作:读取笔记、列出笔记、搜索笔记文件、创建笔记、追加内容以及添加维基链接。

Vault path

库路径

Use a known or resolved vault path before calling file tools.
The documented vault-path convention is the
OBSIDIAN_VAULT_PATH
environment variable, for example from
~/.hermes/.env
. If it is unset, use
~/Documents/Obsidian Vault
.
File tools do not expand shell variables. Do not pass paths containing
$OBSIDIAN_VAULT_PATH
to
read_file
,
write_file
,
patch
, or
search_files
; resolve the vault path first and pass a concrete absolute path. Vault paths may contain spaces, which is another reason to prefer file tools over shell commands.
If the vault path is unknown,
terminal
is acceptable for resolving
OBSIDIAN_VAULT_PATH
or checking whether the fallback path exists. Once the path is known, switch back to file tools.
在调用文件工具之前,请使用已知或已解析的库路径。
文档化的库路径约定是
OBSIDIAN_VAULT_PATH
环境变量,例如来自
~/.hermes/.env
。如果未设置该变量,则使用
~/Documents/Obsidian Vault
文件工具不会展开shell变量。请勿将包含
$OBSIDIAN_VAULT_PATH
的路径传递给
read_file
write_file
patch
search_files
;请先解析库路径,再传递具体的绝对路径。库路径可能包含空格,这也是优先使用文件工具而非shell命令的另一个原因。
如果库路径未知,可以使用
terminal
来解析
OBSIDIAN_VAULT_PATH
或检查备用路径是否存在。一旦路径已知,请切换回文件工具。

Read a note

读取笔记

Use
read_file
with the resolved absolute path to the note. Prefer this over
cat
because it provides line numbers and pagination.
使用
read_file
并传入笔记的已解析绝对路径。优先选择此方式而非
cat
,因为它会提供行号和分页功能。

List notes

列出笔记

Use
search_files
with
target: "files"
and the resolved vault path. Prefer this over
find
or
ls
.
  • To list all markdown notes, use
    pattern: "*.md"
    under the vault path.
  • To list a subfolder, search under that subfolder's absolute path.
使用
search_files
并设置
target: "files"
以及已解析的库路径。优先选择此方式而非
find
ls
  • 要列出所有Markdown笔记,请在库路径下使用
    pattern: "*.md"
  • 要列出子文件夹,请在该子文件夹的绝对路径下进行搜索。

Search

搜索

Use
search_files
for both filename and content searches. Prefer this over
grep
,
find
, or
ls
.
  • For filenames, use
    search_files
    with
    target: "files"
    and a filename
    pattern
    .
  • For note contents, use
    search_files
    with
    target: "content"
    , the content regex as
    pattern
    , and
    file_glob: "*.md"
    when you want to restrict matches to markdown notes.
使用
search_files
进行文件名和内容搜索。优先选择此方式而非
grep
find
ls
  • 搜索文件名时,使用
    search_files
    并设置
    target: "files"
    以及文件名
    pattern
  • 搜索笔记内容时,使用
    search_files
    并设置
    target: "content"
    ,将内容正则表达式作为
    pattern
    ,当需要将匹配限制在Markdown笔记时,设置
    file_glob: "*.md"

Create a note

创建笔记

Use
write_file
with the resolved absolute path and the full markdown content. Prefer this over shell heredocs or
echo
because it avoids shell quoting issues and returns structured results.
使用
write_file
并传入已解析的绝对路径和完整的Markdown内容。优先选择此方式而非shell heredocs或
echo
,因为它可以避免shell引用问题并返回结构化结果。

Append to a note

追加内容到笔记

Prefer a native file-tool workflow when it is not awkward:
  • Read the target note with
    read_file
    .
  • Use
    patch
    for an anchored append when there is stable context, such as adding a section after an existing heading or appending before a known trailing block.
  • Use
    write_file
    when rewriting the whole note is clearer than constructing a fragile patch.
For an anchored append with
patch
, replace the anchor with the anchor plus the new content.
For a simple append with no stable context,
terminal
is acceptable if it is the clearest safe option.
当操作不繁琐时,优先使用原生文件工具流程:
  • 使用
    read_file
    读取目标笔记。
  • 当存在稳定上下文时,使用
    patch
    进行锚定追加,例如在现有标题后添加章节或在已知末尾块之前追加内容。
  • 当重写整个笔记比构建脆弱的补丁更清晰时,使用
    write_file
使用
patch
进行锚定追加时,将锚点替换为锚点加新内容。
对于没有稳定上下文的简单追加,如果
terminal
是最清晰的安全选项,则可以使用它。

Targeted edits

定向编辑

Use
patch
for focused note changes when the current content gives you stable context. Prefer this over shell text rewriting.
当当前内容提供稳定上下文时,使用
patch
进行针对性的笔记修改。优先选择此方式而非shell文本重写。

Wikilinks

维基链接

Obsidian links notes with
[[Note Name]]
syntax. When creating notes, use these to link related content.
Obsidian使用
[[Note Name]]
语法来链接笔记。创建笔记时,请使用此语法链接相关内容。