TOKREPO · Arsenal IA
Nouveau · cette semaine

Pack Génération de Code Spécialisée

Dix choix pour le dev qui veut combiner IA et générateurs déterministes pour les traductions de niche — SQL vers ORM typé, schéma GraphQL vers resolvers, scaffold par template, OpenAPI vers SDK client, JSON Schema vers types TypeScript, regex depuis langage naturel et parser generators. Cookiecutter + Meta Agentic Project Scaffold + OpenAPI Generator + sqlc + gqlgen + TypeBox + Zod + TypeChat + grex + Tree-sitter. Dans l'ordre.

10 ressources

What's in this pack

LLM-powered editors are great at one-off code completion, but they are not the right tool when you need the same translation a thousand times — every PR, every API change, every new migration. For that you want deterministic generators with a spec as input. This pack is the working dev's curated set of those generators, plus two AI helpers that handle the fuzzy ends (project scaffold, natural-language regex).

The whole set covers seven niche translation jobs in one rig:

  • Project scaffold from a template (Cookiecutter) or from a prompt (Meta Agentic Project Scaffold)
  • OpenAPI spec → client SDKs and server stubs (OpenAPI Generator)
  • SQL queries → type-safe code (sqlc)
  • GraphQL schema → typed resolvers and server (gqlgen)
  • JSON Schema → static TypeScript types (TypeBox)
  • TypeScript-first validation that doubles as types (Zod)
  • Schema-first natural-language UI to structured code (TypeChat)
  • Regex from natural-language examples (grex)
  • Parser generators for a new DSL or grammar (Tree-sitter)

None of these compete with your coding agent. They sit underneath it. The agent writes the spec; these tools turn the spec into the same code your handwritten version would have been, only without the typos.

Install in this order

  1. Cookiecutter — start with the project skeleton. Pick a template, answer five prompts, get a populated repo. This is the lowest-friction win and sets the layout every other tool plugs into.
  2. Meta Agentic Project Scaffold — when there is no template that fits, let an AI agent walk you through scaffolding one. The Claude Code agent asks the right questions, writes the directory tree, and seeds the configs. Pair with Cookiecutter to capture the result as a reusable template next time.
  3. OpenAPI Generator — install once, generate client SDKs in 60+ languages and server stubs in 40+. Pin the version in CI. The moment you publish openapi.yaml, every consumer (your mobile app, your partner, your internal services) gets a regeneratable client.
  4. sqlc — write plain SQL queries in a .sql file, sqlc generate emits type-safe Go (or Kotlin, Python) functions that wrap them. You stop translating SELECT rows into structs by hand. The compiler catches column renames before tests do.
  5. gqlgen — schema-first GraphQL for Go. Write schema.graphql, run codegen, get strongly-typed resolver interfaces. You implement the business logic; the wiring is generated. Symmetric to sqlc on the API side.
  6. TypeBox — JSON Schema and TypeScript static types from one source of truth. Define the schema once; get both runtime validation and .d.ts types. Fastify and Ajv plug in directly.
  7. Zod — TypeScript-first schema validation. Same idea as TypeBox but the schema is the TypeScript expression itself. Pick TypeBox when you also need raw JSON Schema output for OpenAPI; pick Zod when you live entirely in TS.
  8. TypeChat — Microsoft's library for getting structured, schema-conforming output from an LLM. Define the response shape as a TypeScript type; TypeChat coerces the model into compliance. The bridge between your AI-generated code and your typed runtime.
  9. grex — paste examples, get a regex. Catches the edge cases your regex would have missed by induction. Faster than asking the LLM, deterministic, no token spend.
  10. Tree-sitter — incremental parser generator. The day you decide your config file or your DSL needs first-class IDE support, this is the tool. Used by Neovim, GitHub semantic search, and most modern editors for syntax intelligence.

How they fit together

Cookiecutter / Meta Agentic Scaffold
   │
   └── creates a fresh repo with consistent layout
        │
        ├── openapi.yaml ──── OpenAPI Generator ───► clients/, server-stubs/
        │
        ├── queries.sql ───── sqlc ─────────────────► db/typed-queries.go
        │
        ├── schema.graphql ── gqlgen ──────────────► resolvers.go (typed)
        │
        ├── *.schema.json ─── TypeBox ─────────────► types.d.ts + validators
        │                          │
        │                          └── feeds OpenAPI Generator and Ajv
        │
        ├── Zod (TS-only)   ───────────────────────► z.infer<typeof X>
        │
        └── TypeChat ───────────────────────────────► LLM-shaped output → typed runtime

