← Back to Skills Marketplace
michealxie001

C Support Library

by michealxie001 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
100
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install c-support
Description
C Language Support Library for OpenClaw skills. Provides AST parsing, CMake analysis, Unity test generation, and security rule checking for C projects.
README (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

Usage Guidance
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install c-support
  3. After installation, invoke the skill by name or use /c-support
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release: AST parser, CMake parser, Unity templates, security rules for C projects
Metadata
Slug c-support
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 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. It is an AI Agent Skill for Claude Code / OpenClaw, with 100 downloads so far.

How do I install C Support Library?

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

Is C Support Library free?

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

Which platforms does C Support Library support?

C Support Library is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created C Support Library?

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

💬 Comments