Skip to content
Development
Skill

/juce-review

Reviews JUCE audio plugin code for JUCE-specific correctness issues: thread safety, APVTS parameter patterns, MessageManager usage, ValueTree, and MIDI handling. Use when the user asks to review a JUCE plugin, check a processBlock, audit parameter handling, or asks "is this JUCE

From plugin
sonic-skills
2218 skills

Claude Code

$ npx -y skills add kunitoki/sonic-skills --skill juce-review --agent claude-code

SKILL.md

juce-review.SKILL.md
name: juce-review
description: >
  Reviews JUCE audio plugin code for JUCE-specific correctness issues: thread safety,
  APVTS parameter patterns, MessageManager usage, ValueTree, and MIDI handling. Use when
  the user asks to review a JUCE plugin, check a processBlock, audit parameter handling,
  or asks "is this JUCE code safe?". Trigger on phrases like "review my JUCE plugin",
  "check my AudioProcessor", "is this APVTS usage correct?", or when you see
  AudioProcessor, AudioProcessorEditor, or AudioProcessorValueTreeState in the code.

JUCE Audio Plugin Review

JUCE abstractions hide thread boundaries — always trace which thread each piece of code runs on before declaring it safe.

Step 0 — Run universal checks first

Invoke `audio-dsp-review` and `audio-numerics-review` before this skill. This skill adds JUCE-specific checks on top; it does not replace realtime-safety or numerics reviews.

Step 1 — Identify plugin structure

Locate the three core classes and their thread ownership:

  • `AudioProcessor` — audio thread owns `processBlock`; message thread owns everything else
  • `AudioProcessorEditor` — message thread only; never call from audio thread
  • `AudioProcessorValueTreeState` — parameter tree lives on message thread; audio thread must use `getRawParameterValue()` raw pointers only

Step 2 — Scan for JUCE violations

| Violation | Where to look | Risk | |-----------|--------------|------| | `juce::String` construction/concatenation | `processBlock`, DSP helpers | May allocate and may touch shared string/logging machinery; realtime unsafe | | `DBG()` macro | Any audio-thread code | Logger I/O in debug builds; blocks indefinitely | | `MessageManager::getInstance()` from audio thread | Audio callbacks, DSP helpers | Not thread-safe; undefined behaviour | | `apvts.getParameter(...)` or `apvts.state` from audio thread | `processBlock` and DSP helpers | APVTS/ValueTree access is not an audio-thread data path; use raw pointer cache instead | | `ValueTree` listener callbacks assumed on audio thread | Listener overrides | Dispatched via MessageManager; runs on message thread | | `AudioBuffer::setSize()` inside `processBlock` | Buffer management code | Triggers allocation; causes xrun | | Modifying MIDI buffer while iterating it | MIDI event loops | Iterator invalidation; undefined behaviour | | `prepareToPlay` not resetting all state (e.g. filters, envelopes, delay lines) | `prepareToPlay` body | Double-call leaves stale state; causes audio artefacts | | `juce::CriticalSection::tryEnter()` or `enter()` on audio thread | `processBlock`, DSP helpers | `exit()`/destructor does a syscall to wake waiting threads — not realtime-safe even with `tryEnter()` | | `juce::SpinLock::enter()` on audio thread | `processBlock`, DSP helpers | Busy-waits on audio thread — use `tryEnter()` + fallback only; non-audio thread should use progressive back-off |

Step 3 — Write the review

## JUCE Plugin Review: `[file / class]`

### Verdict
[Safe | Has critical violations | Warnings only] — [one sentence summary]

### Critical Violations
**[Category]: [description]**
`file:line` — `offending code`
Why: [one sentence on thread / correctness risk]
Fix: [concrete JUCE-idiomatic suggestion]

### Warnings
[same format]

### What's Done Well
[correct patterns observed]

### Recommended Fixes (priority order)
1. ...

Quick fix table

| Violation | Fix | |-----------|-----| | `juce::String` in `processBlock` | Pre-format on message thread; pass IDs/scalars via `AbstractFifo` or atomics | | `DBG()` in audio code | Remove entirely or gate behind a lock-free ring buffer drained on message thread | | `MessageManager` from audio thread | Use `juce::MessageManager::callAsync` from message thread only | | `apvts.getParameter(id)` in audio thread | Cache `getRawParameterValue(id)` once after APVTS construction; read atomically in `processBlock` | | `ValueTree` listener on audio thread | Handle listener callbacks on message thread; pass state to audio thread via atomics | | `AudioBuffer::setSize()` in `processBlock` | Call only in `prepareToPlay`; never resize during playback | | Mutating MIDI buffer mid-iteration | Collect into a preallocated member buffer or bounded event array, then swap/write back after iteration | | Missing state reset in `prepareToPlay` | Reset filters, envelopes, delay lines, and position counters unconditionally | | `CriticalSection::tryEnter()` in audio thread | Replace with `std::atomic<T>` or lock-free SPSC queue; `tryEnter()` + `exit()` is not safe because `exit()` does a syscall | | `SpinLock::enter()` on audio thread | Use `tryEnter()` + fallback only; non-audio thread should use progressive back-off (see `references/juce-violations.md` Section 4) |

For full code examples (BAD/GOOD patterns, AbstractFifo usage, async dispatch) see `references/juce-violations.md`.

Read more
@kunitoki
Ships withsonic-skills

Precision audio-engineering skills for AI agents. Sonic Skills is a curated pack of Markdown skills for reviewing, debugging, explaining, and implementing audio software.

Stars on GitHub

Momentum

stars in total
22
Star history of kunitoki/sonic-skills on GitHub, a chart by star-history.com

Other skills on sonic-skills.

au-review

au-review

Reviews AudioUnit v2/v3 plugin implementations for spec compliance, thread safety, and correctness. Use when the user asks to…

audio-dsp-review

audio-dsp-review

Reviews audio DSP and audio processing code for realtime safety violations. Use whenever the user asks to review, audit, or check…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about juce-review.

Which coding agents can use juce-review?
juce-review installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.