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
30
.claude/rules/13-logging-observability.md
Normal file
30
.claude/rules/13-logging-observability.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
paths:
|
||||
- "src/**/*.{ts,js,py,go,rs,dart,kt,java}"
|
||||
- "lib/**/*.{ts,js,py,go,rs,dart,kt,java}"
|
||||
- "app/**/*.{ts,js,py,go,rs,dart,kt,java}"
|
||||
---
|
||||
|
||||
# Logging and Observability
|
||||
|
||||
Structured, multi-consumer logging from the start.
|
||||
|
||||
## Architecture
|
||||
|
||||
- Terminal + OpenTelemetry (OTEL) output. Add syslog for daemons.
|
||||
- Structured logging (JSON or key-value) — no free-form strings.
|
||||
- App writes to stdout only (12-Factor XI). Environment handles routing.
|
||||
|
||||
## OpenTelemetry
|
||||
|
||||
- OTEL from the start unless user opts out. Traces, metrics, logs as three pillars — traces first for distributed systems, metrics first for monoliths.
|
||||
- Use `OTEL_EXPORTER_OTLP_ENDPOINT` env var — never hardcode endpoints.
|
||||
- Propagate trace context across service boundaries.
|
||||
- Use OTEL semantic convention attribute names (`http.request.method`, `url.path`, `http.response.status_code`).
|
||||
|
||||
## Rules
|
||||
|
||||
- Incoming requests: log method, path, status, duration, trace ID.
|
||||
- Outgoing calls: log target, method, status, duration, trace ID.
|
||||
- Errors: log operation, sanitized input, stack trace, trace ID.
|
||||
- Never log secrets, tokens, passwords, or PII.
|
||||
Loading…
Add table
Add a link
Reference in a new issue