add claude specific configuration and instruction

This commit is contained in:
2026-03-31 12:28:50 +02:00
parent 27de32ce9f
commit 49c2e0668d
5 changed files with 70 additions and 0 deletions

12
.claude/rules/testing.md Normal file
View File

@@ -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<T>()` 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`

23
.claude/settings.json Normal file
View File

@@ -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
}
]
}
]
}
}

27
.claudeignore Normal file
View File

@@ -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

4
.gitignore vendored
View File

@@ -37,3 +37,7 @@ testem.log
# System Files # System Files
.DS_Store .DS_Store
Thumbs.db Thumbs.db
# Claude Code personal config
CLAUDE.local.md
.claude/settings.local.json

View File

@@ -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. 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 ## Test Conventions
There are two parallel test systems: There are two parallel test systems: