Solution Scaffolding Tutorial#

This tutorial covers using scafctl new solution to quickly scaffold new solution files with the correct structure, providers, and best practices.

Overview#

The new solution command generates a complete, valid solution YAML file based on your inputs. Instead of writing YAML from scratch (and getting field names wrong), scaffolding gives you a working starting point.

flowchart LR
  A["Parameters<br/>(name, etc)"] --> B["scafctl<br/>new solution"] --> C["Solution<br/>YAML File"]

1. Quick Start#

Generate a Basic Solution#

scafctl new solution \
  --name my-app \
  --description "My application configuration" \
  --output my-app.yaml
scafctl new solution `
  --name my-app `
  --description "My application configuration" `
  --output my-app.yaml

This generates a valid solution file with:

  • Correct apiVersion and kind
  • Metadata with name, version, and description
  • A sample resolver using the static provider
  • An example workflow action

Verify the Output#

Immediately validate the generated file:

scafctl lint -f my-app.yaml
scafctl lint -f my-app.yaml

Run it:

scafctl run solution -f my-app.yaml
scafctl run solution -f my-app.yaml

2. Choosing Providers#

Specify which providers to include in the scaffolded solution:

# Include specific providers
scafctl new solution \
  --name api-collector \
  --description "Collect data from APIs" \
  --providers http,cel,exec \
  --output api-collector.yaml
# Include specific providers
scafctl new solution `
  --name api-collector `
  --description "Collect data from APIs" `
  --providers http,cel,exec `
  --output api-collector.yaml

The generator creates resolver examples using each specified provider with correct input schemas.

Available Providers#

Not sure which providers to use? List them first:

scafctl get provider
scafctl get provider

Or get details on a specific provider:

scafctl get provider http
scafctl get provider http

3. Starting from Examples#

Instead of scaffolding from scratch, you can also start from an existing example:

# Browse available solution examples
scafctl examples list --category solutions

# Download one as a starting point
scafctl examples get solutions/email-notifier/solution.yaml -o my-solution.yaml

# Modify and validate
scafctl lint -f my-solution.yaml
scafctl examples list --category solutions
scafctl examples get solutions/email-notifier/solution.yaml -o my-solution.yaml
scafctl lint -f my-solution.yaml

This is useful when you want a more complete starting point with real patterns (parameters, validation, actions, composition).

4. Common Scaffolding Patterns#

Resolver-Only Solution#

For solutions that just gather and transform data without side-effect actions:

scafctl new solution \
  --name data-collector \
  --description "Gather configuration from multiple sources" \
  --providers static,env,http,cel \
  --output data-collector.yaml
scafctl new solution `
  --name data-collector `
  --description "Gather configuration from multiple sources" `
  --providers static,env,http,cel `
  --output data-collector.yaml

Then run with the resolver command:

scafctl run resolver -f data-collector.yaml -o yaml
scafctl run resolver -f data-collector.yaml -o yaml

Full Workflow Solution#

For solutions with actions:

scafctl new solution \
  --name deploy-pipeline \
  --description "Deployment automation pipeline" \
  --providers static,exec,cel \
  --output deploy-pipeline.yaml
scafctl new solution `
  --name deploy-pipeline `
  --description "Deployment automation pipeline" `
  --providers static,exec,cel `
  --output deploy-pipeline.yaml

Adding Tests After Scaffolding#

Once your solution works, add functional tests:

# Validate the solution
scafctl lint -f my-solution.yaml

# Use the MCP server to generate test scaffolding (if using AI tools)
# Or see the Functional Testing Tutorial for manual test writing
scafctl lint -f my-solution.yaml

5. Workflow#

The recommended scaffolding workflow:

  1. Scaffoldscafctl new solution --name my-app --output my-app.yaml
  2. Lintscafctl lint -f my-app.yaml
  3. Edit — Modify resolvers and actions for your needs
  4. Lint againscafctl lint -f my-app.yaml
  5. Testscafctl run resolver -f my-app.yaml to verify resolvers
  6. Runscafctl run solution -f my-app.yaml for the full workflow

Next Steps#