Use when implementing the Detective Agent BE FastAPI service with deterministic rule engine, safe public payloads, event processing, SSE, clean code, and structured observability.
Installation
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Use when implementing the Detective Agent BE FastAPI service with deterministic rule engine, safe public payloads, event processing, SSE, clean code, and structured observability.
Build the Backend as the single source of truth for sessions, case visibility, deterministic rule verdicts, unlocks, event processing, and FE-facing contracts.
Must Preserve
Natural-language dialogue UI, internally mapped to case graph and allowed statements.
AI is advisory: text + proposedEvents[]; BE validates state changes.
Public payloads must never expose secret, solution, isCulprit, private motives, or hidden timeline entries.
Same state and same submitted IDs must produce the same contradiction/accusation verdict.
Development Flow
Read AGENTS.md, Docs/implementation.md, ../PRD.md, and ../Docs/structure-audit.md.
Inspect the route/schema/domain files touched by the requested change.
Update schemas first when contracts change.
Put rule logic in domain services, not routes.
Add/adjust tests for public payload secrecy, deterministic verdict, and event emission.
Run pytest -q before reporting done.
Observability Checklist
Request ID middleware exists or is introduced before broad logging.
Logs include service, request_id, session_id, case_id, route, duration_ms where applicable.
Rule decisions log verdict/reason codes, not secret solution text.
AI fallback and rejected events are WARNING level.
SSE replay/reconnect logs last_event_id and emitted event count.
Code Smell Guardrails
No route handler should perform deep case graph traversal inline.
No duplicated hidden-field filtering across many endpoints; centralize view builders.
No LLM-generated verdicts or unlocks.
No broad except Exception: pass; fallback paths must log why.
No tests that require special PYTHONPATH; plain pytest -q should pass.