Claude Code Setup for Pipecat
This directory contains configuration and custom skills for working with the Pipecat project using Claude Code.
Project Overview
Pipecat is an open-source Python framework for building real-time voice and multimodal conversational agents. It provides a composable, frame-based architecture for orchestrating audio, video, AI services, and conversation pipelines.
Architecture
Core Concepts
-
Frames - The fundamental data units in Pipecat (audio, text, images, system messages, etc.)
- Located in:
src/pipecat/frames/frames.py - Different frame types for different data:
AudioRawFrame,TextFrame,ImageRawFrame, etc.
- Located in:
-
Processors - Processing units that receive, transform, and emit frames
- Base class:
src/pipecat/processors/frame_processor.py - Can be chained to form pipelines
- Examples: STT services, LLMs, TTS services, aggregators, etc.
- Base class:
-
Pipelines - Chains of processors that define data flow
- Created using the
Pipelineclass - Processors linked using
link()method or|operator
- Created using the
-
Transports - Handle input/output for audio/video streams
- WebRTC (Daily), WebSocket, Local audio, etc.
- Located in:
src/pipecat/transports/
Key Directories
src/pipecat/- Main source codeframes/- Frame definitions and utilitiesprocessors/- Base processors and common processorsservices/- AI service integrations (STT, TTS, LLM, etc.)transports/- Transport implementationsaudio/- Audio processing utilities
examples/- Example applications and foundational examplestests/- Test suitedocs/- Documentation source
Development Workflow
Setup
# Install dependencies
uv sync --group dev --all-extras --no-extra gstreamer --no-extra krisp --no-extra local
# Install pre-commit hooks
uv run pre-commit install
Running Tests
# All tests
uv run pytest
# Specific test file
uv run pytest tests/test_name.py
# With coverage
uv run coverage run --module pytest
uv run coverage report
Code Quality
# Format code
uv run ruff format .
# Lint code
uv run ruff check .
# Fix linting issues
uv run ruff check --fix .
# Type checking
uv run pyright
# Run all pre-commit hooks
uv run pre-commit run --all-files
Building
# Build package
uv build
Custom Skills
This project includes custom Claude Code skills:
/docstring
Document Python modules and classes using Google-style docstrings.
Usage: /docstring ClassName
/changelog
Generate changelog entries using towncrier.
/pr-description
Generate comprehensive PR descriptions based on changes.
Coding Standards
-
Docstrings - Use Google-style docstrings for all public APIs
- Module docstrings required
- Class docstrings with purpose and event handlers
- Method docstrings with Args/Returns/Raises
- Constructor (
__init__) must document all parameters
-
Type Hints - Required for all function signatures
- Use
from typing import ...for complex types - Dataclasses should have field type annotations
- Use
-
Async/Await - Consistent use of async patterns
- Most processors use async methods
- Tests use pytest-asyncio
-
Code Style
- Line length: 100 characters max
- Ruff for linting and formatting
- Follow existing patterns in the codebase
-
Testing
- Write tests for new features
- Use pytest fixtures for common setups
- Mock external services when appropriate
Contributing
- Fork the repository
- Create a feature branch
- Make changes following coding standards
- Add tests for new functionality
- Run pre-commit hooks:
uv run pre-commit run --all-files - Submit a pull request
Common Tasks
Adding a New Service Integration
- Create service file in
src/pipecat/services/<category>/ - Inherit from appropriate base class (e.g.,
TTSService,LLMService) - Implement required abstract methods
- Add service to
pyproject.tomloptional dependencies - Add documentation
- Add tests in
tests/
Adding a New Processor
- Create processor in
src/pipecat/processors/ - Inherit from
FrameProcessoror appropriate subclass - Override
process_frame()method - Handle relevant frame types
- Emit frames using
await self.push_frame() - Add tests
Adding a New Frame Type
- Add frame definition to
src/pipecat/frames/frames.py - Inherit from appropriate base frame class
- Use
@dataclassdecorator for data frames - Document the frame type and its fields
- Update processors that should handle this frame type