dev-physics-review
Code quality, correctness, and documentation review for physics lessons — run before dev-final-pass
от 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.
01orpoint-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_reallochas a matchingSDL_freeon every exit path — baremalloc/freemust not be used; the codebase uses SDL's allocation functions exclusively - Every dynamically allocated array inside a struct is freed with
SDL_freewhen 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:
- Validate — review each finding to confirm it is a real issue
- Fix — apply corrections to the source files
- Revalidate — have the agents re-check the fixed code
- Repeat until zero findings remain
- 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
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
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), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…