Use when implementing the Detective Agent BE FastAPI service with deterministic rule engine, safe public payloads, event processing, SSE, clean code, and structured observability.
설치
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
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.