coding/c-patterns/SKILL.md
C language patterns and best practices for safe, maintainable C: ownership, API contracts, error handling, integer safety, portability, and concurrency boundaries. Use when writing or reviewing C code (C11+), designing module interfaces, refactoring legacy C, or hardening low-level code paths.
npx skillsauth add aeondave/malskill c-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill focuses on safe C: explicit ownership, explicit errors, predictable control flow, and contracts that survive refactors.
If you’re writing tests, use c-testing.
Before coding:
borrowed, owned, transferred)..c.enum or code space) and whether errno is used.create/destroy, init/deinit, or open/close pairs consistently.malloc/free vs custom pool vs Win32 heaps).size_t for sizes/counts and guard all multiplication/addition used in allocation.n == 0, n > MAX_ALLOWED, overflow guards).Load on demand:
references/error-handling.md — error policy, return codes, cleanup patternsreferences/memory-ownership.md — allocation/free rules, zero-length alloc, free-nullreferences/integers.md — overflow, size_t usage, bounds checkingreferences/concurrency.md — pthreads, C11 atomics, Win32 threads, race detectionreferences/tooling.md — warnings, sanitizers, static analysis, binary inspection (MinGW/objdump, MSVC/dumpbin, Linux tools)development
Auth/lab ref: Unicorn Engine CPU-only emulation for shellcode, decryptors, custom VM handlers, instruction tracing, memory hooks, and register-level experiments.
development
Auth/lab ref: Renode board and SoC simulation for MCU/RTOS firmware, UART/GPIO/peripheral modeling, GDB remote debugging, REPL platforms, and RESC scripts.
development
Auth/lab ref: Qiling OS-layer binary emulation for PE/ELF/Mach-O/UEFI/shellcode with rootfs, syscall/API hooks, filesystem mapping, and runtime patching.
databases
Auth/lab ref: QEMU user-mode and full-system emulation for cross-arch binaries, firmware, kernels, disks, serial consoles, networking, and GDB stubs.