juce-best-practices

Enforce realtime-safe JUCE practices for audio-thread code.

9|Updated Oct 29, 2025
One-click install
npx skills add https://github.com/yebot/rad-cc-plugins --skill juce-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: juce-best-practices
Source: https://github.com/yebot/rad-cc-plugins/tree/main/plugins/juce-dev-team/skills/juce-best-practices
Command: npx skills add https://github.com/yebot/rad-cc-plugins --skill juce-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a professional JUCE development guide covering realtime safety, threading, memory management, and modern C++ patterns to build robust audio plugins.

Core Features & Use Cases

  • Realtime Safety: Guidelines to avoid allocations, locks, and I/O on the audio thread
  • Thread Management: Best practices for cross-thread communication
  • Memory Management: Safe patterns for allocation and lifetime
  • Modern C++ in JUCE: Patterns and idioms for maintainable code
  • Common Pitfalls: Frequent mistakes and how to avoid them

Quick Start

Run the realtime-safety checklist against your processBlock and update any risky calls (allocations, locks, or I/O) to ensure safe audio processing.

Frequently Asked Questions about juce-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent memory allocations in the JUCE audio thread?

Memory allocations in the audio thread cause realtime safety violations and audio glitches. Pre-allocate all buffers and data structures in prepareToPlay before audio processing starts, ensuring processBlock performs only lock-free reads and writes without dynamic memory requests.

What threading practices should I follow when building JUCE plugins?

JUCE threading best practices enforce strict separation: audio thread handles only realtime-safe operations; message threads handle UI and state changes. Use lock-free structures like atomics for cross-thread communication and avoid locks, I/O, or blocking calls on the audio thread.

Why does my JUCE audio plugin have clicks, pops, or dropouts?

Clicks and dropouts typically result from unsafe realtime operations: allocations, mutex locks, or I/O on the audio thread. Run the realtime-safety checklist against processBlock to identify risky calls, then move them to prepareToPlay or use lock-free atomics for safe parameter updates.

Can I use modern C++ patterns safely in JUCE development?

Yes, modern C++ idioms improve JUCE code maintainability when applied correctly. Use move semantics, smart pointers, and template patterns for non-realtime code paths; reserve lock-free atomics and pre-allocated containers for audio-thread operations to maintain realtime safety.

What are common JUCE memory management mistakes?

Common errors include allocating or deallocating in processBlock, using standard containers with dynamic growth, and missing ownership semantics across threads. Follow pre-allocation in prepareToPlay and adopt modern C++ lifetime management to prevent leaks and undefined behavior.