.github/skills/test-failure-diagnosis/SKILL.md
Analyze test failure output to identify root cause and suggest fixes. Use when build or test failures occur. Triggers on: test failures, build errors, CI failures.
npx skillsauth add aztfmod/terraform-provider-azurecaf test-failure-diagnosisInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Read the failure output and classify:
| Failure type | Indicators | Common cause |
|-------------|------------|--------------|
| Compilation error | cannot compile, undefined:, syntax error | Bad JSON in resourceDefinition.json, invalid Go syntax |
| JSON parse error | json: cannot unmarshal, unexpected end of JSON | Missing comma, unmatched quotes, bad escapes in resourceDefinition.json |
| Duplicate slug | duplicate key, ambiguity errors | Two resources share the same slug |
| Test assertion failure | FAIL, expected X got Y | Naming logic bug, regex mismatch |
| Regex error | error parsing regexp | Invalid regex pattern in validation_regex or regex field |
| Import error | cannot find package, module not found | Missing dependency, go.mod issue |
From the output, extract:
Test* function(s) that failedBased on the classification, check the most likely source:
For JSON errors:
python3 -c "import json; json.load(open('resourceDefinition.json'))"
For duplicate slugs:
grep '"slug":' resourceDefinition.json | sort | uniq -d
For regex issues:
grep -n 'validation_regex\|"regex"' resourceDefinition.json | grep -v '"\"'
Provide a specific, actionable fix:
After applying the suggested fix, re-run the failed test:
go test ./azurecaf/ -run "<failed_test_name>" -v
development
Validate a resource definition end-to-end using terraform test with mock_provider azurerm. Proves the CAF-generated name is accepted by the azurerm provider schema without Azure credentials. Use after provider-build-test succeeds to run the mocked azurerm integration test.
documentation
Analyze changes since the last release tag and determine the appropriate semantic version bump (patch/minor/major) based on CHANGELOG entries and commit types. Triggers on: release preparation, version planning.
testing
Compare two versions of resourceDefinition.json (e.g., branch vs main) and produce a structured change summary. Triggers on: PR review, audit, before/after comparison.
development
Manage resource entries in resourceDefinition.json for the terraform-provider-azurecaf naming provider. Use for lookup, comparison, formatting, and insert/update of resource naming definitions. Triggers on: resourceDefinition.json edits, resource definition lookup, JSON entry formatting, resource comparison.