claude-code-hub
CLAUDE.md3.4k starsChanged 4 months agoMITView on GitHub
IMPORTANT: Never create SQL migration files manually. Always follow this workflow:
- Reads credentials
Trending
Quiet since June.thin dataabout the whole repository
Who's talking about ding113/claude-code-hub
- NookMux/NookMux“feat: UA限制等”GitHub · Jun 15, 2026
- kittors/CliRelay“用量日志中 `codex-auto-review` 的模型强制记录为 `gpt-5.5`,与上游实际返回的 `gpt-5.4` 不一致”GitHub · May 28, 2026
- DaoCloud/public-image-mirror“请求添加cch镜像”GitHub · Mar 31, 2026
- qixing-jk/all-api-hub“[Feature]: 支持管理自建的 claude code hub”GitHub · Feb 14, 2026
The biggest 4 of 4 mentions linking to the repository that our crawl found. Each line is their own headline.
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
We split this CLAUDE.md into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
No Emoji in Code: - Never use emoji characters in any code, comments, or string literals
- Distinctive: line 13
Test Coverage: - All new features must have unit test coverage of at least 80%
- Distinctive: line 14
i18n Required: - All user-facing strings must use i18n (5 languages supported).
- Distinctive: line 15
Pre-commit Checklist: - Before committing, always run:
- Distinctive: line 55
IMPORTANT: Never create SQL migration files manually.
- Very specific: line 58
Generate migration: - Run bun run db:generate
- Very specific: line 59
Review generated SQL: - Check the generated file in drizzle/ directory
- Very specific: line 61
Apply migration: - Run bun run db:migrate or let AUTO_MIGRATE=true handle it on startup
- Distinctive: line 131
Exports: Prefer named exports over default exports
- Very specific: line 132
i18n: Use next-intl for internationalization (5 languages: zh-CN, zh-TW, en, ja, ru)
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md 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.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Repository Info
- Source: https://github.com/ding113/claude-code-hub
- PR Target Branch:
dev(all pull requests must target the dev branch)
Critical Rules
- No Emoji in Code - Never use emoji characters in any code, comments, or string literals
- Test Coverage - All new features must have unit test coverage of at least 80%
- i18n Required - All user-facing strings must use i18n (5 languages supported). Never hardcode display text
- Pre-commit Checklist - Before committing, always run:
bun run build # Production build bun run lint # Biome check bun run lint:fix # Biome auto-fix bun run typecheck # TypeScript check (uses tsgo) bun run test # Run Vitest tests
Build & Development Commands
# Development
bun install # Install dependencies
bun run dev # Run tsgo preflight, then start dev server (port 13500)
# Build & Production
bun run build # Run tsgo preflight, then build for production
bun run start # Start production server
# Quality Checks
bun run typecheck # Type check with tsgo (faster)
bun run lint # Lint with Biome
bun run lint:fix # Auto-fix lint issues
bun run format # Format code
# Testing
bun run test # Run unit tests (vitest)
bun run test:ui # Interactive test UI
bun run test:coverage # Coverage report
bunx vitest run <file> # Run single test file
bunx vitest run -t "test name" # Run specific test
# Dev environment (via dev/Makefile)
cd dev && make dev # Start all services (PG + Redis + app)
cd dev && make db # Start only database servicesDatabase Migration Workflow
IMPORTANT: Never create SQL migration files manually. Always follow this workflow:
- Modify schema - Edit
src/drizzle/schema.ts - Generate migration - Run
bun run db:generate - Review generated SQL - Check the generated file in
drizzle/directory - Edit if necessary - Make any required adjustments to the generated SQL
- Apply migration - Run
bun run db:migrateor letAUTO_MIGRATE=truehandle it on startup
bun run db:generate # Generate Drizzle migrations from schema changes
bun run db:migrate # Apply migrations
bun run db:push # Push schema changes (dev only)
bun run db:studio # Open Drizzle StudioArchitecture Overview
Tech Stack
- Framework: Next.js 16 (App Router) + Hono for API routes
- Database: PostgreSQL (Drizzle ORM) + Redis (ioredis)
- UI: React 19 + shadcn/ui + Tailwind CSS + Recharts
- Package Manager: Bun (1.3+)
- Testing: Vitest + happy-dom
Directory Structure
src/
├── app/
│ ├── [locale]/dashboard/ # Dashboard UI pages
│ ├── api/
│ │ ├── v1/ # REST management API + OpenAPI docs
│ │ └── actions/ # Legacy Server Action adapter (deprecated)
│ └── v1/ # Proxy API (Claude/OpenAI compatible)
│ └── _lib/
│ ├── proxy/ # Core proxy pipeline
│ ├── converters/ # Format converters (claude/openai/codex/gemini)
│ └── codex/ # Codex CLI adapter
├── actions/ # Server Actions reused by REST handlers
├── lib/ # Core business logic
│ ├── session-manager.ts # Session & context caching
│ ├── circuit-breaker.ts # Provider health management
│ ├── rate-limit/ # Multi-dimensional rate limiting
│ └── redis/ # Redis utilities
├── repository/ # Drizzle ORM data access layer
└── drizzle/
└── schema.ts # Database schema definitionCore Proxy Flow
The proxy pipeline (src/app/v1/_lib/proxy-handler.ts) processes requests through a guard chain:
Request -> GuardPipeline -> [auth -> sensitive -> client -> model -> version -> probe ->
session -> warmup -> requestFilter -> rateLimit ->
provider -> providerRequestFilter -> messageContext] ->
ProxyForwarder -> ProxyResponseHandler -> ResponseKey components:
- GuardPipeline (
guard-pipeline.ts): Configurable chain of request guards - ProxySession (
session.ts): Request context holder - ProxyForwarder (
forwarder.ts): Handles upstream API calls - ProviderResolver (
provider-selector.ts): Load balancing with weight/priority - Format Converters (
converters/): Bidirectional format translation
API Layer
- Proxy endpoints:
/v1/messages,/v1/chat/completions,/v1/responses - Management API:
/api/v1/*- RESTful management surface documented by OpenAPI - Legacy Management API:
/api/actions/{module}/{action}- Deprecated Server Action adapter, retained behindENABLE_LEGACY_ACTIONS_API - Docs:
/api/v1/scalar(Scalar UI),/api/v1/docs(Swagger),/api/v1/openapi.json - OpenAPI checks:
bun run test:v1,bun run openapi:check,bun run openapi:lint
Code Conventions
- Path alias:
@/maps to./src/ - Formatting: Biome (double quotes, trailing commas, 2-space indent, 100 char width)
- Exports: Prefer named exports over default exports
- i18n: Use
next-intlfor internationalization (5 languages: zh-CN, zh-TW, en, ja, ru) - Testing: Unit tests in
tests/unit/, integration intests/integration/, source-adjacent tests insrc/**/*.test.ts
Environment Variables
Critical variables (see .env.example for full list):
ADMIN_TOKEN: Admin login token (required)DSN: PostgreSQL connection stringREDIS_URL: Redis connection URLENABLE_RATE_LIMIT: Toggle rate limitingSESSION_TTL: Session cache TTL (default 300s)AUTO_MIGRATE: Auto-run migrations on startup
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
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.

