← 返回 Skills 市场
michealxie001

C Support Library

作者 michealxie001 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
100
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install c-support
功能描述
C Language Support Library for OpenClaw skills. Provides AST parsing, CMake analysis, Unity test generation, and security rule checking for C projects.
使用说明 (SKILL.md)

C Support Library

C语言支持库,为OpenClaw技能提供C代码分析能力。

Version: 1.0
Features: AST解析、CMake分析、Unity测试生成、安全规则库

Purpose

这个库为其他技能(code-review, security, tdd等)提供共享的C语言基础设施:

  • AST解析 - tree-sitter/pycparser封装
  • CMake分析 - 解析CMakeLists.txt
  • Unity测试 - 生成Unity测试框架代码
  • 安全规则 - CWE漏洞检测规则

Usage

from lib.c_parser import CParser, analyze_project
from lib.cmake_parser import CMakeParser, analyze_cmake_project
from lib.unity_templates import UnityTestGenerator
from lib.c_security_rules import CSecurityChecker

# Parse C file
parser = CParser()
info = parser.parse_file("src/main.c")
print(f"Found {len(info.functions)} functions")

# Analyze CMake project
cmake_info = analyze_cmake_project(".")
print(f"Targets: {[t.name for t in cmake_info.targets]}")

# Check security
checker = CSecurityChecker()
issues = checker.check_file("src/main.c")
print(f"Found {len(issues)} security issues")

# Generate Unity tests
generator = UnityTestGenerator()
test_code = generator.generate_test_file(info.functions, "myheader.h")

Modules

c_parser.py

C代码解析,提取:

  • 函数定义和签名
  • 宏定义
  • 结构体/联合体/枚举
  • 头文件依赖
  • 危险函数调用

cmake_parser.py

CMake分析,提取:

  • 项目名称和版本
  • 构建目标(可执行文件/库)
  • 编译选项和定义
  • 包含目录
  • 测试定义
  • 子目录

unity_templates.py

Unity测试框架支持:

  • 测试文件生成
  • CMake集成模板
  • Mock模板生成
  • 断言参考

c_security_rules.py

安全漏洞检测:

  • 危险函数检测(strcpy, gets等)
  • CWE规则库
  • 格式化字符串漏洞
  • 硬编码凭证检测
  • 内存安全问题

Installation

# Install dependencies
pip install tree-sitter tree-sitter-c pycparser

# Or use the requirements.txt
pip install -r requirements.txt

Testing

cd skills/c-support
python -m pytest tests/

Integration

其他技能可以通过以下方式使用:

import sys
sys.path.insert(0, '/path/to/skills/c-support/lib')

from c_parser import CParser
from cmake_parser import CMakeParser
# ... etc

License

MIT License

安全使用建议
This package appears to implement exactly what it claims (C parsing, CMake analysis, Unity test generation, and security checks). Before installing or running it, do the following: (1) review the code paths that call subprocess/exec or tree-sitter initialization to understand what external programs or native builds may run; (2) run the test suite in an isolated/sandbox environment (container/VM) because tests write to /tmp and parsing libraries may build native extensions; (3) do not provide any secrets or elevated privileges to the environment where you run it; (4) if you plan to integrate this into an automated agent, limit the agent's exec rights or inspect subprocess invocations to avoid unexpected shell commands.
能力评估
Purpose & Capability
Name/description (C AST parsing, CMake analysis, Unity test generation, security rules) match the included Python modules and tests. The code implements parsers, rule checks, and test generators consistent with the declared purpose; no unrelated environment variables, external services, or unexpected binaries are requested.
Instruction Scope
SKILL.md asks the agent to read/write files and execute commands (tools: read, write, exec). The bundled code legitimately reads source/CMake files and the test harness writes sample files to /tmp. The exec capability is plausible (the parser imports subprocess and tree-sitter may need native components), but granting exec increases risk — inspect any runtime subprocess calls before running in a privileged environment.
Install Mechanism
No install spec is embedded; dependencies are listed in requirements.txt (tree-sitter, tree-sitter-c, pycparser). Those are standard PyPI/native-binding packages. No downloads from unknown URLs or archive extraction steps are present in the skill metadata.
Credentials
The skill declares no required environment variables or credentials. The security-checking code looks for hardcoded credentials (patterns for passwords/AWS keys) but does not request any secrets. That detection behavior is appropriate for a security rule checker.
Persistence & Privilege
always:false and default invocation settings are used. The skill does not request persistent system-wide changes or modify other skills' configs in the provided files. It will run only when invoked.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install c-support
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /c-support 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: AST parser, CMake parser, Unity templates, security rules for C projects
元数据
Slug c-support
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

C Support Library 是什么?

C Language Support Library for OpenClaw skills. Provides AST parsing, CMake analysis, Unity test generation, and security rule checking for C projects. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 100 次。

如何安装 C Support Library?

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

C Support Library 是免费的吗?

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

C Support Library 支持哪些平台?

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

谁开发了 C Support Library?

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

💬 留言讨论