audit-trail-design
Skill0 starsChanged 6 months agoApache-2.0View on GitHub
Use when designing audit logging systems for accountability and compliance evidence. Covers event catalogs, log schemas, retention policies, immutability requirements, and compliance reporting. Do not use for regulatory gap analysis (use compliance-review) or data sensitivity classification (use data-classification).
In this repository65 other files it gives its agents.
- a11y-auditSkill
- i18n-reviewSkill
- interaction-designSkill
- journey-mappingSkill
- ml-workflowSkill
- pipeline-designSkill
- schema-evaluationSkill
- api-designSkill
- codebase-contextSkill
- distributed-patternsSkill
- schema-designSkill
- design-system-architectureSkill
- motion-designSkill
- visual-auditSkill
- adr-templateSkill
- changelog-designSkill
- documentation-planSkill
- crypto-reviewSkill
- pqc-readinessSkill
- protocol-analysisSkill
- e2e-testingSkill
- pattern-analysisSkill
- testing-strategySkill
- finance-close-checklistSkill
- finance-controls-auditSkill
- finance-journal-entriesSkill
- finance-reconciliationSkill
- finance-tax-researchSkill
- finance-variance-analysisSkill
- compliance-reviewSkill
- data-classificationSkill
- growth-engineeringSkill
- messaging-strategySkill
- monetization-designSkill
- cost-analysisSkill
- deployment-planSkill
- finops-analysisSkill
- observability-designSkill
- ai-evaluationSkill
- prompt-engineeringSkill
- rag-architectureSkill
- device-integrationSkill
- navigation-designSkill
- platform-auditSkill
- formal-specSkill
- invariant-analysisSkill
- competitive-analysisSkill
- enterprise-search-strategySkill
- library-evaluationSkill
- technology-radarSkill
- embedded-architectureSkill
- fleet-managementSkill
- protocol-designSkill
- edge-case-enumerationSkill
- failure-mode-analysisSkill
- threat-modelSkill
- analytics-designSkill
- impact-estimationSkill
- mvp-scopingSkill
- caching-strategySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
No user-provided values are used in commands or file paths.
- Distinctive: line 52
Data access events: Read access to Restricted/Confidential data, bulk exports, API queries returning PII
- Very specific: line 53
Data mutation events: Create/update/delete of sensitive records, schema migrations, bulk operations
- Distinctive: line 77
Ensure audit records cannot be tampered with after creation:
- Distinctive: line 82
Tamper evidence: If a record is modified or deleted, the system must detect and alert
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Audit Trail Design
Purpose
Design audit logging systems that provide accountability, traceability, and compliance evidence. Produce event catalogs, log schemas, and retention policies that satisfy regulatory requirements and support forensic investigation.
Scope Constraints
Reads system architecture, regulatory requirements, and data classification outputs for audit design. Does not implement logging infrastructure or access production log stores.
Inputs
- System architecture and services to be audited
- Regulatory requirements (from compliance review if available)
- Data classification (which data elements are Confidential/Restricted)
- User roles and access control model
- Existing logging infrastructure and constraints
Input Sanitization
No user-provided values are used in commands or file paths. All inputs are treated as read-only analysis targets.
Procedure
Progress Checklist
- Step 1: Identify auditable events
- Step 2: Define log schema
- Step 3: Specify retention policies
- Step 4: Design immutability requirements
- Step 5: Plan access controls for audit data
- Step 6: Define compliance reporting
Step 1: Identify Auditable Events
Catalog every event that must be recorded for compliance, security, or operational accountability:
- Authentication events: Login success/failure, logout, session creation/expiry, MFA challenges, password changes
- Authorization events: Permission grants/revocations, role changes, access denied events
- Data access events: Read access to Restricted/Confidential data, bulk exports, API queries returning PII
- Data mutation events: Create/update/delete of sensitive records, schema migrations, bulk operations
- Consent events: Consent granted/modified/withdrawn, privacy preference changes
- Administrative events: Configuration changes, feature flag toggles, deployment events, user account management
- Compliance events: Data subject requests (access, erasure, portability), breach detection, regulatory submissions
Step 2: Define Log Schema
Design a consistent schema that answers who/what/when/where/why for every event:
- who: Actor identity (user ID, service account, API key ID). Never log credentials or tokens.
- what: Event type (enum), action performed, resource affected (type + ID), before/after state for mutations
- when: Timestamp in UTC (ISO 8601), with millisecond precision. Clock synchronization requirements.
- where: Service name, instance ID, request ID (correlation), source IP (masked per policy), geographic region
- why: Business context — the operation that triggered the event, request path, feature context
- outcome: Success/failure, error code if applicable, affected record count
Step 3: Specify Retention Policies
Define retention based on regulatory and business requirements:
- Regulatory minimums: HIPAA (6 years), SOC2 (1 year), PCI-DSS (1 year), financial regulations (5-7 years)
- Tiered retention: Hot storage (fast query, 90 days) -> Warm storage (indexed, 1 year) -> Cold storage (archived, regulatory maximum)
- Deletion policy: Audit logs of deleted user data must be retained for compliance even after user data deletion
- Cost modeling: Estimate storage costs per tier and growth rate
Step 4: Design Immutability Requirements
Ensure audit records cannot be tampered with after creation:
- Write-once storage: Append-only log stores, WORM storage for compliance
- Integrity verification: Hash chaining or Merkle trees to detect tampering or gaps
- Separation of duties: Audit log administrators cannot modify log contents
- Tamper evidence: If a record is modified or deleted, the system must detect and alert
Step 5: Plan Access Controls for Audit Data
Define who can access audit records and under what circumstances:
- Read access: Security team (full), compliance officers (filtered), engineering (operational only, no PII)
- Export controls: Bulk export requires approval, exports are themselves audited
- PII in audit logs: Mask or encrypt PII fields; provide decryption only for authorized investigations
- Cross-team access: Support/customer success may need filtered views — define scope limits
Step 6: Define Compliance Reporting
Specify the reports and dashboards that audit data must support:
- Regulatory reports: Data subject access requests, breach timeline reconstruction, consent audit trail
- Operational dashboards: Failed authentication trends, unusual access patterns, bulk export monitoring
- Periodic evidence: SOC2 control evidence, HIPAA access review reports, PCI-DSS log review evidence
- Alerting: Real-time alerts for high-severity events (mass data export, privilege escalation, repeated auth failures)
Compaction resilience: If context was lost during a long session, re-read the Inputs section to reconstruct what system is being analyzed, check the Progress Checklist for completed steps, then resume from the earliest incomplete step.
Output Format
Event Catalog
| Event Category | Event Type | Trigger | Data Captured | Retention Tier |
| Authentication | login_success | User login | user_id, timestamp, IP, method | Hot 90d → Cold 1y |
| Authentication | login_failure | Failed login | attempted_user, timestamp, IP, reason | Hot 90d → Cold 1y |
| Data Access | pii_read | PII field accessed | user_id, accessor_id, field, purpose | Hot 90d → Cold 7y |
| Consent | consent_granted | User gives consent | user_id, purpose, scope, version, timestamp | Hot 90d → Cold 7y |
| ... | ... | ... | ... | ... |
Log Schema
{
"event_id": "uuid-v4",
"event_type": "enum(event_catalog)",
"timestamp": "2024-01-15T10:30:00.000Z",
"actor": {
"type": "user|service|system",
"id": "user_123",
"ip": "192.168.x.x",
"session_id": "sess_abc"
},
"resource": {
"type": "user|record|config",
"id": "res_456",
"field": "email"
},
"action": "read|create|update|delete|grant|revoke",
"outcome": "success|failure",
"context": {
"service": "user-service",
"request_id": "req_789",
"region": "us-east-1"
},
"metadata": {}
}Retention Policy
| Tier | Storage Type | Duration | Query SLA | Cost Model |
| Hot | Primary database / search index | 90 days | < 1s | $$$ |
| Warm | Indexed archive | 1 year | < 30s | $$ |
| Cold | Object storage (compressed) | Regulatory max (up to 7y) | Minutes | $ |
Access Control Matrix
| Role | Read Events | Search PII Fields | Export | Admin |
| Security Team | All | Yes | With approval | No |
| Compliance Officer | All | Yes (masked) | With approval | No |
| Engineering | Operational only | No | No | No |
| Audit Log Admin | Metadata only | No | No | Yes (config, not content) |
Handoff
- Hand off regulatory compliance gaps discovered during audit design to compliance-review for full gap analysis.
- Hand off data sensitivity questions to data-classification if audit events contain unclassified data elements.
Quality Checks
- Every auditable event category is represented in the event catalog
- Log schema captures who/what/when/where/why for every event type
- Retention policies reference specific regulatory requirements with durations
- Immutability controls prevent tampering and detect gaps in the audit trail
- PII within audit logs is masked or encrypted with controlled decryption
- Access control matrix defines least-privilege access for every role
- Compliance reporting covers all required regulatory evidence outputs
- Alerting is defined for high-severity events requiring real-time response
Evolution Notes
<!-- Observations appended after each use -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

