Skip to content

Complete Example

Complete Example

Here's a complete workflow demonstrating Prodigy's core features in a single file. This example combines environment configuration, workflow commands, and custom merge behavior.

Source: Based on workflows/implement.yml

# Environment configuration
env:
  RUST_BACKTRACE: 1              # Standard environment variable

env_files:
  - .env                         # Load variables from .env file (dotenv format)

profiles:
  ci:                            # Activate with: prodigy run workflow.yml --profile ci
    CI: "true"
    VERBOSE: "true"

# Workflow commands
commands:
  - shell: "cargo fmt --check"
  - shell: "cargo clippy -- -D warnings"
  - shell: "cargo test --all"
  - claude: "/prodigy-lint"

# Custom merge workflow (simplified format)
merge:
  - shell: "cargo test"          # Validate before merging
  - claude: "/prodigy-merge-worktree ${merge.source_branch} ${merge.target_branch}"

Key Features Demonstrated

  1. Environment Variables (lines 2-4): Define variables available to all commands
  2. See Environment Variables for details

  3. Environment Files (lines 6-7): Load variables from .env files in dotenv format

  4. See Environment Files for syntax

  5. Profiles (lines 9-12): Define environment sets activated via --profile flag

  6. Example: prodigy run workflow.yml --profile ci
  7. See Environment Profiles for advanced usage

  8. Workflow Commands (lines 15-19): Execute shell and Claude commands sequentially

  9. See Command Types for all command types

  10. Custom Merge Workflow (lines 22-24): Customize the merge-back process

  11. Important: Always include both ${merge.source_branch} and ${merge.target_branch} parameters
  12. The simplified array format is shown here (supported by MergeWorkflow)
  13. See next section for the full configuration format

Alternative Merge Format (with timeout)

The merge block also supports a configuration format with timeout:

merge:
  commands:
    - shell: "cargo test"
    - claude: "/prodigy-merge-worktree ${merge.source_branch} ${merge.target_branch}"
  timeout: 600                   # Optional: timeout in seconds (10 minutes)

Source: src/config/mapreduce.rs:86-124

Real-World Example

For a production-grade workflow with validation and error handling, see the implementation workflow:

File: workflows/implement.yml (lines 32-41)

merge:
  # Step 1: Merge master into worktree
  - claude: "/prodigy-merge-master"

  # Step 2: Run CI checks and fix any issues
  - claude: "/prodigy-ci"

  # Step 3: Merge worktree back to original branch
  - claude: "/prodigy-merge-worktree ${merge.source_branch} ${merge.target_branch}"

This demonstrates best practices: - Sync with upstream before merging back - Validate changes with CI checks - Use proper merge parameters

Next Steps