Dev audio review

From Nebulavenus/forge-gpu · View interactive version

Dev audio review is an AI agent skill from the GitHub repository Nebulavenus/forge-gpu. Code quality, correctness, and documentation review for audio lessons — run before dev-final-pass

How to use this skill

Skill file

Run an audio-specific quality review on an audio lesson before running

/dev-final-pass. This skill catches the recurring code quality, correctness,

and documentation issues specific to forge_audio.h and its callers. It is

not a replacement for /dev-final-pass — it covers the audio-domain concerns

that the general final pass does not.

The user provides:

If missing, infer from the current branch name or most recent audio 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/audio/forge_audio.h, the lesson's main.c, and the relevant test

files (tests/audio/test_audio.c). Each agent works independently and

reports findings.

Agent 1: Memory safety

Agent 2: Parameter validation

Agent 3: Bug detection

loop points)

Agent 4: Thread safety

synchronization

Agent 5: Resource cleanup

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


Phase 2 — Verification checks

Spawn one agent per check to verify the following across all changed files.

Check 1: Test return value assertions

Scope: all test files in tests/audio/

Wrap forge_audio_* calls that return false or NULL on failure with

ASSERT_TRUE(...) or ASSERT(... != NULL) so tests fail immediately on

unexpected errors.

Check 2: Magic numbers in tests

Scope: all test files in tests/audio/

Numeric literals representing sample rates, volumes, channel counts, buffer

sizes, panning values, and tolerances should be #define constants. Follow

the same convention as other test files in the project.

Check 3: Numerical safety

Scope: common/audio/forge_audio.h

and filter coefficient calculations

phase accumulators in oscillators)

Check 4: Audio correctness

Scope: common/audio/forge_audio.h

volume dip at center — or if linear is used, document the trade-off

Check 5: Unused variables

Scope: common/audio/forge_audio.h, the lesson's main.c, all

changed test files

Remove any unused variables, #define constants, typedefs, or struct fields.

Check 6: API comment accuracy

Scope: common/audio/forge_audio.h, the lesson's main.c, the

lesson's README.md

Update or remove misleading or incorrect API comments. Check that documented

behavior matches actual behavior, parameter descriptions match actual types,

and cited references are correct.

Check 7: UI integration

Scope: the lesson's main.c

Check 8: Test setup return values

Scope: all test files in tests/audio/

Ensure test setup/helper code that can fail returns a boolean value and

callers ASSERT_TRUE on it.

Check 9: Mandatory lesson contract

Scope: the lesson's main.c and shaders

Every audio lesson must include the rendering and UI baseline defined in

/dev-audio-lesson. Verify each item is present — the review FAILS if

any are missing:

Rendering baseline (all required):

UI baseline (all required):

Audio baseline (all required):

After collecting findings:

  1. Validate — review each finding
  2. Fix — apply corrections
  3. Revalidate — re-check
  4. Repeat until zero findings

Phase 3 — Documentation and content verification

Spawn one agent per check to verify documentation quality.

Doc check 1: Struct and function documentation

Scope: common/audio/forge_audio.h

Verify that every struct field has an inline comment explaining:

Verify that every function has a doc comment with:

lesson cross-reference, source reference

Doc check 2: KaTeX consistency

Scope: the lesson's README.md

Verify KaTeX math follows project conventions: inline $...$, display

$$...$$ on three lines, variable names match code, formulas are correct.

Doc check 3: Matplotlib diagram compliance

Scope: any diagram scripts modified or added for this lesson

Verify diagrams adhere to /dev-create-diagram guidelines.

Doc check 4: README-to-code accuracy

Scope: the lesson's README.md, main.c, and common/audio/forge_audio.h

Verify every code snippet, function signature, and struct definition in the

README exactly matches the actual code.

Doc check 5: README currency

Scope: README.md (root), lessons/audio/README.md,

common/audio/README.md, CLAUDE.md, PLAN.md

Verify all index files are up to date:

After collecting findings:

  1. Validate — review each finding
  2. Fix — apply corrections
  3. Revalidate — re-check
  4. Repeat until zero findings

Reporting

After completing all phases, report a summary table:

Audio Review Results — Lesson NN: Name
=======================================

Phase 1 — Code Correctness
  Memory safety        ✅ PASS  (N functions checked)
  Parameter validation ✅ PASS  (N functions checked)
  Bug detection        ✅ PASS
  Thread safety        ✅ PASS
  Resource cleanup     ✅ PASS

Phase 2 — Verification Checks
  1. Test assertions       ✅ PASS  (N calls wrapped)
  2. Magic numbers         ✅ PASS
  3. Numerical safety      ✅ PASS  (N guards verified)
  4. Audio correctness     ✅ PASS  (N paths checked)
  5. Unused variables      ✅ PASS
  6. Comment accuracy      ✅ PASS
  7. UI integration        ✅ PASS
  8. Setup returns         ✅ PASS
  9. Lesson contract       ✅ PASS  (rendering, UI, audio baselines)

Phase 3 — Documentation
  1. Struct/function docs  ✅ PASS  (N fields, N functions documented)
  2. KaTeX consistency     ✅ PASS
  3. Diagram compliance    ⏭️  SKIP (no diagrams modified)
  4. README accuracy       ✅ PASS
  5. README currency       ✅ PASS

For each WARN, FIXED, or FAIL, list the specific file, line, and issue with

the fix applied (or suggested if not yet applied). Ask the user if they want

to proceed to /dev-final-pass.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.