chore: add 17 operational rules and rule index
- Create .claude/rules/ with all 17 standard rule files (01-security through 17-document-imports) - Add Operational Rules section with Rule Index to .claude/CLAUDE.md
This commit is contained in:
parent
afc5a7f895
commit
b659a6a6bd
18 changed files with 373 additions and 0 deletions
13
.claude/rules/02-error-handling.md
Normal file
13
.claude/rules/02-error-handling.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Error Handling (PARAMOUNT)
|
||||
|
||||
Every error must be handled explicitly. Silent failures are the most dangerous bugs.
|
||||
|
||||
## Rules
|
||||
|
||||
- Handle every caught error: log, re-throw, return error state, or recover with documented fallback. Empty catch blocks are forbidden.
|
||||
- Catch specific exceptions, not blanket `catch (e)`. Propagate errors to the level that can meaningfully handle them.
|
||||
- Async: handle both success and failure paths. No unhandled rejections or fire-and-forget.
|
||||
- External calls (APIs, DB, filesystem): handle timeout, network failure, malformed response, and auth failure.
|
||||
- Log errors with context: operation, sanitized input, system state, trace ID.
|
||||
- Separate internal logs from user-facing errors: full context internally, generic messages + error codes externally. Never expose stack traces or internal paths in responses (CWE-209).
|
||||
- Never log credentials, tokens, PII, or session IDs (CWE-532).
|
||||
Loading…
Add table
Add a link
Reference in a new issue