- Home
- Skills
- Copyleftdev
- Sk1llz
- Ritchie
ritchie_skill
- Python
3
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill copyleftdev/sk1llz --skill ritchie- SKILL.md6.6 KB
Overview
This skill encodes the programming philosophy and style of Dennis Ritchie for writing systems code in C. It emphasizes small, transparent abstractions, portable implementations, and clear, disciplined interfaces. Use it when you want C code and APIs that favor simplicity, efficiency, and long-term maintainability.
How this skill works
The skill inspects code and suggestions for adherence to Ritchie-style principles: minimal language surface, explicit error returns, pointer idioms, and careful use of fixed-width and size types. It recommends header-only public interfaces with opaque types, stack-first allocation patterns, and clarity about costs and portability. It flags undefined behavior, platform assumptions, magic numbers, and unnecessary casts.
When to use it
- Designing low-level libraries or system interfaces in C
- Refactoring legacy C for portability and clarity
- Defining minimal public APIs and opaque types
- Writing performance-sensitive utility functions
- Reviewing code for Unix-like error and resource conventions
Best practices
- Prefer clear, small functions that do one thing and return explicit error codes
- Use size_t and stdint.h types; avoid assuming type sizes
- Document interfaces, not implementations; hide internals behind opaque types
- Avoid undefined behavior and unnecessary casts; heed compiler warnings
- Favor stack allocation, static internal linkage, and minimal public headers
Example use cases
- Create a portable I/O utility that follows Unix read/write semantics and returns -1 on error
- Design a minimal public API with opaque Context and clear lifecycle functions
- Refactor string and buffer routines to pointer idioms and stack-friendly layouts
- Implement cross-platform endian helpers using fixed-width types and explicit checks
- Write small system utilities where the cost of abstraction is documented and visible
FAQ
No. It prefers stack allocation when safe, but uses malloc and explicit ownership when necessary. Always check allocation results and return errors explicitly.
How strict should naming and formatting be?
Names should convey purpose and lifetimes; formatting can follow K&R conventions. The goal is clarity and predictability, not rigid aesthetics.