Command Palette

Search for a command to run...

Назад к скиллам
скилл № 40530

switch-resource-to-generated

Use when a handwritten resource that users already have becomes generated code (tools/iac-codegen existing-resource mode). Pin the released behavior with…

БесплатноБез исполняемых скриптов
coralogixот coralogix★ 22 звезды на GitHub

Установить switch-resource-to-generated в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Switch a handwritten resource to generated code

Trigger: A released resource moves to tools/iac-codegen, and its users must see no change.

Recipe:

  1. Pin released behavior first. Before any change, write migration tests: create with the released provider, switch to the new code, and check that Terraform plans no change, then test update, unset, and import. Read the handwritten schema (descriptions, validators, defaults, plan modifiers) and expand/flatten, and plan the applied config again after each refresh to catch perpetual diffs. Check raw request bodies where it matters: alertUniqueIds: {} and {"value": []} parse alike but are different requests. The protocol harness (internal/provider/protocol_harness_test.go) drives a resource against an in-memory backend. A fake that is built from notes hides real behavior, so compare it with a real API recording.
  2. Write behavior-overrides.yaml in the output directory: one line per released field behavior. Run tfgen check --overrides. Add PINNED-SDK lines for facts the pinned SDK lacks. When the API holds a value in a one-property object and the released schema shows the plain value ({"query": {"value": "x"}} as query = "x"), list the component in unwrap. Read the handwritten expand and flatten for each one-property object first: many stay objects, and one component can collapse in one place only (an unwrap: true or unwrap: false field line).
  3. Generate, register, delete the handwritten code. The migration tests must show only wording changes in messages. Put the four operation ids under api.operations. Then run tfgen generate --resource <Name> --out <dir> with no operation flags. The diff must be empty, including ExactlyOneOf and other schema validators.
  4. Fix confirmed bugs in a separate step. The tests must show only the fixes. Do not keep a bug with an override line.
  5. Later API changes. A new optional scalar field generates without a line unless it has a default that is not its zero value and no x-coralogix-presence: true; then the generator stops, so ask for the annotation or probe a read and write a line. A new enum value needs no line: every contract value is accepted except the zero value and rejected. A line with names and no trimPrefix names it by the style of the names entries, or stops with ENUM_NAME_UNDECIDED until a names entry is added.
  6. Generated acceptance test: never skip it. An existing resource gets acceptance_test.go and TestFailurePaths<Name>Generated only when acceptance.yaml sits next to the overrides, so a migration without the file has no generated e2e test at all. Add it in the migration PR (prerequisite HCL, real values, skip, minimal, upgradeFrom), run tfgen generate, and check that the PR's directory list in ls internal/provider/generated/*/acceptance_test.go has no gap. A value the tenant must already hold (an AI application) comes from env, which the workflow step sets; a real fixture name that is a secret is built there. Make values safe for an account-wide resource (IP access: disabled entries only) and put the test name in that resource's serial shard. Keep the hand test until the generated one has passed on a tenant.
  7. Data source. Add dataSource: {} (or its lines) to the overrides, regenerate, and keep a one-line domain constructor that passes the resource hooks to NewDataSource.

Why: Terraform plan modifiers, defaults, and null/empty reads decide whether an upgrade is silent. A second plan after apply and a migration test catch what a compile cannot.

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл switch-resource-to-generated?

Use when a handwritten resource that users already have becomes generated code (tools/iac-codegen existing-resource mode). Pin the released behavior with migration tests first. Do NOT use for a new resource.

Как установить скилл switch-resource-to-generated?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл switch-resource-to-generated запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить switch-resource-to-generated с