trex.kind.new

A code generator for creating a new CRUD entity in a Go application. CRUD means the basic operations to create, read, update, and delete records.

In plain words
What is it for?
Use it to define an entity name and fields, then generate its plugin, model, data access code, service, API handlers, migration, OpenAPI entry, and tests.
Why use it?
It removes the need to create the many related files, database changes, API definitions, and tests by hand for each new entity.

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.new
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 730 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00730
Opus 5 $0.00000 $0.00365
Sonnet 5 $0.00000 $0.00146
Haiku 4.5 $0.00000 $0.00073

Measured 3d ago against content hash 831f0db5cbd2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

trex.kind.new scanned grade A with 0 findings 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 3d ago.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

components/ambient-api-server/.claude/commands/trex.kind.new.md · 86 lines

How it starts

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

Generate a New Kind

Generate a complete CRUD entity (Kind) using the automated generator script.

Instructions

Use the TodoWrite tool to track progress.

Step 1: Gather Requirements

Ask the user for:

  1. Kind name (singular, PascalCase): e.g., "Widget", "Rocket", "Customer"
  2. Fields beyond the base Meta fields (optional):
    • Name (use snake_case): e.g., "fuel_type", "max_speed"
    • Type: string, int, int64, bool, float64, time
    • Nullability: :required or :optional (default: nullable)

Step 2: Run the Generator

go run ./scripts/generator.go --kind {KindName}

With custom fields:

go run ./scripts/generator.go --kind {KindName} --fields "{field1}:{type1}:{nullability},{field2}:{type2}"

Example:

go run ./scripts/generator.go --kind Rocket --fields "name:string:required,fuel_type:string,max_speed:int"

The generator automatically:

  • Creates 11 new files (plugin, model, DAO, mock, service, presenters, handlers, migration, OpenAPI spec, test factory, integration tests)
  • Modifies 3 existing files (cmd/ambient-api-server/main.go, pkg/db/migrations/migration_structs.go, openapi/openapi.yaml)
  • Runs make generate to regenerate the OpenAPI client
  • Formats all Go files with gofmt

Step 3: Build and Verify

make binary

Fix any compilation errors if they occur.

Step 4: Test

make test-integration

Or run just the new Kind's tests:

TESTFLAGS="-run Test{Kind}" make test-integration

Field Type Reference

User Type Go (required) Go (nullable) OpenAPI type OpenAPI format DB Type
string string *string string varchar
int int *int integer int32 integer
int64 int64 *int64 integer int64 bigint
bool bool *bool boolean boolean
float64 float64 *float64 number double float8
time time.Time *time.Time string date-time timestamptz

Read the full file on GitHub · 86 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. 3d ago First seen · 86 lines · 0 tokens per session scan A 831f0db5cbd2

Subscribe to this mod's changes

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