Conversation
|
I'll test this claude.md in Omgevingschat, and make changes accordingly :) |
maanlamp
left a comment
There was a problem hiding this comment.
I've not scrutinised this completely, but I saw two things that I thought didn't align with our dev approach.
I might have a more detailed look later if we think of more changes/additions
|
Yhea i wasn't a big fan of the claude.md Ivan suggested, it states things that the model already knows, and maybe its even too deep. https://www.humanlayer.dev/blog/writing-a-good-claude-md |
CLAUDE.mdCommands
Generated files in StackVite 7 + React 19 + TypeScript 5.9 (strict) + Zod 4. Bun as package manager. React Compiler is enabled — do not manually add ArchitectureKey patternsImportsPath alias import { useAuth } from "lib/auth";
import { Button } from "components/form";PagesEach page is a directory under
Pages are lazy-loaded via RoutingReact Router 7 with
Data fetchinghey-api generates a typed SDK from import { postApiAuthLogin, type ValidationError } from "lib/api/heyapi";
const { data, error } = await postApiAuthLogin({ body: { email, password } });For queries/mutations in components, use TanStack React Query (also generated by hey-api). The Auth token is injected via request middleware in FormsNo form library — use controlled inputs with backend validation: const [error, setError] = useState<ValidationError>();
// After API call:
if (error) setError(error);
// In JSX:
<Input isInvalid={!!error?.errors?.fieldName} />
<ErrorText>{error?.errors?.fieldName}</ErrorText>
Auth
Environment variablesDefined in import env from "env";
env.apiBaseUrl // typed and validatedPrefix with i18nAll user-facing text goes through const { t } = useTranslation();
t("pages.login.title")Translation files: Components
Formatting & lintingTwo tools with separate responsibilities:
Biome rules to know:
Pre-commit hooks via Lefthook run both Biome and Prettier on staged files. Rules
I think with this setup, claude wont get lost in its own claude.md, this is based on the example of Ivan, without repeating the same things multiple times, and also bit more template specific. The philosophy
|
|
Forgive my absolute lack of knowledge on this part of the whole AI thing, but reading those best practises, would it be useful to separate the file into skills instead? Or should we find some that others made that do a better job? I'm thinking the Idk if they're even applicable here 🙃 |
claude.md gets referenced in every turn, its useful for easy stuff like architecture choices and other stuff, indeed stuff about typescript, react etc.. could be done in skills and invoked when needed! |
|
Well, one key paragraph from the article you linked stated:
That sounds exactly like what we're trying to do, cramming all of these specific sections into the general CLAUDE.md, no? That means we're actively pushing Claude to ignore our instructions by expanding on it 🤔 |
|
Update: I tried this out in Phase2. My primary findings:
With those findings in mind, we updated the md file to the following: # CLAUDE.md
You are working in a production TypeScript + React repository. Make safe, minimal, maintainable changes that fit the existing architecture.
**Primary rule**: before changing code, read the surrounding files and follow the patterns already present. Prefer the pattern used closest to the code you are editing.
---
## Stack
| Concern | Tool |
| --------------- | ------------------------------------------------------------------- |
| Package manager | `bun` |
| Build | Vite |
| Framework | React 19 + TypeScript 5 |
| Routing | `react-router-dom` v6 |
| Data fetching | `openapi-fetch` + `openapi-react-query` + TanStack Query v5 |
| API types | Generated — `src/lib/schema.gen.d.ts` + `src/lib/validators.gen.ts` |
| Forms | `react-zorm` + `zod` |
| UI primitives | `@base-ui/react` |
| Styling | CSS Modules + SCSS (`sass-embedded`) |
| i18n | `i18next` + `react-i18next` |
| Testing | Playwright |
---
## Verification
Before finishing any task, run in order:
```
bun check:types # Check types with tsc
bun fix # Fixes all formatting issues with oxfmt
```
Never bypass hooks or suggest `--no-verify`.
---
## UI primitives — base-ui
Before implementing any interactive widget (dialog, popover, menu, select, checkbox, slider, tooltip, etc.), fetch `https://base-ui.com/llms.txt` and use the relevant `@base-ui/react` primitive. Do not hand-roll accessible widgets.
---
## Generated files
Do not edit these manually:
- `src/lib/schema.gen.d.ts` + `src/lib/validators.gen.ts` — regenerate with `bun setup:all`
- `*.module.scss.d.ts` — generated automatically by the build tool from CSS Modules; do not create or modify these files
---
## TypeScript
- No `any`
- No casts — help the compiler infer correctness through runtime logic. If a third-party type makes this impossible, cast with a comment explaining why. Last resort only.
- No non-null assertions — prefer type guards and narrowing
- No duplicate type definitions — reuse exported types from API, hooks, or shared modules
- Add JSDoc to util functions you create, including at least one example. Add docs to existing util functions you edit that are missing them. Keep types in typescript.
---
## React
- Extract into subcomponents or hooks when a component exceeds ~150–200 LOC
- No global state for local UI concerns
- No `useEffect` for logic that can run during render, in event handlers, or as derived/memoized values
- No `useMemo` / `useCallback` unless solving a real referential stability or performance problem
- No hardcoded user-facing copy — use i18n keys
---
## Data fetching
- Use the existing `openapi-react-query` / TanStack Query patterns
- Always handle loading, empty, and error states
- Never hardcode URLs, tokens, or environment-specific values
---
## Scope
- Change only what is necessary for the requested outcome
- Do not refactor files you are not already modifying
- Do not add dependencies unless clearly necessary — prefer what is already in `package.json`
- Do not add comments unless the _why_ is non-obvious to a future reader |
|
WIP: made agreed on changes, but needs to be merged with the other claude file that was introduced with other PRs |
Suggestion by Ivan, let's make it nice and merge.
Part of #42