agentleFS
CloudflareKnown publishercloudflare/chanfana/llms.txt

chanfana

llms.txt768 starsChanged 9 months agoMITView on GitHub

OpenAPI 3 and 3.1 schema generator and validator for Hono, itty-router, and Cloudflare Workers. Chanfana automatically generates OpenAPI specs from Zod v4 schemas, validates requests, and provides auto CRUD endpoints with built-in D1 database support. This package includes source code and documentation to help AI tools understand the library:

The file

We split this llms.txt into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Zod v4 syntax: Use z.email(), z.uuid(), z.iso.datetime() (not z.string().email())

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 1,484 llms.txt files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
llms.txt
# Chanfana

> OpenAPI 3 and 3.1 schema generator and validator for Hono, itty-router, and Cloudflare Workers.

Chanfana automatically generates OpenAPI specs from Zod v4 schemas, validates requests, and provides auto CRUD endpoints with built-in D1 database support.

## Quick Example

```typescript
import { Hono } from 'hono';
import { fromHono, OpenAPIRoute, contentJson } from 'chanfana';
import { z } from 'zod';

class GetUser extends OpenAPIRoute {
  schema = {
    request: {
      params: z.object({ id: z.number() }),
    },
    responses: {
      "200": {
        description: "User found",
        ...contentJson(z.object({
          success: z.boolean(),
          result: z.object({ id: z.number(), name: z.string() }),
        })),
      },
    },
  };

  async handle(c) {
    const { params } = await this.getValidatedData<typeof this.schema>();
    return { success: true, result: { id: params.id, name: "Alice" } };
  }
}

const app = new Hono();
const openapi = fromHono(app);
openapi.get('/users/:id', GetUser);
export default app;
```

## Key Concepts

- **Zod v4 syntax**: Use `z.email()`, `z.uuid()`, `z.iso.datetime()` (not `z.string().email()`)
- **Router adapters**: `fromHono(app)` for Hono, `fromIttyRouter(router)` for itty-router
- **Auto CRUD**: `CreateEndpoint`, `ReadEndpoint`, `UpdateEndpoint`, `DeleteEndpoint`, `ListEndpoint`
- **D1 CRUD**: `D1CreateEndpoint`, `D1ReadEndpoint`, `D1UpdateEndpoint`, `D1DeleteEndpoint`, `D1ListEndpoint`
- **Exceptions**: `NotFoundException`, `InputValidationException`, `UnauthorizedException`, etc.
- **Content helper**: `contentJson(zodSchema)` wraps schemas for `application/json` content
- **Validated data**: `await this.getValidatedData<typeof this.schema>()` returns typed `{ params, query, body, headers }`
- **Raw data**: `await this.getUnvalidatedData()` returns data before Zod defaults are applied

## Package Contents for AI

This package includes source code and documentation to help AI tools understand the library:

- `AGENTS.md` — Comprehensive development guide: architecture, patterns, migration notes, testing
- `skills/write-endpoints/SKILL.md` — Step-by-step coding skill for building endpoints with chanfana
- `docs/` — Full user documentation (VitePress markdown)
- `src/` — TypeScript source code for all modules

## Documentation

- Homepage: https://chanfana.pages.dev
- GitHub: https://github.com/cloudflare/chanfana
- Getting Started: docs/getting-started.md
- Defining Endpoints: docs/endpoints/defining-endpoints.md
- Auto CRUD Endpoints: docs/endpoints/auto/base.md
- D1 Database Endpoints: docs/endpoints/auto/d1.md
- Error Handling: docs/error-handling.md
- Migration Guide: docs/migration-to-chanfana-3.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.