write-endpoints

Automate OpenAPI endpoint design and implementation with Chanfana.

762|72|Updated Nov 8, 2022
One-click install
npx skills add https://github.com/cloudflare/chanfana --skill write-endpoints
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-endpoints
Source: https://github.com/cloudflare/chanfana/tree/main/skills/write-endpoints
Command: npx skills add https://github.com/cloudflare/chanfana --skill write-endpoints

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Build complex OpenAPI endpoints faster with Chanfana, standardizing schema, validation, CRUD operations, D1 integration, and consistent error handling across services.

Core Features & Use Cases

  • Schema-driven endpoint definitions with Zod v4 and contentJson wrappers for requests and responses.
  • CRUD Auto Endpoints (Create, Read, List, Update, Delete) with meta-driven customization and nested route support.
  • D1 database integration and robust error handling via documented exception classes and validators.
  • CLI tooling to extract and validate OpenAPI specifications from code.

Quick Start

Follow the examples to scaffold a complete CRUD OpenAPI endpoint using Hono or itty-router with chanfana.

Frequently Asked Questions about write-endpoints

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

FAQPage Schema
How do I create OpenAPI endpoints with Hono and D1?

Chanfana automates OpenAPI endpoint creation for Hono and itty-router by standardizing Zod v4 schema definitions, CRUD operations, and D1 database integration. It enables rapid endpoint generation with robust validation and error handling.

What is the best way to generate CRUD endpoints with OpenAPI validation?

Generating CRUD endpoints with OpenAPI validation is best handled through schema-driven definitions using Zod v4 and contentJson wrappers. Chanfana automates this process, providing meta-driven customization and consistent error handling for Create, Read, Update, Delete, and List operations.

Does Chanfana support itty-router and Zod v4 syntax?

Yes, Chanfana supports itty-router and satisfies Zod v4 syntax. It allows you to scaffold OpenAPI endpoints across both Hono and itty-router apps, utilizing contentJson-wrapped bodies and getValidatedData to ensure accurate API specifications.

How do I document exception schemas and error handling for OpenAPI endpoints?

To document exception schemas and error handling for OpenAPI endpoints, you define documented exception classes and validators within your schema. Chanfana integrates these into the OpenAPI specification, ensuring robust error handling across all CRUD operations.

Can I extract and validate OpenAPI specifications from my code?

Yes, you can extract and validate OpenAPI specifications directly from your code using CLI tooling. This ensures your generated endpoints, schemas, and exception documentation accurately produce the final OpenAPI spec.

When should I use nested routes in my OpenAPI CRUD endpoints?

You should use nested routes in OpenAPI CRUD endpoints when your API structure requires hierarchical resource organization. Chanfana supports nested route creation alongside meta-driven customization to handle complex endpoint relationships accurately.