c-pro
Expert C Programming Assistant
Writing safe, efficient C code requires deep expertise in memory management and system programming. This skill provides expert guidance on proper malloc/free patterns, pointer arithmetic, POSIX system calls, and embedded systems development.
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“c-pro”。 Write a function to parse a CSV file and return an array of strings
预期结果:
- A C function that opens the file with fopen, allocates memory for each line using malloc, properly handles fgetsc errors, and includes a cleanup function to free all allocated memory. The function returns NULL on failure with errno set appropriately.
正在使用“c-pro”。 How do I implement a thread-safe counter in C?
预期结果:
- A pthreads-based implementation showing a mutex-protected counter structure, with initialization, increment with lock/unlock, and destruction functions. Includes example usage demonstrating proper lock acquisition and release patterns.
安全审计
安全Security review completed. Both static findings are false positives: (1) The backtick syntax on line 28 is markdown code formatting, not shell execution. (2) No cryptographic algorithms exist in the skill content. This is a legitimate C programming assistance skill with no confirmed security risks.
低风险问题 (2)
风险因素
⚙️ 外部命令 (1)
质量评分
你能构建什么
Systems Programming Projects
Get expert guidance on writing system-level C code with proper memory management, system calls, and error handling for operating systems or driver development.
Embedded Development
Receive assistance with resource-constrained embedded systems programming, including memory pool allocation, stack optimization, and hardware interaction patterns.
Code Review and Optimization
Get detailed review of existing C code with valgrind-clean output, performance benchmarking suggestions, and clang-tidy improvements.
试试这些提示
Write a C function that [describe the task]. Include proper error handling and memory management.
Implement a [data structure name] in C with proper memory allocation, deallocation, and boundary checking. Use C99 standard.
Create a safe wrapper around [system call name] that handles all error conditions, sets errno correctly, and includes proper documentation.
Write a multi-threaded C program using pthreads that [describe functionality]. Include mutex locks for shared resources and proper thread cleanup.
最佳实践
- Always check return values from malloc and system calls - never assume allocation or system operations succeed
- Use static analysis tools like clang-tidy and valgrind regularly to catch memory leaks and undefined behavior
- Follow C99/C11 standards and use compiler warnings (-Wall -Wextra -Werror) to catch potential issues at compile time
避免
- Not checking malloc return value - a NULL return causes undefined behavior when dereferenced
- Using printf format specifiers incorrectly - mismatched types cause undefined behavior and security vulnerabilities
- Forgetting to include include guards in headers - causes linker errors with multiple inclusions