trex.kind.remove

A command that completely removes a generated Kind and its related project files. A Kind is a project resource type with generated code, API definitions, database changes, and tests.

In plain words
What is it for?
Use it when a generated Kind must be deleted from the project. It checks that the Kind exists and then removes its generated files and OpenAPI client files.
Why use it?
It prevents an unwanted resource type from remaining partly present across the codebase, API, database, and tests.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/ambient-code/platform/trex.kind.remove
Clone the repo
git clone --depth 1 https://github.com/ambient-code/platform

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 652 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00652
Opus 5 $0.00000 $0.00326
Sonnet 5 $0.00000 $0.00130
Haiku 4.5 $0.00000 $0.00065

Measured yesterday against content hash eabb426c745e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

trex.kind.remove scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf plugins/{kindLowerPlural}/
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

components/ambient-api-server/.claude/commands/trex.kind.remove.md · 97 lines

How it starts

The opening of the file, as written. The whole thing — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

Read the full file on GitHub · 97 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 97 lines · 0 tokens per session scan C eabb426c745e

Subscribe to this mod's changes

trex.kind.remove is a command published in the GitHub repository ambient-code/platform (129 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 652 tokens. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.