Agent skill
tdd:hypershift
TDD workflow with HyperShift cluster - real-time debugging with full cluster access
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/tdd-hypershift
SKILL.md
TDD-HyperShift Workflow
Test-driven development workflow using hypershift-full-test.sh phases for Kagenti development.
Why TDD-HyperShift?
Full cluster access enables real-time debugging that CI cannot provide:
| Advantage | How |
|---|---|
| Inspect pod state | k8s:pods, k8s:logs, k8s:health |
| Live debugging | k8s:live-debugging |
| Immediate feedback | Run tests, check logs, fix, repeat |
| Access secrets/configs | kubectl get secret/configmap |
Use tdd:ci when you don't have a cluster or for final CI validation.
Cluster Availability
Before starting, check for an existing HyperShift cluster:
ls ~/clusters/hcp/kagenti-hypershift-custom-*/auth/kubeconfig 2>/dev/null
If no cluster exists, ask the user:
No HyperShift cluster found. Create one for debugging?
- Cluster creation takes ~15-20 minutes and requires approval
- Use
hypershift:clusterto create- Alternatively, use
tdd:ciortdd:kindwhich don't need a cluster
If approved, create with (requires user approval):
./.github/scripts/hypershift/create-cluster.sh <suffix>
Auto-approved: All operations on hosted clusters (read + write) are auto-approved. Cluster create/destroy targets the management cluster and requires user approval.
flowchart TD
START(["/tdd:hypershift"]) --> CLUSTER{"Cluster available?"}
CLUSTER -->|Yes| SETENV["Set KUBECONFIG + env vars"]:::k8s
CLUSTER -->|No| ASK{"Create cluster?"}
ASK -->|Yes| CREATECLUSTER["hypershift:cluster create"]:::hypershift
ASK -->|No| FALLBACK([Use tdd:ci or tdd:kind])
CREATECLUSTER --> SETENV
SETENV --> ITER{"Iteration level?"}
ITER -->|Level 0| L0["Quick patch (seconds)"]:::test
ITER -->|Level 1| L1["Test only"]:::test
ITER -->|Level 2| L2["Rebuild images"]:::test
ITER -->|Level 3| L3["Full reinstall (~25 min)"]:::test
ITER -->|Level 4| L4["Fresh cluster"]:::hypershift
L0 --> TEST["Run tests"]:::test
L1 --> TEST
L2 --> TEST
L3 --> TEST
L4 --> SETENV
TEST --> RESULT{"Tests pass?"}
RESULT -->|Yes| BRANCHCHECK{"Branch verified?"}
RESULT -->|No| DEBUG["Debug with k8s:pods, k8s:logs"]:::k8s
DEBUG --> FIX["Fix code"]:::tdd
FIX --> ITER
BRANCHCHECK -->|Yes| COMMIT["git:commit"]:::git
BRANCHCHECK -->|Wrong branch| WORKTREE["Create worktree"]:::git
WORKTREE --> COMMIT
COMMIT --> CI([Back to tdd:ci for CI validation])
classDef tdd fill:#4CAF50,stroke:#333,color:white
classDef rca fill:#FF5722,stroke:#333,color:white
classDef git fill:#FF9800,stroke:#333,color:white
classDef k8s fill:#00BCD4,stroke:#333,color:white
classDef hypershift fill:#3F51B5,stroke:#333,color:white
classDef ci fill:#2196F3,stroke:#333,color:white
classDef test fill:#9C27B0,stroke:#333,color:white
Follow this diagram as the workflow.
Key Pattern
Always run from main repo, pointing to worktree scripts:
export CLUSTER=mlflow WORKTREE=mlflow-ci MANAGED_BY_TAG=${MANAGED_BY_TAG:-kagenti-hypershift-custom}
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig \
.worktrees/$WORKTREE/.github/scripts/local-setup/hypershift-full-test.sh $CLUSTER \
--include-test [--pytest-filter "filter"]
TDD Iterations (fastest first)
Prefer quick targeted changes over full reinstall. Full reinstall takes ~25 min. Targeted changes take ~30 seconds.
Iteration 0: Quick patch (seconds)
Patch a ConfigMap, restart a pod, or update a deployment directly:
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig kubectl rollout restart deployment/otel-collector -n kagenti-system
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig kubectl rollout restart deployment/mlflow -n kagenti-system
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig kubectl delete pod -n team1 -l app.kubernetes.io/name=weather-service
Iteration 1: Test only (auto-approved)
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig \
.worktrees/$WORKTREE/.github/scripts/local-setup/hypershift-full-test.sh $CLUSTER \
--include-test --pytest-filter "test_agent or test_mlflow"
Iteration 2: Rebuild agent images (minutes)
Use OpenShift Builds or Shipwright to rebuild images from dependency repos directly on the cluster:
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig oc start-build weather-tool -n team1 --follow
Or trigger a Shipwright BuildRun for the weather-service:
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig kubectl create -f .worktrees/$WORKTREE/kagenti/examples/agents/weather_agent_shipwright_buildrun.yaml
After rebuild, delete the pod to pick up the new image:
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig kubectl delete pod -n team1 -l app.kubernetes.io/name=weather-service
Iteration 3: Full reinstall (last resort, ~25 min)
Only when chart values or CRDs change:
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig \
.worktrees/$WORKTREE/.github/scripts/local-setup/hypershift-full-test.sh $CLUSTER \
--include-uninstall --include-install --include-agents --include-test
Iteration 4: Fresh cluster (requires permission)
Only when the cluster itself is broken:
./.github/scripts/hypershift/create-cluster.sh $CLUSTER
Building Custom Images from Dependency Repos
When debugging issues in agent-examples or kagenti-extensions, build custom images directly on the cluster using Shipwright/OpenShift Builds:
# Point build spec to your fork/branch
# Edit the source in weather_agent_shipwright_build_ocp.yaml:
# url: https://github.com/YourFork/agent-examples
# revision: your-branch
# Apply and trigger build
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig kubectl apply -f .worktrees/$WORKTREE/kagenti/examples/agents/weather_agent_shipwright_build_ocp.yaml
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig kubectl create -f .worktrees/$WORKTREE/kagenti/examples/agents/weather_agent_shipwright_buildrun.yaml
Watch the build:
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig kubectl get buildrun -n team1 -w
After build succeeds, restart the deployment:
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig kubectl rollout restart deployment/weather-service -n team1
Observability Tests Need Fresh Traces
Important: Always run agent tests before observability tests to generate fresh traces:
# CORRECT: Run agent + observability together
--pytest-filter "test_agent or test_mlflow"
# WRONG: Observability alone may find stale traces
--pytest-filter "test_mlflow" # May give false positives
Development Loop
export CLUSTER=mlflow WORKTREE=mlflow-ci MANAGED_BY_TAG=${MANAGED_BY_TAG:-kagenti-hypershift-custom}
# 1. Make changes in worktree
vim .worktrees/$WORKTREE/kagenti/tests/e2e/common/test_mlflow_traces.py
# 2. Run specific tests
KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig \
.worktrees/$WORKTREE/.github/scripts/local-setup/hypershift-full-test.sh $CLUSTER \
--include-test --pytest-filter "test_agent or TestRootSpanAttributes"
# 3. Fix issues, repeat step 2
Quick kubectl Commands
export CLUSTER=mlflow MANAGED_BY_TAG=${MANAGED_BY_TAG:-kagenti-hypershift-custom}
export KUBECONFIG=~/clusters/hcp/$MANAGED_BY_TAG-$CLUSTER/auth/kubeconfig
kubectl get pods -n kagenti-system
kubectl logs -n kagenti-system -l app=mlflow --tail=50
kubectl get pods -n team1
Iteration Tracking
Keep a log of test iterations in a TODO file for debugging:
## Iteration Log
| DateTime | Cluster | mlflow-ci Commit | agent-examples Commit | Pass | Fail | Skip | Notes |
|----------|---------|------------------|----------------------|------|------|------|-------|
| 2026-02-05 14:30:15 | mlfl1 | 8dbaee15 | 3524675 | 33 | 2 | 8 | Baseline |
| 2026-02-05 15:45:22 | mlfl1 | abc1234 | def5678 | 35 | 0 | 8 | Fixed X |
Create iteration tracker:
# Add to TODO file after each test run
echo "| $(date '+%Y-%m-%d %H:%M:%S') | $CLUSTER | $(git -C .worktrees/$WORKTREE rev-parse --short HEAD) | $(git -C .worktrees/agent-examples rev-parse --short HEAD) | PASS | FAIL | SKIP | Notes |" >> .worktrees/$WORKTREE/TODO_ITERATION_LOG.md
When Done: Back to CI
Once the issue is fixed with real-time debugging, return to tdd:ci for final CI validation:
- Commit the fix
- Push to PR
- Use
tdd:cito verify CI passes
UI Tests
For Playwright UI tests (login, navigation, agent chat), invoke test:ui.
Set KAGENTI_UI_URL to the OpenShift route and run against the live cluster.
Related Skills
test:ui- Write and run Playwright UI teststdd:ci- CI-driven TDD (escalates here after 3+ failures)local:full-test- Complete testing referencek8s:live-debugging- Debug issues on running clusterk8s:pods- Debug pod issuesk8s:logs- Query component logshypershift:cluster- Create/destroy clusterstest:run-hypershift- Run tests on HyperShifttest:review- Review test qualitygit:commit- Commit format
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?