Skip to content
Agent Orchestration
Command

/trex.kind.remove

Completely remove a generated Kind and all its artifacts from the project.

BOOST
From plugin
platform
13111 skills6 agents11 commands3 MCP
Install
$ npx -y skills add ambient-code/platform --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/trex.kind.remove

Context preview

What this command does when you run it.

Completely remove a generated Kind and all its artifacts from the project.

Command definition

trex.kind.remove.md

Remove a Kind

Completely remove a generated Kind and all its artifacts from the project.

Instructions

Ask the user for the **Kind name** (PascalCase, e.g., "Widget").

Derive the naming variants (see `/trex.kind.new` for the full table):

  • `Kind` = PascalCase (e.g., `Widget`)
  • `kindLowerPlural` = camelCase plural (e.g., `widgets`)
  • `kind_snake_case` = snake_case (e.g., `widget`)

Use the TodoWrite tool to track progress.

Step 1: Verify the Kind Exists

Check that the Kind's files exist before removing:

ls plugins/{kindLowerPlural}/plugin.go
ls pkg/api/{kind}.go
ls pkg/services/{kind}.go

If files don't exist, inform the user and stop.

Step 2: Remove Generated Files (11 files)

Delete all files created by the generator:

rm -rf plugins/{kindLowerPlural}/
rm -f pkg/api/{kind}.go
rm -f pkg/api/presenters/{kind}.go
rm -f pkg/handlers/{kind}.go
rm -f pkg/services/{kind}.go
rm -f pkg/dao/{kind}.go
rm -f pkg/dao/mocks/{kind}.go
rm -f pkg/db/migrations/*_add_{kindLowerPlural}.go
rm -f openapi/openapi.{kindLowerPlural}.yaml
rm -f test/integration/{kindLowerPlural}_test.go
rm -f test/factories/{kindLowerPlural}.go

Step 3: Remove Generated OpenAPI Client Files

rm -f pkg/api/openapi/model_{kind_snake_case}*.go
rm -f pkg/api/openapi/docs/{Kind}*.md

Step 4: Unwire from Existing Files

4.1 `cmd/ambient-api-server/main.go`

Remove the blank import line for the Kind's plugin.

4.2 `pkg/db/migrations/migration_structs.go`

Remove from `MigrationList`:

add{Kind}s(),

4.3 `openapi/openapi.yaml`

Remove the path `$ref` entries for this Kind (both collection and item paths). Remove the schema `$ref` entries (`{Kind}`, `{Kind}List`, `{Kind}PatchRequest`).

Step 5: Regenerate OpenAPI Client

make generate

This ensures the OpenAPI client code no longer references the removed Kind.

Step 6: Verify Clean Removal

make binary

Fix any remaining references. Common issues:

  • Other services importing the removed Kind's plugin
  • Test files referencing the removed Kind's factory
  • Stale references in OpenAPI generated code

Step 7: Confirm

List any files that still reference the Kind name:

rg "{Kind}" --type go --type yaml -l

If any remain, they need manual cleanup (likely cross-references from other Kinds).

Read more
Ships withplatform

Kubernetes-native AI automation platform for intelligent agentic sessions

Get the whole plugin

Other commands on platform.