c-systems
/c-systems
Opisuje wzorce dla kodu systemowego w C: układ modułów, obsługę błędów, bezpieczeństwo pamięci, niezdefiniowane zachowania i pomiar wydajności, z sanitizerami i Valgrind.
- Autor
- iliaal ↗
- Repozytorium
- ai-skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 25.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 9
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 25.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Opisuje wzorce dla kodu systemowego w C: układ modułów, obsługę błędów, bezpieczeństwo pamięci, niezdefiniowane zachowania i pomiar wydajności, z sanitizerami i Valgrind.
Oryginalny opis (EN)
C patterns for systems code, libraries, and native extensions: module layout, function decomposition, status-enum errors, memory safety, undefined behavior, and performance measurement. Use when writing, reviewing, refactoring, or debugging C, working with malloc lifetimes, buffer overflows, sanitizers, or Valgrind, or building native extensions. For C++, see ia-cpp-systems.
Jak działa
- Working rules
- Repo conventions outrank this skill
- Verify
- Task-specific references
Podgląd SKILL.md
--- name: c-systems class: language description: >- C patterns for systems code, libraries, and native extensions: module layout, function decomposition, status-enum errors, memory safety, undefined behavior, and performance measurement. Use when writing, reviewing, refactoring, or debugging C, working with malloc lifetimes, buffer overflows, sanitizers, or Valgrind, or building native extensions. For C++, see ia-cpp-systems. paths: - "**/*.c" - "**/*.h" --- # C Systems & Native Code Covers C11 and later for libraries, systems code, and native extensions. For C++ (RAII, templates, move semantics), see the `ia-cpp-systems` skill. ## Working rules - Preserve the repository's sanctioned idioms and ABI; do not turn a scoped fix into a restyle. - State ownership, check fallible calls, validate public boundaries, and assert internal invariants. - **Preserve recovery outside optimizer assumptions.** An assertion that becomes an assumption can remove the branch handling its false case. Keep recoverable checks as runtime branches with diagnostic-only assertions behind a debug preprocessor guard. Exercise the fallback in an optimized release build. - **Guard staged initialization against reentry.** Set an in-progress marker before callback-capable work on every constructor or factory path. Permit retry after failure only after fully releasing and resetting partial state. Test recursive entry and retry after failed initialization. - Bound traversal of external input and check sizes before allocation or narrowing. - Choose helpers only when they name a concept, own an error, or isolate a side effect. - Verify the actual rebuilt artifact; use instrumented tests for safety and representative release builds for performance. ## Repo conventions outrank this skill Read the repo's `AGENTS.md`/`CLAUDE.md`, its public headers, and two adjacent `.c` files before writing anything. Where they conflict with the rules below, they win, and the diff carries no note about it. Do not skip this gate. Established C codebases sanction idioms these rules would otherwise flag: | Local idiom | Where it is correct | |---|---| | Tab indentation | php-src and its extensions, Linux kernel | | `goto cleanup` / `goto err` | Kernel, OpenSSL, curl, php-src: the dominant multi-resource release idiom | | Macros containing `return` | `RETURN_*`/`RETVAL_*` in PHP extensions, `Py_RETURN_*` in CPython | | Project status types | `zend_result`, `CURLcode`, `int` plus `errno`: do not invent a parallel enum beside one | Never widen a scoped task into a repo-wide restyle because adjacent untouched C predates a rule here. **When the target is a PHP extension** (`php_*.h`, `PHP_FUNCTION`, `zend_`, `config.m4`), load [php-extension-c.md](./references/php-extension-c.md) before applying any rule below. Layout, macros, the error model, memory, and assertions all carry extension-specific overrides, and the memory one in particular inverts the base guidance: extensions use a request-scoped allocator, not `malloc`/`free`. ## Verify - Build passes under the repo's warning profile with zero newly introduced warnings (greenfield: the full `-Wall -Wextra -Werror -Wconversion -Wshadow` bundle, zero warnings) - Test suite passes under `-fsanitize=address,undefined` with zero reports - `valgrind --leak-check=full --error-exitcode=1` clean where the suite links under it - Every new fallible call site checked; every new error value traced to one producer - Every new state-mutating leaf carries an assert - No new `goto` outside the repo's sanctioned form or the single-forward-jump cleanup; no recursion over external input; no loop over external input without a named bound ## Task-specific references Read the relevant reference before implementing or reviewing the matching behavior: - For module layout, naming, decomposition, control flow, errors, types, or macros: [implementation-structure.md](./references/implementation-structure.md). - For memory, external input, assertions, ABI changes, or shared-helper contracts: [runtime-safety.md](./references/runtime-safety.md). - For compiler setup, tests, build provenance, packaging, or performance claims: [build-and-measurement.md](./references/build-and-measurement.md). Existing specialized references, when the corresponding topic applies: - [php-extension-c.md](./references/php-extension-c.md). - [memory-safety.md](./references/memory-safety.md). - [correctness-traps.md](./references/correctness-traps.md). - [legibility-standard.md](./references/legibility-standard.md).
Pliki w paczce (9)
- SKILL.md 4 KB
- SPEC.md 4 KB
- references/build-and-measurement.md 11 KB
- references/correctness-traps.md 16 KB
- references/implementation-structure.md 8 KB
- references/legibility-standard.md 12 KB
- references/memory-safety.md 29 KB
- references/php-extension-c.md 13 KB
- references/runtime-safety.md 6 KB
Wersje
W bazie nie ma innych skilli o nazwie c-systems.
Migawka bazy z 13.11.2026 · wersja paczki a8e3b3cc3993 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 95lang-c
Pisze i sprawdza przenośny kod C11, C17 i C23: zarządzanie pamięcią, niezdefiniowane zachowania, bufory, obsługę błędów i narzędzia analizy. - 85c-optimizer
Audytuje i optymalizuje bazy kodu C23 pod kątem flag kompilacji, niezdefiniowanego zachowania, bezpieczeństwa buforów, współbieżności i wydajności, z pomiarami. - 95c-memory-errors
Opisuje błędy pamięci w C: przekroczenia tablic, wiszące wskaźniki, podwójne zwolnienie i wycieki, z narzędziami ASAN i Valgrind. - 100cpp-debugging
Prowadzi diagnozę awarii C++ związanych z czasem życia pamięci, niezdefiniowanym zachowaniem i natywnymi crashami, z symbolami, sanitizerami i debuggerami platformowymi przed poprawianiem objawów. - 100sota-c-cpp
Stosuje zasady pisania i audytu kodu C i C++: nowoczesne idiomy, bezpieczeństwo pamięci, niezdefiniowane zachowania, współbieżność, sanitizery oraz CMake, clang-tidy i CI. - 100valgrind
Uruchamia Valgrind Memcheck do wykrywania błędów sterty, wycieków i odczytów niezainicjalizowanej pamięci w niezmodyfikowanej binarce oraz profilowanie Cachegrind, Callgrind i Massif.