Skip to main content
Production-ready patterns and quality standards for expert Maestro users.

Code Quality Standards

Pre-PR Quality Checklist

Before creating pull requests, complete these universal requirements:

Always Required (WIP or Production)

Code cleanup:
  • Remove throwaway debugging code (temporary print/console.log)
  • Delete commented-out code blocks
  • Remove experimental/test code not meant for commit
  • Clean up unused imports, variables, functions
Note: Structured logging (debug, info, warn, error levels) is professional practice, not cruft. Only remove temporary debugging statements. Documentation:
  • Update README if structure or usage changed
  • Document WIP status clearly if submitting work-in-progress
  • Add comments for non-obvious logic
  • Update relevant docs for completed portions

For Production-Ready PRs (Additionally)

  • Full test suite passes (no failures tolerated)
  • No critical TODO/FIXME unresolved
  • No placeholder implementations
  • Dependencies documented
  • No hardcoded values needing configuration
  • Code coverage meets project standards (typically >80%)

Prohibited in ALL PRs

  • Throwaway debugging code
  • Dead code accumulation
  • Undocumented WIP state
  • Commented-out code blocks
  • Skipped or disabled tests

Testing Standards

Minimum requirements:
Coverage targets:
  • Critical code: 100% coverage
  • Business logic: >90% coverage
  • Overall project: >80% coverage
Test quality:
  • Tests are deterministic (no flaky tests)
  • Tests are independent (order doesn’t matter)
  • Tests are fast (quick feedback loops)
  • Tests are clear (obvious what they validate)

Code Review Standards

Before requesting review:
  1. Self-review all changes
  2. Run full test suite
  3. Check code coverage
  4. Verify documentation updated
  5. Ensure clean commit history
  6. Test manually if UI/UX involved
Review criteria:
  • Code correctness
  • Test coverage
  • Performance implications
  • Security considerations
  • Maintainability
  • Documentation quality

Validation Methodology

Empirical Validation Required

Never assume code works without running it: Wrong:
Right:

Running Full Test Suites

Always run complete test suite, not targeted tests: Insufficient:
Required:
Exception: Skip only if no test infrastructure exists AND you haven’t requested tests. Reason: Partial testing misses regressions in seemingly unrelated code.

Benchmark-Driven Development

For performance-critical features:
  1. Establish baseline:
  2. Implement changes
  3. Measure improvement:
Standard: Optimization without measurement is speculation.

Session Management Best Practices

Capacity Management

Proactive approach:
Reactive approach (only when warned):

File Management

Iteration discipline:
Selective viewing:

Memory Management

What to keep:
  • Architectural decisions and rationale
  • Specifications and requirements
  • Validation results and benchmarks
  • Key lessons and insights
What to forget/compact:
  • Failed approaches (after learning from them)
  • Debugging iterations (after fix implemented)
  • Exploratory analysis (after conclusion)
  • Redundant explanations
Timing:

Collaboration Patterns

Code Review Workflow

Reviewing Maestro’s PRs:
Reviewing teammate’s code with Maestro:

Team Workflows

Feature ownership:
Handoff protocol:

Security Best Practices

Input Validation

Ensure Maestro implements:

Dependency Management

Audit dependencies:
Update regularly:

Secret Management

Never commit secrets:
Use environment variables:

Performance Best Practices

Optimization Workflow

Systematic approach:
Optimization priorities:

Database Performance

Query optimization:
Connection pooling:

Caching Strategies

Layered caching:

Documentation Best Practices

Code Documentation

Inline comments:
API documentation:
README requirements:

Architectural Documentation

For complex systems:

Reliability and Robustness

Error Handling

Comprehensive error handling:

Graceful Degradation

Design for partial failure:
Circuit breaker pattern:

Monitoring and Observability

Instrumentation:

Production Deployment

Pre-Deployment Checklist

Deployment Validation

Staged deployment:
Rollback preparedness:

Anti-Patterns to Avoid

Development Anti-Patterns

Testing after implementation
Assuming tests are always correct
Skipping validation “to save time”
Accepting claims without evidence
Overcomplicating simple tasks

Session Management Anti-Patterns

Monster sessions
Ignoring capacity warnings
Not using checkpoints

Communication Anti-Patterns

Vague requirements
Assuming Maestro remembers everything
Not correcting misunderstandings

Expert Workflows

Rapid Prototyping to Production

Day 1: Prototype
Day 2-3: Production Implementation
Why separate: Different quality bars; faster initial validation.

Research → Specification → Implementation

Pattern for complex features: Session 1: Research (1-2 hours)
Session 2: Specification (2-4 hours)
Session 3+: Implementation (4-16 hours)
Advantage: Clear milestones, better quality, easier to validate.

Continuous Validation Workflow

Integrate validation throughout:

Quality Gates

Gate 1: Compilation/Syntax

Must pass:
  • Code compiles without errors
  • No syntax errors
  • Import/dependency resolution works
  • Type checking passes (if applicable)
Zero tolerance: Compilation errors must be fixed immediately.

Gate 2: Unit Tests

Must pass:
  • All unit tests pass
  • No skipped tests (unless explicitly marked)
  • Coverage meets minimum threshold
  • No flaky tests
Failure response: Fix implementation or fix tests, but all must pass.

Gate 3: Integration Tests

Must pass:
  • Component interactions work correctly
  • External service integrations function
  • End-to-end flows complete successfully
  • Error scenarios handled

Gate 4: Performance

Must meet:
  • Latency targets
  • Throughput requirements
  • Resource usage within bounds
  • No performance regressions from baseline
Evidence required: Benchmark results comparing to targets and baselines.

Gate 5: Security

Must verify:
  • Input validation present
  • SQL injection prevented
  • XSS prevented (web apps)
  • Authentication/authorization correct
  • Secrets not in code
  • Dependencies without known vulnerabilities
Tools: Security scanners, static analysis, manual review.

Gate 6: Documentation

Must include:
  • Updated README
  • API documentation
  • Code comments where needed
  • Architecture diagrams (if structure changed)
  • Deployment notes
Quality check: Someone unfamiliar could understand and use the code.

Production Readiness Criteria

Definition of Done

Feature is done when:
  • All quality gates passed
  • Stakeholder acceptance criteria met
  • Documentation complete
  • Deployable to production
  • Rollback plan documented
  • Monitoring configured
Not done if:
  • Tests failing
  • Performance below targets
  • Security concerns unresolved
  • Documentation missing or inaccurate
  • Dependencies unlocked or vulnerable

Release Checklist

Continuous Improvement

Learning from Sessions

Post-session retrospective:

Building Session Templates

Create reusable patterns: API Implementation Template:
Performance Optimization Template:
Custom templates for your domain:

Advanced Quality Patterns

Mutation Testing

Beyond standard coverage:

Property-Based Testing

For algorithms and data structures:

Chaos Engineering

For distributed systems:

Measuring Success

Session-Level Metrics

Track for each session:
  • Time to completion
  • Quality of output (test coverage, performance)
  • Iterations needed
  • Issue detection rate
  • User satisfaction with outcome
Improving metrics:
  • Better requirements → fewer iterations
  • Proactive validation → earlier issue detection
  • Clear communication → faster completion

Project-Level Metrics

Track across projects:
  • Features delivered per month
  • Time savings vs traditional development
  • Bug rate in production
  • Performance vs requirements
  • Code quality metrics
Continuous improvement:
  • Identify patterns in successful sessions
  • Learn from problematic sessions
  • Refine communication and requirements
  • Build better templates and workflows

Next Steps

Apply these best practices: With best practices mastered, you’re ready for expert-level Maestro usage.