bootstrap-api-version
Skill39 starsChanged 2 months agoApache-2.0View on GitHub
Bootstrap a new ARM API version by copying the latest version, wiring it into the frontend, SDK, tests, and integration fixtures. Invoke with the new version string (e.g. "2027-03-15-preview").
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- config/AGENTS.mdAGENTS.md
- test/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- config/CLAUDE.mdCLAUDE.md
- test/CLAUDE.mdCLAUDE.md
- test-integration/claude.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- pr-standardsSkill
- agentic-workflowsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
26 rules. About 0 are common, 5 are distinctive, and 21 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
21
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Before making any changes, read the codebase to find current registration points.
- Very specific: line 25
TypeSpec version enum: Search for enum Versions in api/ .tsp files
- Very specific: line 28
Language-specific SDK configs: Search for readme.go.md and readme.python.md alongside the main readme.md in the API spec directory — these …
- Very specific: line 29
Frontend registration: Search for RegisterVersion calls and blank imports of previous API version packages in frontend/
- Very specific: line 30
Integration test registry: Search for AllAPIVersions in test-integration/
- Very specific: line 31
Cross-version test constants: Search for the previous version's dash-separated string in test-integration/ test files
- Very specific: line 33
Defaults consistency test: Search for TestEnsureDefaultsConsistency and find where previous versions are tested
- Very specific: line 34
OpenAPI spec path in defaults test: Search for openapi.json in internal/api/defaults_test.go or similar
- Very specific: line 35
E2E framework helpers: Search for version-suffixed functions like CreateHCPClusterFromParam + PREV_PKG in test/util/framework/
- Very specific: line 37
Import alias rules: Check .golangci.yml for importas rules referencing SDK packages
- Very specific: line 49
Add a new enum variant to the Versions enum in the main .tsp file, following the pattern of existing entries.
- Very specific: line 53
Update VERSION ?= default in api/Makefile to NEW_PKG
- Very specific: line 54
Add a new autorest tag section for NEW_PKG in api/readme.md (before the previous version's tag — newest first), pointing to the new …
- Very specific: line 55
Add a matching tag section in api/testsdk.md with the SDK module name
- Very specific: line 56
Update any example commands in api/docs/ that reference the previous version's tag
- Very specific: line 60
Update the spec-level readme.md at api/redhatopenshift/.../hcpopenshiftclusters/readme.md:
- Very specific: line 61
Update the default tag: value at the top to package-NEW_VERSION
- Very specific: line 62
Add a new Tag: package-NEW_VERSION block (before the previous version's tag — newest first) pointing to the new version's openapi.json
- Very specific: line 70
readme.go.md: Add NEW_VERSION to the batch list under $(go) && $(multiapi), and add a new Tag: package-NEW_VERSION and go section (before … - Very specific: line 71
readme.python.md: Add a new Tag: package-NEW_VERSION and python section (before the previous version's tag) with namespace and output … - Distinctive: line 79
Update the copyright year to the current year
- Very specific: line 145
Import the new SDK package with the alias hcpsdk<YYYYMMDD>preview (e.g.
- Distinctive: line 151
Create a new E2E test file following the pattern of the previous version's cluster create test.
- Distinctive: line 155
Test flow: create resource group → create customer resources → create HCP cluster → get credentials → verify cluster health
- Distinctive: line 156
Use the new version's framework helpers for creation.
- Very specific: line 189
License headers: Run make licenses before committing — all new .go files need Apache 2.0 headers.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Bootstrap a New API Version
Scaffold a new ARM API version as an identical copy of the latest existing version, then wire it into every registration point, test suite, and build target. The result is a branch with two commits: one for the API scaffold, one for the E2E test.
Inputs
The user provides:
- NEW_VERSION: the API version string, e.g.
2027-03-15-preview
Derived values:
- NEW_PKG: version string without hyphens, prefixed with
v(e.g.v20270315preview) - PREV_PKG: the most recent existing version — discover by listing directories matching
internal/api/v*preview/and picking the latest alphabetically - PREV_VERSION: the dash-separated form of PREV_PKG (e.g.
2026-06-30-preview) - TIMEBOMB_DATE: one calendar month after the version date, in RFC3339 UTC format
Discovery
Before making any changes, read the codebase to find current registration points. The patterns below describe WHAT to look for and WHERE, not exact paths — paths may drift as the repo evolves.
- TypeSpec version enum: Search for
enum Versionsinapi/.tspfiles - API build config: Find
VERSION ?=inapi/Makefile; find autorest tag blocks inapi/readme.mdandapi/testsdk.md - API spec readme: Find the spec-level
readme.mdunderapi/redhatopenshift/.../hcpopenshiftclusters/— it haspackage-YYYY-MM-DD-previewtag blocks used bymake -C api lint-openapi - Language-specific SDK configs: Search for
readme.go.mdandreadme.python.mdalongside the mainreadme.mdin the API spec directory — these have per-version tag blocks and (for Go) abatchlist - Frontend registration: Search for
RegisterVersioncalls and blank imports of previous API version packages infrontend/ - Integration test registry: Search for
AllAPIVersionsintest-integration/ - Cross-version test constants: Search for the previous version's dash-separated string in
test-integration/test files - Version compliance fixtures: Find
artifacts/VersionCompliance/undertest-integration/and list itsexpected/directories - Defaults consistency test: Search for
TestEnsureDefaultsConsistencyand find where previous versions are tested - OpenAPI spec path in defaults test: Search for
openapi.jsonininternal/api/defaults_test.goor similar - E2E framework helpers: Search for version-suffixed functions like
CreateHCPClusterFromParam+ PREV_PKG intest/util/framework/ - E2E test files: Find
cluster_create_+ PREV_PKG files intest/e2e/ - Import alias rules: Check
.golangci.ymlforimportasrules referencing SDK packages
Step-by-step checklist
Split into two commits (see Commit Strategy below).
Commit 1: API scaffold
1. TypeSpec version enum
Add a new enum variant to the Versions enum in the main .tsp file, following the pattern of existing entries. Then regenerate: cd api && npm run compile && npm run format. This produces the OpenAPI spec, example files, and preview directory for the new version.
2. API build configuration
- Update
VERSION ?=default inapi/Makefileto NEW_PKG - Add a new autorest tag section for NEW_PKG in
api/readme.md(before the previous version's tag — newest first), pointing to the new version'sopenapi.json - Add a matching tag section in
api/testsdk.mdwith the SDK module name - Update any example commands in
api/docs/that reference the previous version's tag
2a. API spec readme
Update the spec-level readme.md at api/redhatopenshift/.../hcpopenshiftclusters/readme.md:
- Update the default
tag:value at the top topackage-NEW_VERSION - Add a new
Tag: package-NEW_VERSIONblock (before the previous version's tag — newest first) pointing to the new version'sopenapi.json
This file uses dash-separated version format (package-YYYY-MM-DD-preview) and is required by make -C api lint-openapi.
2b. Language-specific SDK configs
Find readme.go.md and readme.python.md in the same directory as the main API readme.md. These have per-version tag blocks for autorest code generation:
readme.go.md: Add NEW_VERSION to thebatchlist under$(go) && $(multiapi), and add a newTag: package-NEW_VERSION and gosection (before the previous version's tag) with the output folder path.readme.python.md: Add a newTag: package-NEW_VERSION and pythonsection (before the previous version's tag) with namespace and output folder using underscore-separated version (e.g.v2027_03_15_preview).
3. Internal API version package
Generate models: cd api && make models VERSION=NEW_PKG
Then copy every non-generated .go file from internal/api/PREV_PKG/ to internal/api/NEW_PKG/. In each copied file:
- Change the
packagedeclaration from PREV_PKG to NEW_PKG - Update the copyright year to the current year
- In
register.go: update the version string returned byString()to the new version
The files to copy are all .go files in the previous version's directory that are NOT inside generated/. This typically includes a register.go, several *_methods.go files, and *_test.go files.
4. Frontend registration
Find where previous versions are registered in the frontend:
- A blank-import file (imports version packages for their
init()side effects) — add a new blank import - The file containing
RegisterVersioncalls — add import + call for the new package
5. Test SDK generation
cd api && make testsdk VERSION=NEW_PKGThen wire the new SDK module into test/go.mod with a require + local replace directive, following the pattern of the previous version's entry.
6. Integration test infrastructure
- Find
AllAPIVersions()and add aRegisterVersioncall for the new version (with its import) - Find cross-version test constants (version strings like
"2025-12-23-preview") and add one for the new version
7. Version compliance test fixtures
For each scenario directory under the VersionCompliance artifacts tree, copy the previous version's expected response files to the new version:
expected/get/PREV_VERSION.json→expected/get/NEW_VERSION.jsonexpected/list/PREV_VERSION.json→expected/list/NEW_VERSION.json
Since the new version is initially identical, these are exact copies.
8. Defaults consistency test
Find the defaults consistency test(s) that test each API version's defaults against internal canonical defaults. Add test cases for the new version following the pattern of the previous version's cases. This requires importing the new version package.
9. Defaults test OpenAPI path
Find the test that reads the OpenAPI spec to verify defaults (searches for openapi.json path). Update the path to point to the new version's spec.
10. Tidy and verify
make tidy # go mod tidy + go work sync
make fmt # goimports
make licenses # add Apache 2.0 headers to new files
make lint # check for issues
make -C api validate-examples # validate OpenAPI example files against the spec
make -C api lint-openapi # lint specs against Azure ARM rules
make test # run unit tests
make verify # full CI verification (deepcopy, json-format, materialize, etc.)Commit 2: E2E test with timebomb
11. E2E test framework helpers
Find the previous version's helpers in the test framework directory. Four areas need version-suffixed additions — copy each function/type, replacing the version suffix:
- Deployment params: Cluster/NodePool param structs, factory functions, and infra-population helpers
- HCP helpers: Build, create-and-wait, get, and update functions for clusters and node pools
- Deployment helpers: High-level orchestration functions (create cluster from params, create customer resources)
- Per-test framework: Client factory methods that create SDK clients for the new version
Import the new SDK package with the alias hcpsdk<YYYYMMDD>preview (e.g. hcpsdk20270315preview — note: no v prefix, matching the importas lint rules in .golangci.yml).
Also, in the checkOperationResult function in hcp_helper.go, add a cmpopts.IgnoreFields call for each resource type in the new API version. Use the existing list of ignored fields as a reference.
12. E2E test file
Create a new E2E test file following the pattern of the previous version's cluster create test. Key elements:
- Labels:
RequireNothing,Critical,Positive,AroRpApiCompatible - Timebomb pattern: In non-development environments, query ARM to check if the API version is registered for the resource provider. If not available before TIMEBOMB_DATE, skip gracefully. If not available after TIMEBOMB_DATE, hard-fail. Development environments always run.
- Test flow: create resource group → create customer resources → create HCP cluster → get credentials → verify cluster health
- Use the new version's framework helpers for creation. Credential retrieval can use any version's helper (it's version-independent).
13. Record E2E test specs
make record-nonlocal-e2eThis updates test fixture files that track the E2E test suite contents.
14. Final tidy
make tidy && make fmt && make lintCommit strategy
Split into exactly two commits:
api: scaffold new API version NEW_VERSIONBody: "Add the NEW_VERSION API version as a copy of PREV_VERSION with no feature changes. This establishes the version entry point so new features can be added incrementally in follow-up PRs." Contains: steps 1-10 (including 2a and 2b)test: add E2E test with timebomb for NEW_VERSION API versionContains: steps 11-14
Common pitfalls
- Forgetting
register.goString() update: The copiedregister.gomust return the NEW version string, not the previous one. This is the one semantic change in an otherwise mechanical copy. - Import alias enforcement:
.golangci.ymlmay enforce import aliases for SDK packages. Check theimportasconfig and use any required aliases. - License headers: Run
make licensesbefore committing — all new.gofiles need Apache 2.0 headers. - go.work sync: The SDK module lives under
test/which should already be ingo.work. Runmake tidyto ensurego work syncpicks it up correctly. - Version compliance fixtures: Initially identical copies. When features are later added to the new version, these fixtures must be updated or
TestVersionCompliancewill fail with a clear diff showing exactly what to fix. - E2E file naming: E2E test files must NOT use the
_test.gosuffix (except the entry point). Follow the convention of existing test files. - Copilot instructions: Per
CONTRIBUTING.md, also add a condensed version of any new skill to.github/copilot-instructions.mdfor GitHub Copilot compatibility.
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.

