Agent skill
write-canary-tests
Write correct test blocks and assertions for Mission Control canary health checks. Use when creating canaries that need pass/fail conditions, adding test expressions, or writing assertions based on HTTP status, JSON response, exec output, or Kubernetes health.
Install this agent skill to your Project
npx add-skill https://github.com/flanksource/claude-code-plugin/tree/main/skills/write-canary-tests
SKILL.md
Write Canary Tests
Goal
Write correct test blocks for canary checks.
Golden Rules
- The test result must be boolean (
true/false). - Use null-safe access for optional fields (
.?+orValue(...)). - Tests add assertions; they do not bypass built-in check failures.
Test Fields
| Field | Description | Example |
|---|---|---|
expr |
CEL expression that evaluates to boolean | code == 200 && json.status == 'ok' |
javascript |
JavaScript expression/script returning true / false |
code === 200 |
template |
Go template rendering true / false |
{{ eq .code 200 }} |
Common Test Context
Exact fields vary by check type.
| Variable | Description | Example |
|---|---|---|
results |
Primary result payload for many check types | size(results) > 0 |
code |
HTTP status code (HTTP checks) | code in [200, 201, 301] |
json |
Parsed JSON response body (HTTP checks) | json.headers['User-Agent'] != '' |
headers |
HTTP response headers | 'Content-Type' in headers.keys() |
sslAge |
SSL validity duration (HTTP TLS checks) | sslAge > Duration('7d') |
outputs.<checkName> |
Previous named check outputs (with dependsOn) |
outputs.getUuid.json.uuid != '' |
check |
Current check metadata | check.name != '' |
canary |
Current canary metadata | canary.namespace == 'prod' |
Canonical Snippets
1) HTTP status + JSON assertion
test:
expr: "code == 200 && json.uuid != ''"
2) HTTP header assertion
test:
expr: "! ('Authorization' in headers.keys())"
3) Exec stdout assertion
test:
expr: 'results.stdout == "hello"'
4) Kubernetes health assertion
test:
expr: dyn(results).all(x, k8s.isHealthy(x))
5) JUnit summary assertion
test:
expr: results.failed == 0 && results.passed > 0
6) dependsOn output assertion
test:
expr: "code == 200 && outputs.getUuid.json.uuid != ''"
7) Nil-safe list check
test:
expr: results.?files.orValue([]).size() > 0
References
- Canary Checker spec reference: https://flanksource.com/docs/reference/canary-checker/llms.txt
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
write-canary-transformations
Write correct transform blocks for Mission Control canary checks including fan-out, inline, and generated canary patterns. Use when adding transformations to canary checks, splitting a single check into multiple results, modifying check output, or generating child canaries from discovered resources.
troubleshooting-health-checks
Debugs and troubleshoots Mission Control health checks by analyzing check configurations, reviewing failure patterns, and identifying root causes. Use when users ask about failing health checks, mention specific health check names or IDs, inquire why a health check is failing or unhealthy, or need help understanding health check errors and timeouts.
troubleshooting-notifications
Investigates Mission Control notifications to identify root causes and provide remediation. Use when users mention notification IDs, ask about alerts or notifications, request help understanding "why did I get this notification", want to troubleshoot a specific alert, or ask about notification patterns and history. This skill retrieves notification details, analyzes historical patterns, routes to resource-specific troubleshooting (config items or health checks), correlates findings, and delivers actionable remediation steps with prevention recommendations.
troubleshooting-config-item
Troubleshoots infrastructure and application configuration items in Mission Control by diagnosing health issues, analyzing recent changes, and investigating resource relationships. Use when users ask about unhealthy or failing resources, mention specific config items by name or ID, inquire about Kubernetes pods/deployments/services, AWS EC2 instances/volumes, Azure VMs, or other infrastructure components. Also use when investigating why a resource is down, stopped, degraded, or showing errors, or when analyzing what changed that caused an issue.
promotion-eval-create
Create a promotion evaluation template for any system by gathering requirements through structured questions and generating a reusable evaluation skill. Use when users ask to create a promotion check, release readiness evaluation, environment health template, or want to build a custom evaluation workflow for systems beyond Mission Control.
promotion-eval-mission-control
Evaluates a Mission Control environment's platform health for release or promotion readiness. Checks health check pipelines, config scrapers, background jobs, notifications, event queues, and MC infrastructure. Use for pre-release checks, environment promotion, or environment status. Triggers: "check environment health", "is it ready for release", "pre-release health check", "evaluate environment", "promotion readiness", "environment status"
Didn't find tool you were looking for?