Niche helpers (independent):
   grex (examples → regex)
   Tree-sitter (grammar → incremental parser)

The spine is scaffold → spec → generate. Every spec file becomes a CI step: regenerate, diff, fail the build if the generated code drifts from what is committed. This is the discipline that makes codegen scale across a team.

Tradeoffs you will hit

  • TypeBox vs Zod — TypeBox emits raw JSON Schema as a byproduct, so it plugs into OpenAPI Generator and Ajv without translation. Zod has the friendlier TypeScript ergonomics and a larger ecosystem (tRPC, Hono, Next.js). Most projects pick one; some use TypeBox at the API boundary and Zod inside the app.
  • sqlc vs Prisma/Drizzle — sqlc starts from SQL and generates code; Prisma and Drizzle start from a TypeScript schema and generate SQL. sqlc wins when the DB is the source of truth and you have DBAs writing the queries. Prisma/Drizzle win when the app team owns the schema. They are not direct competitors of this pack — this pack is for SQL-first teams.
  • gqlgen vs code-first GraphQL — gqlgen is schema-first: the .graphql file leads, code follows. Apollo Server in TS can go code-first. Schema-first scales better across language boundaries (frontend reads the same file).
  • OpenAPI Generator vs hand-written clients — generated clients can be uglier than handwritten ones. The win is not aesthetic, it is the regenerate-on-spec-change loop. If your spec never changes, hand-write. If it changes every sprint, generate.
  • TypeChat vs raw function-calling — function-calling APIs from providers are converging on the same idea. TypeChat is library-not-API, runs against any model, and gives you retry and repair loops. Use it when portability matters or when you want the retry logic for free.

Common pitfalls

  • Not committing the generated files — debated for years. The pragmatic answer for most teams: commit them. Reviewers can see the diff, CI can verify regenerate-is-clean, new contributors do not need toolchain on day one. Generate-on-build only when the toolchain is universally available.
  • Drift between spec and code — every generator needs a CI step that runs the generator and fails on diff. Without this, the spec and code silently desync.
  • Pinning the generator version — OpenAPI Generator and sqlc both occasionally emit different code between minor versions. Pin in CI or you get noisy diffs that have nothing to do with your changes.
  • Tree-sitter grammar debugging — the first grammar you write will have ambiguities. Use the tree-sitter test corpus from day one; do not try to debug by reading the parse tree by hand.
  • TypeChat retries swallowing real bugs — TypeChat retries when the LLM returns malformed output. If your schema is wrong, it retries forever. Log the failures and set a max-attempts cap.
INSTALLER · UNE COMMANDE
$ tokrepo install pack/code-generation-specialized
passez-la à votre agent — ou collez-la dans votre terminal
Ce qu'il contient

10 ressources prêtes à installer

Skill#01
Cookiecutter — Project Templates from the Command Line

A command-line utility that creates projects from cookiecutter templates, supporting Python, JavaScript, Ruby, and any other language or framework with Jinja2 templating.

by Script Depot·66 views
$ tokrepo install cookiecutter-project-templates-command-line-369d9a13
Skill#02
Claude Code Agent: Meta Agentic Project Scaffold

Meta agentic project creation assistant to help users create and manage project workflows effectively.

by TokRepo精选·24 views
$ tokrepo install claude-code-agent-meta-agentic-project-scaffold-b4946b3b
Config#03
OpenAPI Generator — Generate Client SDKs and Server Stubs from API Specs

A code generation tool that produces client libraries, server stubs, API documentation, and configuration from OpenAPI 2.0/3.x specifications in over 50 languages.

by AI Open Source·84 views
$ tokrepo install openapi-generator-generate-client-sdks-server-stubs-api-a951911e
Skill#04
sqlc — Generate Type-Safe Go Code from SQL

sqlc generates fully type-safe Go code from your SQL queries. Write SQL, run sqlc generate, and get Go functions with proper types for parameters and results — no ORM, no reflection, just compile-time safe database access.

by AI Open Source·131 views
$ tokrepo install sqlc-generate-type-safe-go-code-sql-10d1b389
Skill#05
gqlgen — Code-First GraphQL Server for Go

