Project patterns

From CarlosDanielDev/maestro · View interactive version

Project patterns is an AI agent skill from the GitHub repository CarlosDanielDev/maestro. Maestro project patterns — Rust CLI with ratatui TUI, tokio async, Claude CLI process management, and stream-json parsing.

How to use this skill

Skill file

Maestro Project Patterns

Quick reference for development patterns used in the maestro project.

Technology Stack

Module Structure

src/
├── main.rs              # CLI entry (clap), command dispatch
├── config.rs            # maestro.toml parsing (serde + toml)
├── session/
│   ├── mod.rs
│   ├── types.rs         # Session state machine, StreamEvent enum
│   ├── parser.rs        # Claude stream-json line parser
│   └── manager.rs       # Process spawn, lifecycle, stdin/stdout
├── state/
│   ├── mod.rs
│   ├── types.rs         # MaestroState, file claims
│   └── store.rs         # JSON persistence (atomic write-rename)
└── tui/
    ├── mod.rs           # Terminal setup, async event loop
    ├── app.rs           # App state, session event handling
    └── ui.rs            # ratatui rendering (panels, gauges, logs)

Patterns

State Machine for Sessions

Sessions follow: QUEUED → SPAWNING → RUNNING → COMPLETED/ERRORED/PAUSED/KILLED

Stream-JSON Parsing

Atomic State Persistence

TUI Architecture

Error Handling

Testing

Anti-Patterns to Avoid

Rust Guardrails

Canonical policy: docs/RUST-GUARDRAILS.md — the single source of truth for Rust coding policy in maestro. Consult this doc before proposing new modules, introducing new dependencies, or reviewing PRs that touch error handling, async, unsafe, serialization, or observability.

Quick-reference: the 8 principles (safe-by-default, errors-are-values, async hygiene, ownership-over-aliasing, tests-as-specification, supply-chain caution, readability-is-a-feature, observability).

Detailed sidecar: rust-guardrails.md in this skill directory — distilled rules with pattern exemplars (file paths and line numbers) from the maestro codebase. Read when you need a shorter answer than the full doc.

Enforced by:

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.