skills/safe-c/SKILL.md
Enforce "safe-c" coding principles in C. Based on TigerBeetle's Tiger Style. Use when writing, reading, reviewing, or refactoring C code to ensure maximum safety, predictable execution, zero technical debt, and extreme performance.
npx skillsauth add thedumptruck/skills safe-cInstall 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.
Build highly predictable, robust, and performant C applications with a "zero technical debt" policy. This style guide is heavily inspired by TigerBeetle's Tiger Style.
Always verify standards against the reference documentation before implementing.
| Resource | URL / Path |
|----------|------------|
| Safety & Control Flow | ./references/safety.md |
| Performance Patterns | ./references/performance.md |
| Developer Experience | ./references/dx.md |
Review the relevant documentation when writing new logic or performing code reviews.
| Need | Example | |------|---------| | Predictable Execution | Bounded queues, bounded loops, explicit state machines | | Memory Stability | Pre-allocating all memory at startup, static allocations, in-place initialization via out pointers | | Operational Reliability | Strict assertion density (2+ per function), pair assertions, compound assertion splitting | | Maintainability | Maximum 70 lines per function, max 100 columns per line, options structs |
malloc(), calloc(), free()) after startup phaselong or unsigned int where explicit sizes (uint32_t, int64_t) are required// Always bound loops and avoid recursion.
// Use explicit control flow and split compound conditions.
int process_items(const item_t* items, uint32_t items_count) {
assert(items != NULL);
assert(items_count <= MAX_ITEMS);
for (uint32_t i = 0; i < items_count; i++) {
if (items[i].is_active) {
if (items[i].value > THRESHOLD) {
// Handle specific positive case
}
}
}
return 0;
}
// Construct large structs in-place by passing an out pointer
// Avoids copies and implicit stack allocations
void buffer_state_init(buffer_state_t* out_state, const config_options_t* options) {
assert(out_state != NULL);
assert(options != NULL);
// In-place initialization
*out_state = (buffer_state_t){
.is_ready = true,
.capacity = options->capacity_bytes,
.cursor = 0,
};
}
ifs up, push fors down.static_assert for compile-time constants.uint32_t, int8_t). Avoid size_t or int except for indexing small loops or interfacing with standard library.snake_case, no abbreviations, add units/qualifiers at the end (latency_ms_max), sort by descending significance.malloc() during steady-state execution.if (a && b). Use nested ifs instead to handle each branch explicitly.development
Enforce "safe-ts" coding principles in TypeScript. Use when writing, reading, reviewing, or refactoring TypeScript code to ensure maximum safety, predictable execution, and zero technical debt.
development
Enforce "safe-rust" coding principles. Use when writing, reading, reviewing, or refactoring Rust code to ensure maximum memory safety, predictable execution, zero-cost abstractions, and idiomatic Rust patterns.
development
Enforce "safe-golang" coding principles in Go. Use when writing, reading, reviewing, or refactoring Go code to ensure maximum safety, predictable execution, and zero technical debt.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.