Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

datamodel-code-generator

Skill by datamodel-code-generator

Generates Python data models, Pydantic models, dataclasses, TypedDicts and msgspec structs from API specs, schemas and sample data. It is for developers and AI assistants who need typed Python classes instead of hand-written model code.

  • Score 88
  • 4.1k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install datamodel-code-generator

Built from the published package, never by AI.

git clone --depth 1 https://github.com/datamodel-code-generator/datamodel-code-generator /tmp/datamodel-code-generator && mkdir -p ~/.claude/skills && cp -r /tmp/datamodel-code-generator/skills/datamodel-code-generator ~/.claude/skills/datamodel-code-generator

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install datamodel-code-generator in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

datamodel-code-generator is an agent skill that tells an AI assistant how to run the datamodel-codegen CLI. It covers inputs such as OpenAPI, AsyncAPI, JSON Schema, GraphQL, JSON, YAML, CSV, Avro, XML Schema, Protocol Buffers, MCP tool schemas and existing Python model objects. The skill maps each input to the right flag and chooses an output model type such as pydantic_v2.BaseModel, dataclasses.dataclass, typing.TypedDict or msgspec.Struct.

The skill asks the assistant to check the CLI first, prefer one-shot execution, and run the built-in option recommender before generating. It also lists verification steps such as check mode and import tests. The source describes experimental support for generating a typed HTTP client or a FastAPI server from OpenAPI, and a client from AsyncAPI. It is aimed at Python developers who want generated models kept in sync with a schema.

Written from the project's SKILL.md and checked against it.

What it can do

  • Model generation from schemasGenerates Python models from OpenAPI, AsyncAPI, JSON Schema, GraphQL, Avro, XML Schema and Protobuf inputs.
  • Sample data to classesCreates Python classes from raw JSON, YAML or CSV sample data.
  • Output model selectionChooses between Pydantic, dataclass, TypedDict and msgspec output based on project signals.
  • Option recommenderRuns the CLI recommender and can write its result into pyproject.toml.
  • Verification guidanceUses check mode, import tests and project lint or type checks when configured.
  • Experimental client and server generationDescribes generating an OpenAPI HTTP client, a FastAPI server, or an AsyncAPI client.

What you need

  • uvx, pipx or uv to run the CLI in one shot
  • Python 3.11 or later for client and server generation
  • Network access for remote URLs (uses the http extra)

Try asking

  • Generate Pydantic models from this OpenAPI spec
  • Turn this JSON sample into typed Python classes
  • Create dataclasses from this JSON Schema file

Good to know

  • Status is marked experimental
  • Generated files are overwritten on every run, so they should not be edited by hand
  • Only Python output is supported, not TypeScript or other languages
  • Client and server generation covers OpenAPI, with AsyncAPI for clients only

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: skills/datamodel-code-generator/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md12 KB
  • references/cli-options.md153 KB
  • references/troubleshooting.md6 KB
  • references/workflows.md15 KB

Alternatives to datamodel-code-generator

All alternatives →
openclaw-github-repo-commandersickn33
94

Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.

AAA Skill 50k
gradiogradio-app
94

Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.

AAA Skill 44k
hig-components-menussickn33
94

Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.

AAA Skill 50k
fastapi-templateswshobson
94

Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.

AAA Skill 43k
appfunctionsandroid
94

Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.

AAA Skill 11k
agent-qa-authoringsickn33
94

Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.

AAA Skill 50k

Compare with openclaw-github-repo-commander, gradio or hig-components-menus

datamodel-code-generator: common questions

Which input formats does datamodel-code-generator accept?

The source lists OpenAPI, AsyncAPI, JSON Schema, GraphQL, raw JSON, YAML and CSV sample data, Avro, XML Schema, Protocol Buffers or gRPC, MCP tool schemas, and existing Python model objects.

Can I edit the generated models by hand?

The source says generated files are overwritten on every run, so changes should be made to the document or options and the code regenerated.

Does it generate TypeScript types?

No. The source says the skill does not claim support for non-Python output targets such as TypeScript.

How do I install datamodel-code-generator?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is datamodel-code-generator free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is datamodel-code-generator safe to use?

It scores 88 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to datamodel-code-generator?

Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.

datamodel-code-generator Install

Add to stack

Loading.