Command Execution Protocol

CRITICAL: Task-First Development

Before executing ANY command, you MUST check if a task exists for it.

Pre-Command Checklist

Before running any command:

  1. STOP: Is there a task for this operation?
  2. CHECK: Review available tasks with task --list or check taskfile.md
  3. USE: Use the task if it exists
  4. ASK: If no task exists and the command will be run multiple times, ask if a task should be created

Common Command Mappings

❌ NEVER run these raw commands:

Raw Command✅ Use This Task Instead
kubectl apply -k path/task infra:apply or similar
kubectl delete namespace Xtask infra:delete or similar
kubectl logs -f deployment/Xtask infra:logs or similar
docker build -t image .task infra:build or similar
pytest or python -m pytesttask test or task metrics:test
python script.pytask <component>:<action>
npm test or npm run Xtask <component>:test or similar

Red Flags - Stop and Check for Tasks

If you’re about to type any of these, STOP and check for a task:

  • kubectl (any subcommand)
  • docker (build, run, push, etc.)
  • pytest or python -m pytest
  • python -m (any module)
  • npm run or yarn
  • Any command with multiple flags or arguments
  • Any command you’ve run before in this session

When Raw Commands Are Acceptable

Raw commands are ONLY acceptable when:

  1. One-time exploration: kubectl get pods to check status
  2. Debugging: Quick inspection commands that won’t be repeated
  3. No task exists: AND it’s truly a one-off operation

When to Create New Tasks

Create a new task if:

  • You run the same command twice
  • The command has multiple flags or steps
  • The command is part of a workflow
  • Others might need to run this command

Task Discovery Process

  1. Run task --list to see all available tasks
  2. Check .kiro/steering/taskfile.md for task descriptions
  3. Look for patterns: task <component>:<action>
  4. Common patterns:
    • task <component>:test - Run tests
    • task <component>:build - Build artifacts
    • task <component>:dev - Start development server
    • task infra:apply - Apply infrastructure changes
    • task infra:status - Check status
    • task infra:logs - View logs

Examples of Correct Behavior

❌ Wrong:

# Running raw commands
kubectl apply -k infra/kustomize/
docker build -t metrics-service .
python -m pytest tests/

✅ Correct:

# Check for tasks first
task --list | grep infra
task infra:apply
task infra:build
task metrics:test

Enforcement

This is a CRITICAL rule. Violating it wastes time and creates inconsistency. Always use tasks when they exist.