terraform-cdk-constructs
Copilot instructions20 starsChanged 7 months agoMITView on GitHub
This is @microsoft/terraform-cdk-constructs — a JSII-compatible TypeScript library providing Azure CDK constructs using the AZAPI Terraform provider for direct Azure REST API access. Each *-schemas.ts file follows this exact pattern: When adding a new API version to an existing construct:
The file
We split this copilot-instructions.md into the rules it gives an agent
10 rules. About 0 are common, 1 is distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
When adding a new API version to an existing construct:
- Very specific: line 52
Add a new ApiSchema const using the naming convention {PREFIX}_SCHEMA_{YYYY_MM_DD}
- Very specific: line 53
Add a new VersionConfig const using {PREFIX}_VERSION_{YYYY_MM_DD}
- Very specific: line 55
Add it to the ALL_*_VERSIONS array
- Very specific: line 56
Update defaultVersion() in the construct class to return the new version
- Very specific: line 61
Run npm test to verify
- Very specific: line 68
Use PropertyType.STRING, PropertyType.OBJECT, etc.
- Very specific: line 69
Use VersionSupportLevel.ACTIVE, .MAINTENANCE, .DEPRECATED, .SUNSET
- Very specific: line 70
Use ValidationRuleType.REQUIRED, .PATTERN_MATCH, .VALUE_RANGE
- Very specific: line 76
Test helper: BaseTestStack in src/testing/
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions 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
Copilot Instructions for terraform-cdk-constructs
Project Overview
This is @microsoft/terraform-cdk-constructs — a JSII-compatible TypeScript library providing Azure CDK constructs using the AZAPI Terraform provider for direct Azure REST API access.
Architecture
- Each Azure resource lives in
src/azure-<name>/with:lib/<resource>.ts— main construct class extendingAzapiResourcelib/<resource>-schemas.ts— API version schemas (VersionConfig[])test/<resource>.spec.ts— unit tests (Jest)test/<resource>.integ.ts— integration tests (real Azure)
- Core framework in
src/core-azure/:lib/azapi/azapi-resource.ts— abstract base classlib/version-manager/api-version-manager.ts— version registry singletonlib/version-manager/interfaces/version-interfaces.ts— all interfaces
Schema File Conventions
Each *-schemas.ts file follows this exact pattern:
- Imports from
../../core-azure/lib/version-manager/interfaces/version-interfaces - Shared properties object (e.g.,
COMMON_PROPERTIES) withPropertyDefinitionentries - Per-version
ApiSchemaexports named{PREFIX}_SCHEMA_{VERSION_UNDERSCORED}:export const RESOURCE_GROUP_SCHEMA_2025_03_01: ApiSchema = { resourceType: "Microsoft.Resources/resourceGroups", version: "2025-03-01", properties: { ...COMMON_PROPERTIES }, required: ["location"], optional: ["tags", "managedBy"], }; - Per-version
VersionConfigexports named{PREFIX}_VERSION_{VERSION_UNDERSCORED}:export const RESOURCE_GROUP_VERSION_2025_03_01: VersionConfig = { version: "2025-03-01", schema: RESOURCE_GROUP_SCHEMA_2025_03_01, supportLevel: VersionSupportLevel.ACTIVE, releaseDate: "2025-03-01", }; ALL_*_VERSIONSarray aggregating allVersionConfigobjects*_TYPEconstant with the Azure resource type string
Adding a New API Version
When adding a new API version to an existing construct:
- Add a new
ApiSchemaconst using the naming convention{PREFIX}_SCHEMA_{YYYY_MM_DD} - Add a new
VersionConfigconst using{PREFIX}_VERSION_{YYYY_MM_DD} - Set
supportLevel: VersionSupportLevel.ACTIVEon the new version - Add it to the
ALL_*_VERSIONSarray - Update
defaultVersion()in the construct class to return the new version - Update unit tests:
- Latest version assertions (e.g.,
resolvedApiVersionandlatestVersion()) - Version list completeness checks
- "All versions work" iteration arrays
- Latest version assertions (e.g.,
- Run
npm testto verify
Key Interfaces
PropertyDefinition:{ dataType, required?, defaultValue?, description?, validation? }ApiSchema:{ resourceType, version, properties, required, optional?, deprecated? }VersionConfig:{ version, schema, supportLevel, releaseDate, changeLog? }- Use
PropertyType.STRING,PropertyType.OBJECT, etc. (JSII-compatible class constants, not enums) - Use
VersionSupportLevel.ACTIVE,.MAINTENANCE,.DEPRECATED,.SUNSET - Use
ValidationRuleType.REQUIRED,.PATTERN_MATCH,.VALUE_RANGE
Testing
- Unit tests:
npm test(runsjest --testMatch '**/*.spec.ts') - Integration tests:
npm run integration(deploys to real Azure) - Test helper:
BaseTestStackinsrc/testing/
Build
npx projen build— compiles, lints, tests, and generates JSII artifactsyarn install --check-files --frozen-lockfile— install dependencies
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

