agentleFS
Microsoft AzureKnown publisherAzure/terraform-cdk-constructs/.github/copilot-instructions.md

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
  1. Distinctive:

    When adding a new API version to an existing construct:

    line 50
  2. Very specific:

    Add a new ApiSchema const using the naming convention {PREFIX}_SCHEMA_{YYYY_MM_DD}

    line 52
  3. Very specific:

    Add a new VersionConfig const using {PREFIX}_VERSION_{YYYY_MM_DD}

    line 53
  4. Very specific:

    Add it to the ALL_*_VERSIONS array

    line 55
  5. Very specific:

    Update defaultVersion() in the construct class to return the new version

    line 56
  6. Very specific:

    Run npm test to verify

    line 61
  7. Very specific:

    Use PropertyType.STRING, PropertyType.OBJECT, etc.

    line 68
  8. Very specific:

    Use VersionSupportLevel.ACTIVE, .MAINTENANCE, .DEPRECATED, .SUNSET

    line 69
  9. Very specific:

    Use ValidationRuleType.REQUIRED, .PATTERN_MATCH, .VALUE_RANGE

    line 70
  10. Very specific:

    Test helper: BaseTestStack in src/testing/

    line 76

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

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 extending AzapiResource
    • lib/<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 class
    • lib/version-manager/api-version-manager.ts — version registry singleton
    • lib/version-manager/interfaces/version-interfaces.ts — all interfaces

Schema File Conventions

Each *-schemas.ts file follows this exact pattern:

  1. Imports from ../../core-azure/lib/version-manager/interfaces/version-interfaces
  2. Shared properties object (e.g., COMMON_PROPERTIES) with PropertyDefinition entries
  3. Per-version ApiSchema exports 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"],
    };
  4. Per-version VersionConfig exports 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",
    };
  5. ALL_*_VERSIONS array aggregating all VersionConfig objects
  6. *_TYPE constant with the Azure resource type string

Adding a New API Version

When adding a new API version to an existing construct:

  1. Add a new ApiSchema const using the naming convention {PREFIX}_SCHEMA_{YYYY_MM_DD}
  2. Add a new VersionConfig const using {PREFIX}_VERSION_{YYYY_MM_DD}
  3. Set supportLevel: VersionSupportLevel.ACTIVE on the new version
  4. Add it to the ALL_*_VERSIONS array
  5. Update defaultVersion() in the construct class to return the new version
  6. Update unit tests:
    • Latest version assertions (e.g., resolvedApiVersion and latestVersion())
    • Version list completeness checks
    • "All versions work" iteration arrays
  7. Run npm test to 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 (runs jest --testMatch '**/*.spec.ts')
  • Integration tests: npm run integration (deploys to real Azure)
  • Test helper: BaseTestStack in src/testing/

Build

  • npx projen build — compiles, lints, tests, and generates JSII artifacts
  • yarn install --check-files --frozen-lockfile — install dependencies

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.