schema-coverage
Skill210 starsChanged 6 months agoApache-2.0View on GitHub
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.
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
If the user has an acceptance test open, infer the resource under test from:
- Distinctive: line 62
set-only: only checks “is set” (weaker)
- Distinctive: line 71
Use the template below.
- Distinctive: line 104
Prefer value-specific assertions over “is set”.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Schema Coverage (Terraform resource vs acceptance tests)
Goal
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:
- Attributes with no coverage
- Attributes with poor coverage
Inputs (infer if not provided)
- Resource name (e.g.
elasticstack_elasticsearch_security_api_key) - Or the schema file / acceptance test file path
- Or the Go package directory containing the resource and
*_acc_test.go
If the user has an acceptance test open, infer the resource under test from:
resource.Test(...)names likeresourceName := "elasticstack_..."resource.ParallelTest(...)steps referencing a single resource- config builder function names like
testAcc...Resource...
Workflow
1) Locate and parse the schema
Find the resource schema definition and capture all schema keys:
- Top-level attributes in
Schema: map[string]*schema.Schema{ ... } - Nested block schemas in:
Elem: &schema.Resource{ Schema: ... }- lists/sets/maps of resources and objects
- nested blocks referenced via helpers
For each attribute/block, record:
- Path: terraform attribute path (top-level
foo, nestedblock.0.bar, etc.) - Schema metadata:
Required/Optional/Computed,ForceNew, type (TypeString,TypeList, etc.),MaxItems/MinItems
2) Locate acceptance tests and collect attribute usage
Scan the acceptance tests for two independent signals:
- Configured attributes: attributes explicitly set in HCL test configs (including nested blocks).
- Asserted attributes: attributes referenced in checks, including:
- value assertions (e.g.
TestCheckResourceAttr) - set-only assertions (e.g.
TestCheckResourceAttrSet) - absence assertions (e.g.
TestCheckNoResourceAttr) - collection assertions (e.g. type-set element checks, list length checks)
- value assertions (e.g.
Also detect update coverage by identifying multiple resource.TestStep{ Config: ... } steps for the same resource and whether attribute values change between steps.
3) Build a coverage matrix
For each schema attribute path, compute:
- Configured? (ever set in any test config)
- Asserted? (ever referenced by any check)
- Assertion quality:
- value-specific: asserts the exact value (preferred)
- set-only: only checks “is set” (weaker)
- absence: checks unset / removed (good for optional fields)
- Value diversity: count distinct values across steps/configs (e.g.
name="a"vsname="b") - Optional-unset coverage: optional field has a test step where it is deliberately omitted, plus an assertion that it is absent (or defaults appropriately)
- Empty-collection coverage: collection has a step where it is empty (or omitted if optional), plus assertions validating the empty state
- Update coverage: attribute value changes across steps, and a post-update assertion verifies the new value
4) Produce the report (strict ordering)
Use the template below.
Report template
## 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 assertionsRules of thumb (for prioritization)
- Prefer value-specific assertions over “is set”.
- For Optional attributes, include at least one step where the attribute is omitted, and assert absence/default behavior.
- For collections (list/set/map), add a case for empty (or omitted if optional), and assert the expected empty state.
- For Update behavior, ensure there is at least one multi-step test where the attribute changes and the test asserts the new state.
- For Computed-only attributes, it’s acceptable to use set-only assertions when exact values are not deterministic, but prefer deterministic assertions when possible.
Notes / limitations
- Some schemas are built via helpers; follow helper references until all attribute keys are accounted for.
- Attribute paths in checks often use
block.0.attrindexing; normalize consistently when matching to schema blocks. - Don’t mark an attribute as “covered” solely because it appears in raw HCL—prefer it being asserted. Treat “configured but never asserted” as poor coverage, not good coverage.
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- elastic/terraform-provider-ec★ 183same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- existing-entity-requirementsSkill
- flaky-test-catcherSkill
- new-entity-requirementsSkill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-continue-changeSkill
- openspec-exploreSkill
- openspec-implementation-loopSkill
- openspec-new-changeSkill
- openspec-plus-applySkill
- openspec-plus-designSkill
- openspec-plus-proposalSkill
- openspec-plus-specSkill
- openspec-plus-tasksSkill
- openspec-plus-tddSkill
- openspec-proposeSkill
- openspec-sync-specsSkill
- openspec-verify-changeSkill
- pr-monitoring-loopSkill
- requirements-verificationSkill
- agentic-workflowsSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

