From 49c2e0668d91dcf942d1d5a7cef1aa25326f170e Mon Sep 17 00:00:00 2001 From: Andreas Bertsch Date: Tue, 31 Mar 2026 12:28:50 +0200 Subject: [PATCH] add claude specific configuration and instruction --- .claude/rules/testing.md | 12 ++++++++++++ .claude/settings.json | 23 +++++++++++++++++++++++ .claudeignore | 27 +++++++++++++++++++++++++++ .gitignore | 4 ++++ CLAUDE.md | 4 ++++ 5 files changed, 70 insertions(+) create mode 100644 .claude/rules/testing.md create mode 100644 .claude/settings.json create mode 100644 .claudeignore diff --git a/.claude/rules/testing.md b/.claude/rules/testing.md new file mode 100644 index 0000000..1a217dc --- /dev/null +++ b/.claude/rules/testing.md @@ -0,0 +1,12 @@ +--- +paths: ["**/*.spec.ts", "**/*.type-spec.ts"] +--- + +# Test Conventions + +- **`*.spec.ts`** — runtime tests. Use Arrange/Act/Assert with `describe`/`it` blocks. +- **`*.type-spec.ts`** — compile-time type tests. Use `expectTypeOf(x).toEqualTypeOf()` from expect-type. +- Tests live in `spec/` directories next to the module, one file per operation (e.g., `map.spec.ts`). +- When adding a new method, create both a `*.spec.ts` and `*.type-spec.ts` for it. +- Run runtime tests: `pnpm test -- src/{module}/spec/{file}.spec.ts` +- Run type tests: `pnpm test:types` diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..7eca3f9 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,23 @@ +{ + "permissions": { + "deny": [ + "Read(.env*)", + "Read(**/*.pem)", + "Read(**/*.key)" + ] + }, + "hooks": { + "PostToolUse": [ + { + "matcher": "Write|Edit|MultiEdit", + "hooks": [ + { + "type": "command", + "command": "filepath=$(jq -r '.tool_input.file_path // .tool_input.path // empty' /dev/stdin) && [ -n \"$filepath\" ] && pnpm exec prettier --write \"$filepath\" 2>/dev/null && [[ \"$filepath\" =~ \\.(ts|tsx|js|jsx)$ ]] && pnpm exec eslint --fix \"$filepath\" 2>/dev/null || true", + "timeout": 25 + } + ] + } + ] + } +} diff --git a/.claudeignore b/.claudeignore new file mode 100644 index 0000000..01fe825 --- /dev/null +++ b/.claudeignore @@ -0,0 +1,27 @@ +# Dependencies +node_modules/ + +# Build output +dist/ + +# Test coverage +coverage/ + +# Lock files +*.lock +pnpm-lock.yaml + +# Caches +.eslintcache + +# Temporary +tmp/ + +# IDE +.idea/ +.vscode/ +*.swp + +# OS +.DS_Store +Thumbs.db diff --git a/.gitignore b/.gitignore index 4091d0a..a58bde4 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,7 @@ testem.log # System Files .DS_Store Thumbs.db + +# Claude Code personal config +CLAUDE.local.md +.claude/settings.local.json diff --git a/CLAUDE.md b/CLAUDE.md index 4e26416..f273500 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -47,6 +47,10 @@ Each module (`src/result/`, `src/option/`, `src/query/`) follows the same patter The three types are independent modules with no cross-type conversions. Users convert via `match()` if needed. +**IMPORTANT: Banned method names.** Never suggest, generate, or reference these Rust/Haskell/FP idioms — they do not exist in this library and must not be proposed as additions: +`unwrap`, `unwrapOr`, `unwrapOrElse`, `expect`, `or`, `orElse`, `and`, `andThen`, `inspect`, `getOrElse`, `fold`, `contains`, `zip`, `unzip`, `transpose`. +Use `match()` for value extraction and `map()`/`flatMap()` for chaining. Only use methods defined in the interfaces. + ## Test Conventions There are two parallel test systems: