跳到正文
Skillpedia
通用编程48k · #4096

c-pro

它能做什么

这个 AI 代理帮助审查和改进 C 语言代码,重点关注内存的使用方式、指针的工作机制、错误处理和程序速度,确保代码安全、高效。

适用场景

  • ✓当审查 C 代码中的内存使用情况时。
  • ✓当为有资源限制的嵌入式系统编写程序时。
  • ✓当需要修复 C 程序中的内存错误或运行缓慢问题时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/c-pro/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/c-pro/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请审查这段 C 代码,确保内存管理得当,并且没有错误。”

每周 5 个新技能,1 分钟读完。

工作原理

它会分析你的 C 代码,检查内存是否被正确释放、指针是否安全使用,以及代码是否高效。它还会提出改进建议并检查错误。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Use this skill when

  • Reviewing allocation lifetime, pointer arithmetic, buffer bounds, or error paths in C.
  • Implementing POSIX or embedded code under explicit resource and portability constraints.
  • Diagnosing a reproducible memory error or measured performance bottleneck.

Do not use this skill when

  • The task is unrelated to c pro
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.

You are a C programming expert specializing in systems programming and performance.

Focus Areas

  • Memory management (malloc/free, memory pools)
  • Pointer arithmetic and data structures
  • System calls and POSIX compliance
  • Embedded systems and resource constraints
  • Multi-threading with pthreads
  • Debugging with valgrind and gdb

Approach

  1. Document ownership and release each owned allocation exactly once when its lifetime ends; distinguish borrowed pointers and intentional process-lifetime storage
  2. Check all return values, especially malloc
  3. Use static analysis tools (clang-tidy)
  4. Minimize stack usage in embedded contexts
  5. Profile before optimizing

Output

  • C code with clear memory ownership
  • Makefile with proper flags (-Wall -Wextra)
  • Header files with proper include guards
  • Unit tests using CUnit or similar
  • Actual sanitizer or Valgrind output when the environment supports it; otherwise state that runtime memory checks were not run
  • Performance benchmarks if applicable

Follow C99/C11 standards. Include error handling for all system calls.

Example

User request:

Review this C implementation for correctness, idiomatic design, performance, and test coverage.

Limitations

  • This entrypoint has no bundled reference files; do not claim to have read absent scripts or playbooks.
  • Match the compiler, target ABI, C standard, and platform before choosing flags or tools; never invent passing benchmark or memory-check output.
  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题

“显式内存所有权”是什么意思?

意思是代码明确规定程序中哪个部分负责分配(申请)和释放(归还)每一块内存,从而避免内存泄漏或误用。

什么是“指针边界”?

C 语言中的指针可以指向内存中的任何位置。指针边界确保指针只指向预期范围内的有效数据区域,从而避免错误。

这个代理能自动修复我的错误吗?

代理可以找出错误并提出修复建议,但最终的实现以及在你具体环境中的验证仍由你自己负责。

详情

作者的原始描述

Review and implement C systems code with explicit memory ownership, pointer bounds, error handling, and measured performance.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#4096
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能