.agents/skills/schema-coverage/SKILL.md
Analyzes a Terraform resource schema and compares it to attributes used in the acceptance test suite (configs + assertions). Produces a prioritized report of missing and poor coverage (set-only assertions, single-value coverage, missing unset/empty cases, missing update coverage). Use when the user asks about schema coverage, test coverage gaps, or improving Terraform acceptance tests for a resource.
npx skillsauth add elastic/terraform-provider-elasticstack schema-coverageInstall 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.
Given a Terraform resource, compare its schema attributes/blocks to what the acceptance tests configure and assert, then highlight opportunities to improve coverage.
Report findings in this order:
elasticstack_elasticsearch_security_api_key)*_acc_test.goIf the user has an acceptance test open, infer the resource under test from:
resource.Test(...) names like resourceName := "elasticstack_..."resource.ParallelTest(...) steps referencing a single resourcetestAcc...Resource...Find the resource schema definition and capture all schema keys:
Schema: map[string]*schema.Schema{ ... }Elem: &schema.Resource{ Schema: ... }For each attribute/block, record:
foo, nested block.0.bar, etc.)Required/Optional/Computed, ForceNew, type (TypeString, TypeList, etc.), MaxItems/MinItemsScan the acceptance tests for two independent signals:
TestCheckResourceAttr)TestCheckResourceAttrSet)TestCheckNoResourceAttr)Also detect update coverage by identifying multiple resource.TestStep{ Config: ... } steps for the same resource and whether attribute values change between steps.
For each schema attribute path, compute:
name="a" vs name="b")Use the template below.
## Schema coverage report: <resource>
### Scope
- **Schema**: <file(s) or function(s)>
- **Acceptance tests**: <test file(s)>
### 1) Attributes with no coverage
These schema attributes/blocks are not referenced in acceptance tests (neither configured nor asserted):
- `<attr_path>`: <Required/Optional/Computed>, <type>. **Gap**: not configured, not asserted.
### 2) Attributes with poor coverage
These attributes appear in tests but the coverage is weak:
- `<attr_path>`: <schema flags/type>
- **Observed**: <how it’s currently used (configured/asserted), example values>
- **Gaps**:
- <one or more of: set-only assertion, single value only, no unset coverage, no empty collection coverage, no update coverage>
- **Suggested improvements**:
- <concrete test step or assertion to add>
### Suggested next steps (smallest diffs first)
1. Add value-specific assertions for set-only checks
2. Add an “unset optional” step + `TestCheckNoResourceAttr`
3. Add an “empty collection” step + collection assertions
4. Add an “update” step changing the attribute + post-update assertions
block.0.attr indexing; normalize consistently when matching to schema blocks.tools
Guides migration of Terraform resources from Plugin SDK to Plugin Framework. Use when migrating SDK resources to PF, planning SDK-to-PF migrations, or when the user asks to migrate a resource to the Plugin Framework.
testing
Analyzes an OpenSpec requirements spec for internal consistency, implementation compliance, and test opportunities; when a shell is available, run openspec validate first for structural checks. Use when reviewing specs, verifying implementation against requirements, or identifying test gaps.
testing
Verify implementation matches change artifacts. Use when the user wants to validate that implementation is complete, correct, and coherent before archiving.
data-ai
Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.