docs: make CLAUDE.md agent-agnostic and add AGENTS.md symlink (#666)

Rename title/intro to be generic, add a 'Verifying changes' section,
coding conventions, and an auto-generated files table. Add AGENTS.md
as a symlink to CLAUDE.md so other agents pick up the same guide.
This commit is contained in:
JC Brand 2026-03-20 12:28:04 +02:00 committed by GitHub
parent 368fa01c95
commit 72ff04e390
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 47 additions and 3 deletions

1
AGENTS.md Symbolic link
View file

@ -0,0 +1 @@
CLAUDE.md

View file

@ -1,6 +1,6 @@
# CLAUDE.md
# Agent Guide
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This file provides guidance to AI coding agents working with this repository.
## What is ThunderHub
@ -18,11 +18,27 @@ npm run lint:check # ESLint without fix (used in C
npm run test # Jest (rootDir: src/, matches *.spec.ts)
npm run test -- --testPathPattern="channels" # Run tests matching a pattern
npm run test:e2e # E2E tests (config: test/jest-e2e.json)
npm run generate # GraphQL codegen (server must be running at localhost:3000)
npm run generate # GraphQL codegen — requires server running at localhost:3000; not for CI
```
**Note:** Package manager is `npm`, not pnpm/yarn. Node version: see `.nvmrc`.
## Verifying changes
After making code changes, run these in order to confirm correctness:
```bash
npm run lint:check # Check for lint errors (no auto-fix)
npm run test # Run unit tests
npm run build # Confirm the full build succeeds
```
Run a targeted test when touching a specific module:
```bash
npm run test -- --testPathPattern="<module-name>"
```
## Architecture
Monorepo with two apps under `src/`:
@ -89,6 +105,7 @@ The `lightning` library returns errors as arrays `[title, string, { err }]`; `ln
## Pre-commit hooks
Husky runs `lint-staged` on commit for `*.ts` and `*.tsx` files:
1. `prettier --write`
2. `jest --bail --findRelatedTests --passWithNoTests`
3. `eslint --fix`
@ -96,3 +113,29 @@ Husky runs `lint-staged` on commit for `*.ts` and `*.tsx` files:
## Prettier config
Single quotes, trailing commas (es5), 2-space tabs, 80 char width, no parens on single arrow params. See `.prettierrc`.
## Coding conventions
### Server
- Use `toWithError<T>(promise)` (from `utils/async.ts`) for LND calls that may fail — returns `[data, undefined] | [undefined, error]`. Use `to<T>(promise)` when you want to throw on error.
- The `lightning` library errors are arrays; use the dedicated `to()` in `lnd.helpers.ts` (not the generic one) when wrapping raw `lnd` calls.
- Tests are co-located as `*.spec.ts` next to the file under test.
### Client
- New UI components must use **shadcn/ui** (New York style). Do not add new styled-components.
- Use the `@/` import alias for all client-side imports (maps to `src/client/src/`).
- Follow the dual-context pattern (`useXState()` / `useXDispatch()`) for new shared state.
- Icons: use **Lucide React** only.
## Auto-generated files — do not edit
The following files are generated automatically and must not be edited by hand:
| File/pattern | Generated by |
| --------------------------------------------------------- | -------------------------------------------- |
| `schema.gql` | NestJS GraphQL (code-first, on server start) |
| `src/client/src/graphql/**/__generated__/*.generated.tsx` | `npm run generate` (GraphQL codegen) |
To regenerate: start the dev server (`npm run start:dev`) then run `npm run generate`.