Skip to content

Commit e9be5d1

Browse files
authored
Inline TS rules into AGENTS.md, allow some of the tools (#259)
Context: https://prisma-company.slack.com/archives/C058YK1BRPC/p1774522552653279 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated development tooling configuration to support expanded build, test, and linting command workflows. * Enhanced type safety guidelines and shell environment requirements for development consistency. * Removed deprecated configuration rule file. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 6dbefe7 commit e9be5d1

3 files changed

Lines changed: 33 additions & 25 deletions

File tree

.claude/settings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@
1717
"Bash(grep:*)",
1818
"Bash(wc:*)",
1919
"Bash(cat:*)",
20+
"Bash(jq:*)",
2021
"Skill(bumping-biome)",
2122
"Bash(pnpm list:*)",
2223
"mcp__ide__getDiagnostics",
2324
"Skill(tsdown-package)",
2425
"Bash(ls:*)",
25-
"Bash(pnpm build:*)",
26+
"Bash(pnpm build*)",
27+
"Bash(pnpm test:*)",
28+
"Bash(pnpm lint:*)",
29+
"Bash(pnpm test:packages:*)",
30+
"Bash(pnpm typecheck:*)",
31+
"Bash(pnpm lint:deps:*)",
2632
"Bash(gh pr view:*)"
2733
],
2834
"deny": [],

.cursor/rules/use-correct-tools.mdc

Lines changed: 0 additions & 23 deletions
This file was deleted.

AGENTS.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,37 @@ Welcome. This is a contract‑first, agent‑friendly data layer.
3030
## Golden Rules
3131

3232
- **Node.js version**: Use the shell's Node. Do not run nvm/fnm or any version switcher. Source of truth is root `package.json` `engines.node`. If the shell's version is wrong or commands fail, report that the shell is misconfigured and the user should configure their environment to satisfy `engines.node`.
33-
- Use pnpm and local scripts (not ad‑hoc `tsc`, `jest`): `.cursor/rules/use-correct-tools.mdc`
33+
- Use `pnpm` not `npm`!
34+
- The source of truth for the required Node version is the root `package.json` `engines.node` field.
35+
- Never use `npx`
36+
- If the shell's `node -v` does not satisfy that, or Node/pnpm commands fail due to version, report:
37+
"Your shell is misconfigured for this repo. Configure your environment so that `node`
38+
resolves to a version that satisfies the root package.json engines.node (e.g. set your
39+
default Node in your version manager, or use Volta)."
40+
- We use turborepo to build, generally. `pnpm build` scripts are available in each package which delegate to turborepo
41+
- If you change exported types in a workspace package consumed by other packages/examples, run that package's `pnpm build` to refresh `dist/*.d.mts` declarations before validating downstream TypeScript usage.
42+
- When you want to typecheck, use the local `pnpm typecheck` scripts instead of writing `tsc` commands from scratch
43+
- When you want to test, use the local `pnpm test` scripts. For coverage, use `pnpm test:coverage` (all packages) or `pnpm coverage:packages` (packages only, excludes examples)
44+
- Use arktype instead of zod
45+
- Never add file extensions to imports in TypeScript
46+
- Don't add comments if avoidable, prefer code which expresses its intent
47+
- Don't add exports for backwards compatibility unless requested to do so
48+
- Always write tests before creating or modifying implementation
49+
- Do not reexport things from one file in another, except in the `exports/` folders
3450
- Don't branch on target; use adapters: `.cursor/rules/no-target-branches.mdc`
3551
- Keep tests concise; omit "should": `.cursor/rules/omit-should-in-tests.mdc`
3652
- Keep docs current (READMEs, rules, links): `.cursor/rules/doc-maintenance.mdc`
3753
- Prefer links to canonical docs over long comments
3854

55+
## Typesafety rules
56+
- Never use `any` type
57+
- Never use `@ts-expect-error` outside of negative type tests
58+
- Never use `@ts-nocheck`
59+
- Never suppress biome lints
60+
- Try to minimize type casts. Instead, prefer explicit types that would make type casts unnecessary. If type cast is unavoidable, try to minimize its scope — never cast
61+
entire object/class when casting one property would suffice.
62+
- `as unknown as SomeOtherType` type cast should be used only as a last resort and should always be accompanied by a comment explaining why it is necessary.
63+
3964
## Common Commands
4065

4166
```bash

0 commit comments

Comments
 (0)