一键导入
implement-api-resource
Scaffold a new CLI resource end-to-end — API client, Cobra commands, output formatting, and tests — from the OpenAPI spec.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold a new CLI resource end-to-end — API client, Cobra commands, output formatting, and tests — from the OpenAPI spec.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | implement-api-resource |
| description | Scaffold a new CLI resource end-to-end — API client, Cobra commands, output formatting, and tests — from the OpenAPI spec. |
| argument-hint | <resource-name> |
| disable-model-invocation | true |
Scaffold a complete new CLI resource for $ARGUMENTS, following codebase patterns and the Exasol SaaS OpenAPI spec.
Read all of the following before writing any code:
specs/mission.md — constraints (especially: provider never exposed, all flags mandatory/optional labelled)internal/api/ — client patterns, types, helpersinternal/cmd/ — command patterns, flag conventions, wiringinternal/output/ — output formatting patternscmd/exasol-saas/ — entry point and binary setupFetch https://cloud.exasol.com/openapi.json and extract for the target resource:
required array$ref (resolve them fully)The spec is the single source of truth. Do not invent or omit fields.
Use AskUserQuestion to ask the following in a single message before writing any code:
--database-id)? Confirm the flag name.Wait for the answer before continuing.
Follow the exact patterns from database.go. Apply these flag rules without exception:
| Rule | Detail |
|---|---|
| Expose every writable field | No API field may be left out |
provider is never a flag | Hardcode to "AWS" where the API requires it |
| Required field | MarkFlagRequired + description must explain the field's purpose and end with (required) |
| Optional field | Description must explain the field's purpose — no label, no (optional) suffix |
| Nested objects | Flatten to individual flags (e.g. --auto-stop-idle-time) |
| Help text quality | Every flag must have a meaningful description — never leave it empty or use just the field name. Include valid values or examples where helpful (e.g. "Cloud region, e.g. us-east-1", "Cluster size, e.g. XS, S, M, L") |
| File | Content |
|---|---|
internal/api/<resource>.go | Types and client methods for all operations |
internal/api/<resource>_test.go | Tests for all API client methods |
internal/cmd/<resource>.go | Cobra subcommands for all operations |
internal/cmd/<resource>_test.go | Tests for all Cobra commands |
new<Resource>Cmd(cfg) to internal/cmd/root.go — same pattern as newDatabaseCmdspecs/mission.mdtask build
task test
task lint
Show the output of each command. Fix any errors before reporting done.
✓ internal/api/<resource>.go — <N> methods
✓ internal/api/<resource>_test.go — <N> tests
✓ internal/cmd/<resource>.go — <N> subcommands (<list>)
✓ internal/cmd/<resource>_test.go — <N> tests
✓ internal/cmd/root.go — wired up
✓ specs/mission.md — updated / unchanged