schema-driven-dev

Consolidate API schemas and domain models into Zod schemas.

Updated Sep 21, 2025
One-click install
npx skills add https://github.com/hmjn023/solid-imager --skill schema-driven-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: schema-driven-dev
Source: https://github.com/hmjn023/solid-imager/tree/main/.opencode/skills/schema-driven-dev
Command: npx skills add https://github.com/hmjn023/solid-imager --skill schema-driven-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Centralizes data structure definitions to prevent drift between API contracts and domain models by using Zod schemas as the single source of truth.

Core Features & Use Cases

  • Single source of truth: Define API requests/responses and domain models via Zod schemas and derive TypeScript types with z.infer.
  • Automatic type derivation: Generate TypeScript types from schemas to ensure consistency across codebases without manual redefinition.
  • Use case: When updating a domain entity, adjust its schemas.ts and expect all dependent types to update automatically.

Quick Start

Define a Zod schema in packages/core/src/domain/{entity}/schemas.ts and export the inferred TypeScript type using z.infer<typeof yourSchema>.

Frequently Asked Questions about schema-driven-dev

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

FAQPage Schema
How do I derive TypeScript types from Zod schemas to prevent API contract drift?

Using Zod schemas as a single source of truth prevents API contract drift by deriving TypeScript types with z.infer. Updating a schema in schemas.ts automatically propagates changes to all dependent types across your project.

What is the best way to centralize domain models and API schemas in TypeScript?

Centralizing domain models involves consolidating API request/response schemas into Zod schemas within packages/core/src/domain/{entity}/schemas.ts. You then export inferred TypeScript types via z.infer to maintain consistency across backend and frontend projects.

Can I use Zod schemas for both API design and domain modeling in frontend and backend projects?

Yes, you can use Zod schemas for both API design and domain modeling across backend and frontend projects. By defining data shapes once and deriving TypeScript types, you enforce consistency and eliminate manual type synchronization between separate API contracts and domain models.

How do I update domain entity types without manually redefining TypeScript interfaces?

To update domain entity types without manual redefinition, adjust the Zod schema in the entity's schemas.ts file. Using z.infer<typeof yourSchema>, all dependent TypeScript types update automatically, ensuring your changes propagate without manual intervention.

Does schema-driven development work without external dependencies in TypeScript?

Yes, schema-driven development works without external dependencies. The approach relies solely on Zod schemas and native TypeScript type inference, requiring no additional libraries to maintain synchronized data shape definitions across your project.