Przejdź do treści
Biblioteka skilli
Programowanie · Przegląd i audyt

c-optimizer

/c-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.

Licencja
MIT
Ostatnia zmiana repozytorium
04.11.2026

Ocena i bezpieczeństwo

85/ 100Klasa: dobry
Format20 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
10
Skrypty
1
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 04.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 1 skrypt w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.

Skrypty: scripts/audit.py

Co robi i kiedy

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.

Wyzwalacze z opisu

optimize my C code
Oryginalny opis (EN)

Audit and optimize C23 codebases (GCC 16/Clang 22/MSVC, CMake, Make, pkg-config) for build flags, undefined behavior and memory ownership, buffer/format-string safety, allocation and cache behavior, pthread/atomics concurrency, syscall and I/O cost, sanitizers/fuzzing, and profiling, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions slow C, memory leaks/segfaults, valgrind/ASan/UBSan, `-O2`/LTO/PGO, CMake flags, pthread data races, buffer overflows, or "optimize my C code" -- even

Jak działa

  1. Workflow
  2. Principles
  3. Docs
Sekcje z nagłówków SKILL.md, w oryginale · 61 linii, 598 słów
Podgląd SKILL.md
---
name: c-optimizer
description: Audit and optimize C23 codebases (GCC 16/Clang 22/MSVC, CMake, Make, pkg-config) for build flags, undefined behavior and memory ownership, buffer/format-string safety, allocation and cache behavior, pthread/atomics concurrency, syscall and I/O cost, sanitizers/fuzzing, and profiling, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions slow C, memory leaks/segfaults, valgrind/ASan/UBSan, `-O2`/LTO/PGO, CMake flags, pthread data races, buffer overflows, or "optimize my C code" -- even if they never say audit or optimize.
---

# C Optimizer

C is fast until the build is wrong, memory ownership is unclear, or the hot loop fights the cache. C23 is the current language revision (GCC 15+ defaults to it); optimization is mostly build flags, data layout, allocation strategy, I/O and correctness under UB. Nothing is edited before approval because ownership and concurrency changes can break callers.

## Workflow

### 1. Scope (quick)

- Find the project root and record the toolchain: C standard/compiler, CMake/Make/Meson, build type and flags, libc/platform, sanitizer/fuzzing setup, threading model, and target architecture.
- Run `python <skill-dir>/scripts/audit.py <project-root>` -- static scan of build files and sources for legacy standards, debug flags in release, unchecked buffers, allocation/copy cost, data races, blocking I/O, missing sanitizers, with file:line evidence. Use `--json` to post-process.
- Classify the pain: throughput/latency, memory growth, CPU saturation, concurrency/correctness, I/O or database cost, build/startup, or safety/maintenance. Ask which hurts if unclear.
- Read `references/tooling.md` once: what can be measured here.

### 2. Audit

The script finds cheap leads; you find the rest by reading the hot path and the build. Read the build manifest, entrypoint, the 3-5 hot functions/endpoints and the data layer. Load only what applies:

| Build, toolchain and runtime | `references/build-runtime.md` |
| Memory, layout and concurrency | `references/memory-concurrency.md` |
| I/O, syscalls and data | `references/io-data.md` |
| Safety and quality | `references/safety-quality.md` |
| Measurement | `references/tooling.md` |

**Measure, never guess.** Build with production settings, run with production data/load, and profile that. Debug builds, dev servers and a single request are not evidence. Take a profile before micro-optimizing and a heap/allocator snapshot before raising limits.

Mark each finding **Confirmed** (profile/load/code evidence) or **Suspected** (needs measuring).

### 3. Report

Fill `assets/report-template.md`, save it as `C_OPTIMIZATION_REPORT.md` in the project root, and show the user. Five-line summary, findings table by impact/effort, then per-finding detail (evidence, why it hurts, fix, risk, behavior impact). Group near-duplicates.

### 4. Plan -- then stop for approval

Use plan mode: `EnterPlanMode` (load with ToolSearch if deferred), write the plan, present with `ExitPlanMode`; if unavailable show it in chat and wait for an explicit "go". Structure:

1. **Quick wins** -- build flags, missing indexes/caching, timeouts/pool limits, avoidable allocations/copies, sync I/O in hot paths, missing `await`/join, safer bounds checks, log noise, config limits. Low risk.
2. **Structural** -- bound concurrency, batch N+1, stream large payloads, change data structures/ownership, split hot paths, cache correctly, connection/worker pools, graceful shutdown, observability. Name each behavior change.
3. **Heavy** -- language/toolchain major upgrade, runtime/GC change, framework/ORM swap, architecture change, AOT/trimming, database migration. Separately approved.
   Each step: files touched, expected effect, how to verify, how to roll back.

### 5. Fix

Only approved items, in small groups. After each: build with production flags, run the test suite, and re-run the same benchmark/profile. A break must trace to one change. Do not mix a toolchain major upgrade with optimization edits. If a change alters ownership, concurrency, API/DB semantics or failure behavior, stop and ask.

### 6. Verify and wrap up

Re-measure the same workload and data: throughput and p50/p95/p99, CPU, RSS/heap, allocations/GC, I/O, error rate, build time and binary/image size. State plainly what could not be measured. End with deferred items and one suggested next step.

## Principles

- **Correctness is performance.** UB, races and overflows invalidate every benchmark.
- **Measure release builds.** `-O0` and debug assertions are not production.
- **Ownership is the contract.** Every allocation has one owner and one free path.
- **Data layout beats micro-tuning.** Cache locality and fewer allocations usually win.
- **Sanitizers before optimizations.** ASan/UBSan/TSan find the bugs that make numbers meaningless.

## Docs

- https://en.cppreference.com/c/23
Pliki w paczce (10)
  • LICENSE 1 KB
  • README.md 1 KB
  • SKILL.md 5 KB
  • assets/report-template.md 1 KB
  • references/build-runtime.md 1 KB
  • references/io-data.md 1 KB
  • references/memory-concurrency.md 1 KB
  • references/safety-quality.md 1 KB
  • references/tooling.md 1 KB
  • scripts/audit.py 9 KB

Wersje

W bazie nie ma innych skilli o nazwie c-optimizer.

Migawka bazy z 13.11.2026 · wersja paczki cebee7125824 (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

  • 85cpp-optimizer
    Audytuje i optymalizuje bazy kodu C++23 pod kątem flag kompilacji, zarządzania pamięcią, kopiowania i lokalności danych, z pomiarami przed i po.
  • 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.
  • 85go-optimizer
    Audytuje projekty w Go pod kątem szybkości, alokacji, współbieżności, opóźnień bazy danych i rozmiaru binarki, z pomiarami przed i po oraz planem poprawek.
  • 100cpp
    Pomaga pisać, przeglądać, modernizować, budować i debugować C++: RAII, własność przez smart pointery, semantykę przeniesienia, CMake oparty na celach z FetchContent oraz eliminację niezdefiniowanego zachowania przez ASan, UBSan, TSan i clang-tidy.
  • 90gcc
    Pomaga w buildach C i C++ z GCC: flagi trybów budowania, analiza ostrzeżeń, informacje debugowania, LTO, PGO oraz wyjaśnianie błędów kompilacji.
  • 100c-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.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.