build-audit-logs
SKILL.md
Build or Review an Audit System with evlog
For application developers who either need to add an audit trail to their product, or who already have one and want it reviewed. Walks through the design calls, the end-to-end implementation, and a review checklist for an existing setup.
This skill assumes the audit lives in your app. To extend the evlog package itself (new audit helper, new drain wrapper), see the contributor skills under .agents/skills/.
Quick reference — call-site cheat sheet
When you already know the system is wired and just need to remember the API:
| Situation | Helper |
|---|---|
| Inside a request handler, action succeeded | log.audit({ action, actor, target, outcome: 'success' }) |
| Inside a request handler, AuthZ denial | log.audit.deny('reason', { action, actor, target }) |
| Standalone job / script / CLI (no request) | audit({ action, actor, target, outcome }) |
| Auto-record success / failure / denied for a function | withAudit({ action, target }, fn) |
| Recording a state change | add changes: auditDiff(before, after) |
| Centralised typed action vocabulary | defineAuditAction('invoice.refund', { target: 'invoice' }) |
| Asserting audits in tests | mockAudit() |