clean-code-audio
Skill1 starsChanged 3 months agoMITView on GitHub
Use when writing JUCE/audio DSP code — real-time-safety and DSP-specific idioms (parameter smoothing, block processing, branch-free loops, denormals, message↔audio-thread model). Complements clean-code-cpp.
In this repository9 other files it gives its agents.
- agent-orchestrationSkill
- clean-code-bashSkill
- clean-code-coreSkill
- clean-code-cppSkill
- clean-code-cSkill
- clean-code-goSkill
- clean-code-pythonSkill
- clean-code-rustSkill
- clean-code-tsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Never apply a raw parameter jump in the audio path — zipper noise.
- Very specific: line 19
Prefer branch-free math in the hot loop (select/min/max over if).
- Very specific: line 20
Prefer float unless precision demands double.
- Very specific: line 23
Keep DSP as pure functions/classes over buffers in Source/dsp/, decoupled from JUCE UI, so it's unit-testable with signal fixtures and …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Clean-code audio / DSP (depth)
Apply on top of the audio-plugin base rules (RT-audio non-negotiables, DSP-is-sacred, golden-buffer tests, pluginval). Also use clean-code-cpp.
The two-thread model
- The audio thread (processBlock) and the message thread (UI, params) never share mutable state via locks.
- Pass parameters across with
std::atomicor a lock-free FIFO; the audio thread only reads smoothed snapshots.
Parameter smoothing
- Never apply a raw parameter jump in the audio path — zipper noise. Smooth it (
juce::SmoothedValueor a one-pole) and read per-sample or per-block.
The inner loop
- Process in blocks; hoist invariants out of the per-sample loop.
- Prefer branch-free math in the hot loop (select/min/max over
if); branches stall the pipeline and hurt determinism. - Prefer
floatunless precision demandsdouble. Flush denormals (ScopedNoDenormals), and design filters/feedback so denormals don't accumulate.
Testability & sacredness
- Keep DSP as pure functions/classes over buffers in
Source/dsp/, decoupled from JUCE UI, so it's unit-testable with signal fixtures and golden buffers (impulse, sine sweep). processBlockstays a thin dispatcher: read the smoothed parameters, then call DSP functions that take the buffer and their state as arguments.- Randomness (noise, dither, humanize) comes from a preallocated RNG the caller passes in and seeds. Tests use a fixed seed, so golden buffers stay reproducible.
- DSP is sacred: a golden-buffer test failing on a non-DSP change means something leaked into the algorithm — stop and fix the boundary, don't update the golden file.
Signals it's going wrong
- Allocation/lock/log inside processBlock → move it to the message thread or preallocate.
- A parameter read directly in the loop without smoothing → audible artifacts.
- DSP logic reaching into UI/JUCE component state → break the coupling.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

