본문으로 건너뛰기
cccskills
무료GitHub에 공개

snx-code-quality

RFC #142's C rules: strict ISO C99, no redundant state, indices not pointer chains, one allocation per owner, atomics apart, no stored pointers, one global struct per file. Use when writing or reviewing C in src/.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

실행 점수 미검증

설치 방법 보기

포함된 파일(7)

  • SKILL.md3.4 KB
  • check.py13.4 KB
  • examples.md10.9 KB
  • test/fixtures/clean.c1.7 KB
  • test/fixtures/expected.txt668 B
  • test/fixtures/flagged.c1.0 KB
  • test/test-check.sh1.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Code quality (#142)

Write strict ISO C: C99, as the driver builds (-std=c99 -pedantic-errors), unless the target needs more. C99 is the baseline, so use what it has: static inline functions, <stdint.h> types (SnxU32/SnxU64 in the driver), 64-bit literals as 0x...ull (not UINT64_C, not two halves), SIZE_MAX in size checks (n > SIZE_MAX / size), %zu for a size_t, %llu/%llx through (unsigned long long) for a 64-bit value (never (unsigned long): long is 32 bits on Windows), bool or int flags, strtoull, snprintf. A declaration may follow statements and open a for; comments stay /* */, as the code has them. In place of C11 and C23: __atomic_* builtins on plain integers, a char padding array, a negative-size array typedef as the static assert. A file's build flags plus -std=c99 -pedantic list what is not. A local that starts zeroed is declared = {0}, not zeroed by a memset after its declaration; a memset stays for an object reached through a pointer. strdup is not C99: snx_strdup (common.h) is, and fails the way the rest of the code does when memory runs out.

  1. No state another value already says. A NULL pointer is absent: no is_present beside it. Not when NULL means something itself, or the flag says something else.
  2. Indices, not pointer chains. Objects in one array, linked by u32 index; 0 is none, so slot 0 is never an object. Not when the index can outlive its array.
  3. One allocation per owner. An owner's arrays come from one block carved by offsets (each at a multiple of its type's size), sizes checked against (size_t)-1, one free. Not for an array that grows on its own, or parts that live apart.
  4. Atomics apart. Atomics that different threads write get a cache line each (a char pad between). Not when one thread writes them all, or for many per-object atomics.
  5. No stored pointers in data. Data refers to its parts by index or offset, so a copy or a file holds together. Handles (FILE*, SDL, Vulkan) stay in a runtime struct beside it.
  6. One global per file. A file's mutable state (every variable of static duration, function-local statics included) is the members of one struct in one global, g_<file>, not loose globals. What other files read is declared once, in the header beside it, through the struct or a function. Not for const tables (they are data, not state), or for _Thread_local. In src/nx/hle/ the HLE's state is one global for the whole subsystem: each file's state struct is a member of g_hle (hle/hle.h), its type and initializer declared in the header beside the file, and the objects it makes and frees come from bounded pools in it (an all-zero slot is free, pool_take searches on from the last slot taken and asserts when full). No file there defines a variable of static duration.

Review: python3 .claude/skills/snx-code-quality/check.py FILES lists candidates for 1, 3, 4 and 6 (a candidate is not a finding until the code is read); read the diff for 2 and 5. Report file:line, the rule and the fix. A rule that does not apply is not a finding. Wrong and right C for each rule: examples.md.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Audits uncommitted changes, branches, or PRs for bugs, edge cases, SOLID/DRY/SRP, architecture, security, performance, and CLAUDE.md violations — then automatically fixes ALL issues and re-audits in a loop until clean. Use when: audit, review, code review, review this PR, check code, look over this, inspect code, or any variation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

scarletnx/ScarletNX2242026년 10월 25일 업데이트

Record what ScarletNX work taught, where the next session will look for it. Use after a bug took more than one attempt to find, when the same mistake happened twice, when a debugging technique worked, or when the user corrects how work is done.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

scarletnx/ScarletNX2242026년 10월 25일 업데이트

snx-build

무료

Build the ScarletNX runtime and recompile games correctly, avoiding the setups that build "successfully" into something that doesn't work. Covers the CPM.cmake dependencies, the Clang-only presets, the deploy into games/, when a game needs recompiling, and the warnings a plain build doesn't show. Use when building, rebuilding, recompiling a game, after pulling or bumping a dependency, or when a build result looks suspicious.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

scarletnx/ScarletNX2242026년 10월 25일 업데이트

snx-crash

무료

Take a ScarletNX crash report, svcBreak or hang from the log to the mechanism that causes it, using the symbolizer and disassembler on the game's code. Use when the game crashes (signal 11 or 7), calls svcBreak or fatal, hangs, or when a log shows "*** Crash". Also for corrupted data showing up in game structures.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

scarletnx/ScarletNX2242026년 10월 25일 업데이트

Write and optimize ScarletNX's own compute shaders (astc.comp, vic.comp, future ones) for what the GPU actually executes: constant tables, bit twiddling, uniform branches, fewer fetches, workgroup and subgroup structure, exactness proofs, and the GLSL-as-C++ tests and lavapipe timing that check them. Use when writing, reviewing or speeding up a GLSL shader under src/nx/gpu/, or when deciding whether to split one.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

scarletnx/ScarletNX2242026년 10월 25일 업데이트

snx-run

무료

Run a recompiled game unattended and judge the result: scripted button input, timed exit, screenshots, reading the log, and repeat runs for intermittent crashes. Use when verifying a runtime change, reproducing a bug, checking a scene renders, measuring a crash rate, or when the user asks to run or test the game.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

scarletnx/ScarletNX2242026년 10월 25일 업데이트

scarletnx의 스킬 모두 보기

이 스킬의 문제 신고