sairam0424/mindforge/audit-logging

Claude Code and agent skill by sairam0424/mindforge

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Install

npx vskill@latest install sairam0424/mindforge/audit-logging

SKILL.md

The same SKILL.md was published earlier as sairam0424/mindforge/audit-logging.

Skill — Audit Logging

When this skill activates

Any task involving audit trails, compliance logging, change tracking, tamper detection, event recording for accountability, or data retention policies.

Mandatory actions when this skill is active

Before implementing audit logging
  1. Identify what events must be audited (regulatory + business requirements).
  2. Define the retention policy (how long, where stored, who can access).
  3. Design the event schema before writing any code.
Event schema (the 5 Ws)

Every audit event MUST capture:

FieldDescriptionExample
whouser_id, IP address, session_id, service account{ userId: "u-123", ip: "10.0.1.5", sessionId: "sess-abc" }
whataction performed, resource affected, changes made{ action: "update", resource: "user/u-456", changes: { email: { from: "old@x.com", to: "new@x.com" } } }
whenUTC timestamp, monotonic sequence number{ timestamp: "2025-01-15T10:30:00Z", sequence: 1042 }
whycorrelation_id, request_id, triggering event{ correlationId: "req-789", trigger: "user_request" }
outcomesuccess or failure, error details if failed{ status: "success" } or { status: "failure", error: "permission_denied" }
Immutability guarantees

Append-only storage:

  • Audit table has NO UPDATE or DELETE permissions for application roles.
  • Use a dedicated audit service account with INSERT-only grants.
  • Application database user must not have ALTER TABLE on audit tables.

Hash chain for tamper detection:

event.hash = SHA-256(event.data + previous_event.hash)
  • Each event references the hash of the previous event.
  • Broken chain = tampering detected.
  • Verify chain integrity on scheduled basis (daily audit job).

Alternative: immutable storage backends:

  • AWS QLDB (purpose-built immutable ledger).
  • Object storage with Object Lock (S3 with WORM).
  • Append-only Kafka topic with compaction disabled.
Retention policy
TierDurationStorageAccess
Hot90 daysPrimary database (indexed)Real-time query
Warm1 yearObject storage (Parquet/JSON)Query via data warehouse
Cold7+ yearsCompressed archive (Glacier/equivalent)Manual retrieval

Rules:

  • Define retention per event type (auth events may need longer than UI events).
  • Automate tier transitions (cron job moves hot → warm → cold).
  • Deletion must be cryptographic (delete encryption key, not data) for compliance.
  • Document retention policy in compliance documentation.
What to audit (mandatory events)

Authentication:

  • Login success and failure (with failure reason).
  • Logout.
  • Password change / reset.
  • MFA enrollment / removal.
  • Session creation and termination.

Authorization:

  • Permission grants and revocations.
  • Role assignments and removals.
  • Access denied events.

Data mutations:

  • Create, update, delete of business entities.
  • Bulk operations (with count and scope).
  • Data exports and downloads.

Admin actions:

  • Configuration changes.
  • User account management (create, disable, delete).
  • System setting modifications.

Failed access attempts:

  • Rate limit violations.
  • Invalid token usage.
  • Attempts to access other tenants' data.
Querying audit logs

Required indexes:

  • user_id — "show me everything user X did."
  • resource_id — "show me everything that happened to resource Y."
  • timestamp — "show me events in time range."
  • action — "show me all delete events."
  • correlation_id — "show me the full request chain."

Search capabilities:

  • Full-text search on action descriptions.
  • Filter by outcome (success/failure).
  • Aggregate by user, resource, or time window.
Implementation patterns

Middleware/interceptor approach:

Request → [Auth] → [Audit: log attempt] → Handler → [Audit: log outcome] → Response

Event-driven approach:

  • Domain events trigger audit entries asynchronously.
  • Decouples audit from business logic.
  • Risk: event loss if queue fails (use durable queue with DLQ).

Database trigger approach:

  • PostgreSQL triggers capture all changes automatically.
  • No application code needed — cannot be bypassed.
  • Downside: less context (no user_id unless set in session).
Anti-patterns
  • Logging sensitive data in audit trail (passwords, full credit card numbers).
  • Audit log in same table/database as business data (lifecycle coupling).
  • Synchronous audit blocking the business transaction.
  • No alerting on audit failures (silent data loss).
  • Audit logs accessible to the application for modification.

Self-check before task completion

  • [ ] Did I follow the mandatory actions for this skill?
  • [ ] Did I apply the patterns appropriate to the context?
  • [ ] Did I verify the implementation meets the criteria above?
  • [ ] Did I document decisions and trade-offs made?

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/sairam0424/mindforge/audit-logging/badge)](https://verified-skill.com/skills/sairam0424/mindforge/audit-logging)

Something wrong with this skill or its page? Tell us.