Production-ready Hono backend template that doubles as an AI agent harness — providing feedforward guides, feedback sensors, and progressive specialization to m
Production-ready Hono backend template that doubles as an AI agent harness — providing feedforward guides, feedback sensors, and progressive specialization to m
English | 简体中文
Production-ready Hono backend template that doubles as an AI agent harness — providing feedforward guides, feedback sensors, and progressive specialization to make AI coding agents reliably produce architecture-conformant code.
"The software engineering team's primary job is no longer to write code, but to design environments, specify intent, and build feedback loops." — OpenAI
Frontend admin panel based on Refine + Shadcn: https://github.com/zhe-qi/refine-project
Agent = Model + Harness — Birgitta Böckeler, Martin Fowler
An AI coding agent's reliability depends not on the model alone, but on the harness surrounding it: everything that steers the agent before it acts (Guides / Feedforward) and observes after it acts (Sensors / Feedback). This template is a project-level specialization layer — the bridge between generic AI capabilities and project-specific correctness.
| Harness Role | Component | What It Does |
|---|---|---|
| Guide (Feedforward) | CLAUDE.md |
Context engineering: rules, conventions, response patterns |
| Guide (Feedforward) | Skills (/crud, /db-schema, /bullmq, /drizzle-v1) |
Structured templates that pre-steer code generation |
| Guide (Feedforward) | OpenSpec (/opsx:propose → /opsx:apply) |
Planning layer: specs become the primary artifact |
| Guide (Feedforward) | Schema Pipeline (Drizzle → Zod → OpenAPI → Types) | Architectural constraints that narrow the solution space |
| Guide (Feedforward) | VSCode Snippets | IDE-level feedforward for manual coding |
| Sensor (Feedback) | TypeScript + tsgo | Compile-time type checking catches structural errors |
| Sensor (Feedback) | ESLint + nano-staged | Style and convention enforcement on every commit |
| Sensor (Feedback) | Vitest | Behavioral verification: does the code do what we intend? |
| Sensor (Feedback) | Casbin RBAC + Tier Routing | Permission guardrails: architecture-enforced boundaries |
Generic AI + blank project = high variance output. Specialized template + harness = predictable, architecture-conformant output.
The more you invest in specializing the harness (adding skills, refining CLAUDE.md, expanding tests), the more reliably the AI agent produces correct code. This applies to any AI coding agent — not just Claude Code.
/crud, /db-schema, /bullmq, /drizzle-v1 — pre-built templates that guide AI agents through standardized code generation/opsx:propose → /opsx:apply → /opsx:archive), turning specifications into the primary development artifactdefineConfig drives application assembly, defineMiddleware declares middleware chains, entry file stays minimalThis project provides two Drizzle ORM versions for you to choose from:
| Branch | Drizzle Version | Description |
|---|---|---|
main |
v1 (1.0.0-beta) | Latest version with Relations v2, through many-to-many, predefined filters |
drizzle-v0 |
v0 (0.x stable) | Stable version with classic Relations API, battle-tested |
# Use Drizzle v1 (default)
git clone https://github.com/zhe-qi/clhoria-template.git
# Use Drizzle v0 (stable)
git clone -b drizzle-v0 https://github.com/zhe-qi/clhoria-template.gitMigration Note: Drizzle v1 introduces breaking changes in the Relations API. See the Drizzle v1 migration guide for details.
Clone the repository
git clone https://github.com/zhe-qi/clhoria-template
cd clhoria-templateInstall dependencies
npm i -g corepack
pnpm installConfigure environment variables
cp .env.example .envInitialize database
# Start PostgreSQL service (optional, quickly set up PostgreSQL database in local Docker environment)
docker compose --env-file .env run -d --service-ports postgres
# Start Redis service (optional, quickly set up Redis in local Docker environment)
docker compose --env-file .env run -d --service-ports redisNote: If using Docker services above, update your
.envto uselocalhostinstead of container hostnames:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"REDIS_URL="redis://localhost:6379/0"
# Execute database migration (for rapid dev iteration use pnpm push directly, reserve generate and migrate for important milestones)
pnpm migrate
# Seed initial data (optional, app will auto-check and initialize on startup)
pnpm seedFor production deployment, use migration files instead of pnpm push:
pnpm generate # Generate migration files
pnpm migrate # Execute migrationspnpm devVisit to view the API documentation.
This project supports using the experimental ts-go to enhance TypeScript type checking and language service performance. At the current project scale, ts-go provides very significant performance improvements and the language service is relatively stable, so it is recommended.
Install the VSCode extension: TypeScript Native Preview
Note: Currently ts-go is only used for type checking and language service. Development and bundling are based on Vite (Rolldown).
Cache Issues: If you encounter TS service errors or type cache anomalies, use
Cmd + Shift + Pto open the command palette, typerestart, and find TypeScript: Restart TS Server to restart the TS service and restore normal operation.
Performance Tip: Zod has significant performance overhead on type services. ts-go notably improves this. If you can tolerate occasional cache issues, it is still recommended to use ts-go for a better development experience.
If you prefer not to use ts-go, follow these steps to revert:
"js/ts.experimental.useTsgo": true from .vscode/settings.jsonpnpm remove @typescript/native-previewtypecheck command in package.json, changing pnpm exec tsgo --noEmit to tsc --noEmitThis project combines Specification-Driven Development (SDD) with Test-Driven Development (TDD), orchestrated through the harness system. Specifications become the primary artifact; tests become the verification layer; code becomes an implementation detail.
SDD inverts the traditional development hierarchy — specifications define what before how. TDD adds a verification dimension — tests define _expected behavio
No open issues yet, or sync has not completed.