metaobjects-codegen

Generates idiomatic TypeScript, Java, Kotlin, C#, and Python code from typed MetaObjects metadata.

1|Updated May 14, 2026
One-click install
npx skills add https://github.com/metaobjectsdev/metaobjects --skill metaobjects-codegen-metaobjectsdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: metaobjects-codegen
Source: https://github.com/metaobjectsdev/metaobjects/tree/main/agent-context/skills/metaobjects-codegen
Command: npx skills add https://github.com/metaobjectsdev/metaobjects --skill metaobjects-codegen-metaobjectsdev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Hand-writing entity classes, database tables, REST routes, validators, and payload parsers for every layer of an application is repetitive and drifts out of sync with the data model. This Skill configures and runs MetaObjects code generation so each layer is derived from one typed metadata model, with hand edits protected during regeneration. ## Core Features & Use Cases - Multi-language code generation: Emits entity types, DB schemas, query helpers, REST routes, validators, and prompt payload parsers in TypeScript, Java, Kotlin, C#, and Python with no proprietary runtime in the output. - Hand-edit-preserving regeneration: Hash-manifest protection on TypeScript, C#, and Python, and a GENERATED header token on Java and Kotlin, so regeneration refuses to overwrite files you have edited. - Generator selection and ownership: Catalog generators with meta gen --list --probe, eject them into your repo with meta eject, and write custom programmatic or Mustache-template generators for shapes the built-ins do not emit. - Use Case: You model an Order entity with a customer join in metadata, run meta gen, and receive the Drizzle table, Zod schemas, typed CRUD queries, and Fastify routes — then regenerate safely after changing the model without losing hand-written business logic. ## Quick Start Ask the agent to run meta gen --list --probe against your metadata directory and wire the generators that match your application's stack.

Frequently Asked Questions about metaobjects-codegen

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run MetaObjects code generation for my project?

Run meta gen for TypeScript, dotnet meta gen for C#, metaobjects gen for Python, or mvn metaobjects:generate for Java and Kotlin. Select generators first with meta gen --list --probe, which shows what each generator would emit against your own model.

How does MetaObjects protect hand edits during regeneration?

TypeScript, C#, and Python use a committed hash manifest: a file whose content no longer matches the recorded hash is refused by name and the run exits 1. Java and Kotlin use a GENERATED token in the file header; removing that token excludes the file from regeneration.

Can I write a custom generator for a framework MetaObjects does not ship?

Yes. Implement the Generator interface with a name, optional filter, and generate function returning EmittedFile objects, or use a declarative Mustache template with a scope and outputPattern. On TypeScript, meta eject copies a reference generator into your repo to edit.

Why did my generator drop inherited fields from an abstract parent?

The generator read properties through an own*() accessor, which skips attributes inherited via extends. Use the resolving accessor for your port: attr() in TypeScript, attrs().get(name) in Python, getMetaAttr(name) in Java and Kotlin.

Does MetaObjects generate code for all five languages by default?

No. meta init wires no generators and no port ships a default suite; the generators array starts empty and --generators is required on the C# and Python CLIs. You choose generators per layer based on your application's purpose and stack.

What happens when a generated file was edited and CI runs meta gen?

On hash-manifest ports the write is refused by name and the run exits 1, failing the build. For a project predating the manifest, run meta gen --baseline=adopt once to record existing files as the baseline, commit it, then regenerate.