Configure commands for repeatable workflows
Commands package repeatable workflows into single invocations. They encapsulate multi-step processes, reduce errors from manual execution, and make complex operations accessible to the entire team.
A well-designed command has clear inputs and outputs, minimal side effects, and verifiable results. When you run a command, you should know exactly what will happen and how to verify that it worked correctly.
Define clear input/output
Commands should document what parameters they accept and what they return. This makes them composable—commands can call other commands when the contracts are clear. Avoid commands with hidden dependencies or unclear effects.
Minimize side effects
The best commands are pure functions: same input always produces same output with no external changes. When side effects are necessary (like file writes or API calls), make them explicit and document the scope of changes.
Validate status after execution
Commands should report success or failure clearly. Don't rely on "no output means success"—explicit status codes and messages make debugging easier. Provide a way to verify the result independently.
Command structure and examples
Commands in QuantenRam follow a consistent structure that makes them predictable and maintainable. Each command has a name, description, parameters, execution logic, and result handling.
// Command configuration example
{
"commands": {
"deploy": {
"description": "Deploy current branch to staging",
"parameters": {
"environment": {
"type": "string",
"required": true,
"enum": ["staging", "production"]
},
"skip_tests": {
"type": "boolean",
"default": false
}
},
"steps": [
"git push origin $(git branch --show-current)",
"run_tests unless skip_tests",
"trigger_deployment_pipeline",
"notify_team"
]
}
}
}
This structure makes commands self-documenting. Anyone can read the configuration and understand what the command does, what it needs, and what actions it performs.
Command composition and chaining
Complex workflows can be built by composing simpler commands. This follows the Unix philosophy of small, focused tools that do one thing well.
// Command composition
{
"commands": {
"pre_commit": {
"description": "Run all pre-commit checks",
"chain": [
{ "command": "lint", "fail_fast": true },
{ "command": "type_check", "fail_fast": true },
{ "command": "test_unit", "fail_fast": false }
]
},
"lint": {
"description": "Run linter on changed files",
"script": "scripts/lint.sh"
},
"type_check": {
"description": "Run type checker",
"script": "mypy src/"
},
"test_unit": {
"description": "Run unit tests",
"script": "pytest tests/unit/"
}
}
}
Chaining allows you to build sophisticated workflows from simple building blocks. The fail_fast parameter controls whether the chain continues after a failure.
Commands are the building blocks of automation. When designed well, they make complex operations routine and error-free. Invest in clear contracts and verifiable results.