A Go library for building GraphQL servers using a schema-first approach with code generation. Define your schema in SDL, run the generator, and implement resolver methods with full type safety.

by AI Open Source·34 views
$ tokrepo install gqlgen-code-first-graphql-server-go-cb4a0816
Skill#06
TypeBox — JSON Schema Type Builder for TypeScript

Build JSON Schema types with static TypeScript inference, giving you runtime validation and compile-time safety from a single definition.

by AI Open Source·70 views
$ tokrepo install typebox-json-schema-type-builder-typescript-913ed389
Skill#07
Zod — TypeScript-First Schema Validation

TypeScript-first schema declaration and validation library. Define a schema once, get type inference, runtime validation, and serialization. The standard for TypeScript data validation. 35,000+ stars.

by Script Depot·135 views
$ tokrepo install zod-typescript-first-schema-validation-5328f7ec
Skill#08
TypeChat — Schema-First Natural Language UIs

Build typed natural language interfaces by turning intent into validated JSON via TypeScript types. Replace prompt engineering with schema engineering.

by Agent Toolkit·57 views
$ tokrepo install typechat-schema-first-natural-language-uis
Skill#09
grex — A Command-Line Tool That Generates Regular Expressions from Examples

grex turns a list of example strings into a matching regex. Paste the patterns you want to match, get back a tested regex — no more staring at a regex cheat sheet for 30 minutes.

by AI Open Source·106 views
$ tokrepo install grex-command-line-tool-generates-regular-expressions-8f0a62b4
Skill#10
Tree-sitter — Incremental Parser Generator for Editors

Tree-sitter is a general parser generator + incremental parsing library that powers fast, robust syntax highlighting, code folding, and structural edits in editors like Neovim, Zed, Helix, and GitHub.

by AI Open Source·112 views
$ tokrepo install tree-sitter-incremental-parser-generator-editors-ffd869e7
Questions fréquentes

Questions fréquentes

Is this pack still relevant when my AI coding agent already writes most of the code?

More relevant, not less. The agent is great at one-off code, but it is not the right tool for the same translation happening a thousand times — every API change, every migration, every new client SDK. These deterministic generators sit underneath the agent: the agent edits the spec, the generators emit the boilerplate. You stop paying tokens to translate openapi.yaml into a fetch client; you stop reviewing AI-generated repetition. The agent stays focused on the logic, where it is actually useful.

What's the difference between Cookiecutter and Meta Agentic Project Scaffold?

Cookiecutter applies a curated template — fast, deterministic, reproducible, but only as good as the templates you have. Meta Agentic Project Scaffold is an AI agent that interviews you and writes a scaffold from scratch, useful when no template fits or when you're prototyping an unfamiliar stack. The healthy pairing: use the agent to write the first one, then turn the result into a Cookiecutter template so the next person on your team does not pay the AI again.

Why pick sqlc over Prisma or Drizzle if I want type safety?

Direction of generation. sqlc reads your SQL and generates code. Prisma and Drizzle read a TypeScript-flavored schema and generate SQL. Pick sqlc when the database is the source of truth, your DBAs write the queries, or you are in Go and want compile-time SQL checking. Pick Prisma/Drizzle when the application team owns the schema and prefers a TypeScript-first ergonomics. They solve overlapping problems from opposite ends — this pack focuses on the SQL-first end.

Do I need both TypeBox and Zod, or pick one?

Pick one as the primary, optionally use the other at the boundary. TypeBox emits raw JSON Schema, which makes it the better default if you also publish OpenAPI specs or feed Ajv validators. Zod has friendlier TypeScript ergonomics and is the established default in the tRPC and Hono ecosystems. If you live entirely inside a TypeScript app, Zod is the smoother choice. If you cross language boundaries via OpenAPI, TypeBox saves you a translation step.

Why does Tree-sitter belong in a code generation pack?

Because parser generators are code generation for the language tooling layer. The day your team's internal config format, query DSL, or template language needs first-class editor support — syntax highlighting, structural search, refactoring — you write a Tree-sitter grammar and the rest is generated. Neovim, GitHub semantic search, and most modern editors consume Tree-sitter grammars directly. It belongs here because it answers the same question as the rest of the pack: spec in, code out, do not write it by hand.

PLUS DANS L'ARSENAL

12 packs · 80+ ressources sélectionnées

Découvrez tous les packs curatés sur la page d'accueil

Retour à tous les packs