|
1 | | -# CLAUDE.md |
2 | | - |
3 | | -This is a starter kit for building a TypeScript application. |
| 1 | +# AGENTS.md |
4 | 2 |
|
5 | 3 | ## Commands |
6 | 4 |
|
7 | 5 | ```bash |
8 | | -bun install # Install dependencies |
9 | | -bun dev # Run application |
10 | | -bun run build # Build for production (tsdown/rolldown build) |
11 | | -bun test # Run tests (bun:test) |
12 | | - |
13 | | -bun run check # Run all checks (format, lint, typecheck, test) |
14 | | -bun run fix # Auto-fix format and lint issues |
15 | | -bun run typecheck # TypeScript type checking |
16 | | -bun run lint # Run oxlint with type-aware rules |
17 | | -bun run format # Run oxfmt formatter |
| 6 | +bun install # Install dependencies |
| 7 | +bun dev # Run application |
| 8 | +bun run build # Build for production |
| 9 | +bun test # Run tests (bun:test) |
| 10 | + |
| 11 | +bun check # Run all checks (format, lint, typecheck, test) |
| 12 | +bun fix # Auto-fix format and lint issues |
| 13 | +bun typecheck # TypeScript type checking |
| 14 | +bun lint # Run oxlint with type-aware rules |
| 15 | +bun format # Run oxfmt formatter |
18 | 16 | ``` |
19 | 17 |
|
20 | 18 | ## Coding Rules |
21 | 19 |
|
22 | 20 | - Use `bun` instead of `npm` or `pnpm` |
23 | | -- Use strict TypeScript with `bun:test` for testing |
24 | | -- NEVER cast with `any` |
25 | | -- AVOID inline type casting with `as` - use valibot or zod for runtime |
26 | | - validation |
| 21 | +- ALWAYS use strict TypeScript |
| 22 | +- Use `bun:test` for testing |
| 23 | +- ALWAYS document methods using TSDoc format with one newline after the |
| 24 | + description before the params |
| 25 | +- ALWAYS colocate tests with source |
| 26 | +- ALWAYS validate user input using `zod` |
| 27 | +- ALWAYS create new objects, never mutate. Immutability is important. |
| 28 | +- PREFER thin input layers (route handlers, input handler) which validate and |
| 29 | + delegate to services. |
| 30 | +- NEVER use `any` |
| 31 | +- AVOID mocking in tests. |
| 32 | +- AVOID inline type casting with `as`, use `zod` instead. |
27 | 33 | - AVOID unnecessary try/catch |
28 | | -- Document methods using TSDoc format with one newline after the description |
29 | | - before params |
30 | | -- Write tests first when fixing bugs or implementing features |
31 | | -- All changes automatically get formatted with `oxfmt` (no semis, doublequotes) |
| 34 | +- AVOID large files. Use many small files with high cohesion, low coupling, |
| 35 | + organized by feature/domain not by type. |
| 36 | + |
| 37 | +## Code Quality Checklist |
| 38 | + |
| 39 | +Before marking work complete: |
| 40 | + |
| 41 | +- [ ] Code is readable and well-named |
| 42 | +- [ ] Functions are small (<50 lines) |
| 43 | +- [ ] Files are focused (<800 lines) |
| 44 | +- [ ] No deep nesting (>4 levels) |
| 45 | +- [ ] Proper error handling |
| 46 | +- [ ] No console.log statements |
| 47 | +- [ ] No hardcoded values |
| 48 | +- [ ] No secrets |
| 49 | +- [ ] No mutation (immutable patterns used) |
0 commit comments