Command Palette

Search for a command to run...

Назад к скиллам
скилл № 30135

dev-physics-review

Code quality, correctness, and documentation review for physics lessons — run before dev-final-pass

БесплатноБез исполняемых скриптов
Nebulavenusот Nebulavenus★ 51 звезда на GitHub

Установить dev-physics-review в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Run a physics-specific quality review on a physics lesson before running /dev-final-pass. This skill catches the recurring code quality, correctness, and documentation issues specific to forge_physics.h and its callers. It is not a replacement for /dev-final-pass — it covers the physics-domain concerns that the general final pass does not.

The user provides:

  • Lesson number or name (e.g. 01 or point-particles)

If missing, infer from the current branch name or most recent physics lesson directory.

How to run this skill

Work through the three phases below in order. Each phase launches parallel agents. After each phase, validate findings, apply fixes, then have the agents revalidate. Repeat until no more issues are found.

Use a Task agent (model: haiku) for builds, test runs, and linting — never run those directly from the main agent.

Be literal and exhaustive. This is C — no RAII, no garbage collector. Every resource you acquire must be released on every exit path, every struct field must be documented, every error must be handled. Do not rationalize away findings with "it's probably fine." If the check says every function, check every function.


Phase 1 — Code correctness sweep

Spawn one agent per concern to review every function added or modified in common/physics/forge_physics.h, the lesson's main.c, and the relevant test files (tests/physics/test_physics.c). Each agent works independently and reports findings.

Agent 1: Memory safety

  • Buffer overflows, out-of-bounds access, use-after-free
  • Array index bounds relative to capacity/count fields (particle arrays, contact arrays, constraint arrays)
  • Pointer arithmetic that could go out of range
  • String operations without length checks

Agent 2: Parameter validation

  • NULL pointer dereference on every function parameter
  • Integer overflow or underflow on size/count parameters
  • Negative mass, negative dt, zero-length vectors passed to normalize
  • Functions that silently accept invalid state (e.g. NaN position)

Agent 3: Bug detection

  • Off-by-one errors in loops and index calculations (particle iteration, contact pair enumeration)
  • Incorrect operator precedence in compound expressions (force calculations, dot/cross products)
  • Copy-paste errors (wrong axis in repeated x/y/z blocks, wrong particle in pair operations)
  • Incorrect comparison operators (< vs <=, == vs !=)
  • Integer truncation or implicit narrowing conversions (float to int in index calculations)

Agent 4: Undefined behavior

  • Signed integer overflow
  • Shift amounts exceeding type width
  • Uninitialized variables read before assignment (especially in struct init functions — every field must have an explicit initial value)
  • Strict aliasing violations
  • Division by zero without guards (mass, vector length, denominator in impulse calculations)

Agent 5: Resource cleanup

  • Every SDL_malloc/SDL_calloc/SDL_realloc has a matching SDL_free on every exit path — bare malloc/free must not be used; the codebase uses SDL's allocation functions exclusively
  • Every dynamically allocated array inside a struct is freed with SDL_free when the struct is destroyed
  • Early-return paths release all resources allocated before the return (GPU buffers, shape data, textures)
  • forge_shapes_free() called for every generated shape after GPU upload
  • Cleanup functions handle partially initialized state (NULL fields)
  • SDL GPU resources (buffers, textures, pipelines, samplers) released in SDL_AppQuit

After collecting findings from all five agents:

  1. Validate — review each finding to confirm it is a real issue
  2. Fix — apply corrections to the source files
  3. Revalidate — have the agents re-check the fixed code
  4. Repeat until zero findings remain
  5. Add tests — write tests covering every function reviewed and every issue found. Ensure callers of these functions check return values.

Phase 2 — Verification checks

Spawn one agent per check to verify the following across all changed files. The scope for each check is specified in its description.

Check 1: Test return value assertions

Scope: all test files in tests/physics/

For setup and success-path code, wrap forge_physics_* calls that return false on failure with ASSERT_TRUE(...) so tests fail immediately on unexpected errors.

For negative-path tests that intentionally trigger failures, assert the expected failure explicitly with ASSERT_FALSE(...) (or equivalent).

What to look for:

  • Bare calls like forge_physics_integrate(&p, dt) without checking the return
  • Calls inside helper functions that swallow the return value
  • Setup code that calls library functions but does not propagate failures

Check 2: Magic numbers in tests

Scope: all test files in tests/physics/

Numeric literals representing reusable or semantically meaningful tuning parameters (masses, forces, timesteps, tolera

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл dev-physics-review?

Code quality, correctness, and documentation review for physics lessons — run before dev-final-pass

Как установить скилл dev-physics-review?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл dev-physics-review запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить dev-physics-review с