← Back to Skills Marketplace
sxliuyu

Code Snippet

by SxLiuYu · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
247
Downloads
0
Stars
2
Active Installs
1
Versions
Install in OpenClaw
/install code-snippet
Description
代码片段收藏夹。快速保存和搜索常用代码片段,支持多语言和高亮。适合开发者积累代码库。
README (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
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install code-snippet
  3. After installation, invoke the skill by name or use /code-snippet
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug code-snippet
Version 1.0.0
License MIT-0
All-time Installs 2
Active Installs 2
Total Versions 1
Frequently Asked Questions

What is Code Snippet?

代码片段收藏夹。快速保存和搜索常用代码片段,支持多语言和高亮。适合开发者积累代码库。 It is an AI Agent Skill for Claude Code / OpenClaw, with 247 downloads so far.

How do I install Code Snippet?

Run "/install code-snippet" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Code Snippet free?

Yes, Code Snippet is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Code Snippet support?

Code Snippet is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Code Snippet?

It is built and maintained by SxLiuYu (@sxliuyu); the current version is v1.0.0.

💬 Comments