← 返回 Skills 市场
sxliuyu

Code Snippet

作者 SxLiuYu · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
247
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install code-snippet
功能描述
代码片段收藏夹。快速保存和搜索常用代码片段,支持多语言和高亮。适合开发者积累代码库。
使用说明 (SKILL.md)

Code Snippet 📝

收藏和管理常用代码片段。

功能

  • 💾 保存代码片段
  • 🔍 快速搜索
  • 🏷️ 标签分类
  • 📋 一键复制

使用方法

添加片段

python3 scripts/snippet.py add "Python读取文件" --code "with open('file.txt') as f:" --lang python --tag 文件操作

搜索

python3 scripts/snippet.py search "读取文件"

列出

python3 snippets.py list --tag python

复制

python3 snippets.py get 1

示例

# 添加 Python 代码片段
python3 scripts/snippet.py add "读取JSON" --code "import json\
with open('file.json') as f: data = json.load(f)" --lang python

# 搜索
python3 scripts/snippet.py search "JSON"

# 按标签列出
python3 scripts/snippet.py list --tag python
安全使用建议
This skill appears to be a simple local code-snippet manager implemented in Python. Before installing or running it: - Be aware it will create and update ~/.code_snippets.json in your home directory; snippets are stored as plain JSON (not encrypted). Do not store secrets in snippets unless you are comfortable with that. - SKILL.md contains small filename typos (references to 'snippets.py' vs the actual 'scripts/snippet.py'); verify you run the correct path or move the script as you prefer. - The script attempts to use the 'xclip' command to copy to the clipboard on Linux; if you need clipboard support on other platforms you may need to adjust the script. - There is no network access or credential collection in the code; you can review scripts/snippet.py locally to confirm before running. If you want extra assurance, run it in a limited environment or inspect the file contents yourself.
功能分析
Type: OpenClaw Skill Name: code-snippet Version: 1.0.0 The skill is a standard code snippet manager that allows users to save, search, and list code fragments locally. The implementation in `scripts/snippet.py` uses a local JSON file (~/.code_snippets.json) for storage and contains no network activity, obfuscation, or suspicious execution logic.
能力评估
Purpose & Capability
The package name/description (代码片段收藏夹) matches the included script behavior (add/search/list/get/delete local snippets). Minor inconsistencies: SKILL.md examples sometimes call 'snippets.py' while the actual script is 'scripts/snippet.py', and the top-level registry metadata in the report lists no required binaries while _meta.json lists python3. These are likely documentation/metadata typos and do not change the core capability.
Instruction Scope
Runtime instructions simply demonstrate invoking the bundled Python script. The script reads/writes a JSON file at ~/.code_snippets.json (it will create and persist snippets there) and may call the system 'xclip' command to copy text to the clipboard. It performs no network activity, does not read other system configs, and does not access environment variables. The examples contain filename typos (snippets.py vs scripts/snippet.py).
Install Mechanism
No install spec is provided (instruction-only plus one included script). _meta.json notes python3 as a required binary, which is reasonable. Nothing is downloaded or extracted; no remote install URLs are used.
Credentials
The skill requires no credentials or environment variables. It stores data locally in a plain JSON file in the user's home directory (~/.code_snippets.json). That persistent storage is proportional to the described purpose but is unencrypted by design.
Persistence & Privilege
The skill does not request elevated or platform-wide privileges, does not set always:true, and only persists its own data file in the user's home directory. It does not modify other skills or system-wide configuration.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install code-snippet
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /code-snippet 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of code-snippet. - Save and organize frequently used code snippets. - Supports quick search and tag-based classification. - Multi-language support with syntax highlighting. - One-click copy for easy sharing and use. - Simple command-line interface for adding, searching, listing, and copying code snippets.
元数据
Slug code-snippet
版本 1.0.0
许可证 MIT-0
累计安装 2
当前安装数 2
历史版本数 1
常见问题

Code Snippet 是什么?

代码片段收藏夹。快速保存和搜索常用代码片段,支持多语言和高亮。适合开发者积累代码库。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 247 次。

如何安装 Code Snippet?

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

Code Snippet 是免费的吗?

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

Code Snippet 支持哪些平台?

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

谁开发了 Code Snippet?

由 SxLiuYu(@sxliuyu)开发并维护,当前版本 v1.0.0。

💬 留言讨论