← 返回 Skills 市场
cdmichaelb

Snippets Sync

作者 cdmichaelb · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
88
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install snippets-sync
功能描述
Sync code snippets and notes between machines via file sync. Organized by language, rendered in any Markdown viewer (Obsidian, VS Code, etc.).
使用说明 (SKILL.md)

Obsidian Skill

How This Works

The vault is a directory of .md files synced between machines (typically via Syncthing, but any file sync works). Anything written to the vault appears on all synced devices.

Primary use case: Sharing code snippets, notes, and structured content through Obsidian — persists across sessions, renders nicely in Obsidian, and is searchable.

Vault Location

Set SNIPPETS_VAULT_PATH to your vault directory. Defaults to ~/snippets-vault if unset. Point this at a dedicated directory — not your home dir or any folder containing secrets.

Path
Vault $SNIPPETS_VAULT_PATH
Synced to Your other machines via Syncthing/rsync/etc.

Reading & Writing Notes

Direct File I/O (preferred)

Just read/write .md files in the vault directory. Obsidian picks up changes automatically via file sync.

Markdown Format

Notes are plain Markdown with optional YAML frontmatter:

---
created: 2026-04-05
tags: [snippet, python]
---

# Note Title

Content here. Use standard Markdown formatting.

Sharing Code Snippets

Naming Convention

code_snippets/
├── python/
│   └── http-server.md
├── bash/
│   └── find-large-files.md
├── typescript/
│   └── debounce.md
├── docker/
│   └── healthcheck.md
└── _uncategorized/
    └── random-thing.md

Rules:

  • Folder = language/tech (python/, bash/, typescript/, docker/, sql/, lua/, gdscript/, etc.)
  • Filename = what it does (kebab-case): json-parser.md, not snippet-001.md
  • No date prefixes — sort by modified time in Obsidian
  • One snippet per file — keeps things searchable and linkable
  • _uncategorized/ for anything that doesn't fit a clear bucket

Snippet Template

---
created: YYYY-MM-DD
language: \x3Clang>
tags: [snippet, \x3Clang>, \x3Ctopic>]
---

# Descriptive Title

Description or context here.

\```\x3Clang>
# code here
\```

Usage: `command to run if applicable`

When to Share via Obsidian vs Chat

Use Obsidian vault when:

  • Code snippets the user might reference later
  • Anything with syntax highlighting that benefits from persistence
  • Reference material or reusable code

Use chat directly when:

  • Quick one-off code blocks in active discussion
  • Transient stuff that doesn't need to persist

Notification Convention

When dropping a snippet, send a brief heads-up in chat:

"Dropped snippet: code_snippets/python/http-server.md"

Markdown Rules

These files render in Obsidian, not Discord/chat. Write standard CommonMark Markdown:

  • Headers: Use # / ## / ### — never **bold text** as a fake header
  • Code blocks: Always use fenced code blocks with language tag (```python) — never inline backticks for multi-line code
  • No chat-isms: No > blockquotes for emphasis, no ~~strikethrough~~ abuse, no platform-specific formatting
  • Links: Wikilinks ([[other-note]]) for internal references, standard [text](url) for external
  • Lists: Use - or 1. with proper indentation
  • Emphasis: *italic* and **bold** are fine — use sparingly, for actual emphasis
  • Tables: Standard Markdown tables

The goal: clean, readable notes that render well in Obsidian's reading view.

obsidian-cli (optional)

If obsidian-cli is installed and the vault is registered with Obsidian desktop:

obsidian-cli search "query"              # search note names
obsidian-cli search-content "query"      # search inside notes
obsidian-cli list                         # list files

Direct file I/O is the reliable path on headless Linux.

Safety

  • Only read/write .md files in the vault directory
  • Never touch .obsidian/ or other app config directories
  • Only point SNIPPETS_VAULT_PATH at a dedicated snippet/note directory — never at home, ~/.ssh, password stores, or credential-containing repos
  • Files written to the vault propagate to all synced machines

Tips

  • Don't touch .obsidian/ — that's Obsidian's config
  • File sync picks up changes automatically (typically within seconds)
  • Wikilinks work: [[other-note]] links between notes
  • Frontmatter is searchable in Obsidian
  • Use folders for organization — Obsidian handles them natively
  • Create language subfolders as needed — the vault grows with usage
安全使用建议
Before enabling: ensure SNIPPETS_VAULT_PATH points to a dedicated directory that contains no private keys, password stores, or other secrets (don't point it at your home dir). Secure the file-sync channel (Syncthing/rsync) and the devices that receive the vault. Review any files the agent writes to the vault before they sync to other machines, and consider restrictive filesystem permissions or a separate sync profile for the vault. If you want to limit risk further, disable autonomous invocation for this skill or require explicit confirmation before the agent writes files.
功能分析
Type: OpenClaw Skill Name: snippets-sync Version: 1.0.1 The snippets-sync skill provides instructions for an AI agent to manage a Markdown-based knowledge base and code snippet library. It uses standard file I/O within a user-defined directory (SNIPPETS_VAULT_PATH) and includes explicit safety instructions in SKILL.md to avoid sensitive directories like ~/.ssh or credential stores. No evidence of data exfiltration, malicious execution, or harmful prompt injection was found.
能力评估
Purpose & Capability
Name/description match the actual behavior: read/write .md files in a user-specified vault for Obsidian-style snippet sharing. No unrelated binaries, credentials, or installs are requested.
Instruction Scope
SKILL.md confines operations to .md files inside the designated vault and explicitly warns not to touch .obsidian/ or other config/credential locations. This is appropriate, but the fallback/default vault path (~/snippets-vault) and the skill's ability to read/write files mean the user must ensure SNIPPETS_VAULT_PATH points to a dedicated directory that contains no secrets.
Install Mechanism
No install spec or code is included (instruction-only). Nothing is downloaded or written to disk by the skill itself.
Credentials
No credentials or sensitive environment variables are requested. The only env var is an optional SNIPPETS_VAULT_PATH to point at the vault, which is appropriate for the stated purpose.
Persistence & Privilege
always is false and there is no install-time persistence. The skill can be invoked autonomously by the agent (default), which is normal—there's no elevated or system-wide privilege requested.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install snippets-sync
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /snippets-sync 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Made SNIPPETS_VAULT_PATH optional (defaults to ~/snippets-vault), added safety section clarifying directory restrictions
v1.0.0
snippets-sync 1.0.0 - Initial release introducing code snippet and note sync via Markdown files organized by language. - Supports direct file I/O using a configurable `SNIPPETS_VAULT_PATH`, compatible with any file sync tool. - Follows strict conventions for file/folder structure, naming, and Markdown formatting to ensure clarity and searchability in Obsidian. - Includes guidance for when to use vault notes vs chat messages, and how to notify others when snippets are added. - Provides optional integration with `obsidian-cli` for command-line note management.
元数据
Slug snippets-sync
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Snippets Sync 是什么?

Sync code snippets and notes between machines via file sync. Organized by language, rendered in any Markdown viewer (Obsidian, VS Code, etc.). 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 88 次。

如何安装 Snippets Sync?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install snippets-sync」即可一键安装,无需额外配置。

Snippets Sync 是免费的吗?

是的,Snippets Sync 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Snippets Sync 支持哪些平台?

Snippets Sync 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Snippets Sync?

由 cdmichaelb(@cdmichaelb)开发并维护,当前版本 v1.0.1。

💬 留言讨论