backend-audit-logging
Use when the user asks about audit logs, audit trail, who changed what, tamper-evident or append-only logs, hash chains, SOC 2 audit evidence or change…
от j4flmao★ 47 звёзд на GitHub
Установить backend-audit-logging в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Backend Audit Logging
Purpose
Record every sensitive data access and state change in an immutable, tamper-evident audit trail for regulatory compliance (SOC 2, SOX, HIPAA, GDPR).
Agent Protocol
Trigger
Exact user phrases: "audit log", "audit trail", "compliance logging", "tamper-evident log", "immutable log", "audit table", "change tracking", "who changed what", "data provenance", "audit events", "reporting log".
Input Context
- Regulatory framework (SOC 2, SOX, HIPAA, GDPR, PCI-DSS).
- Data classification and sensitive fields.
- Existing database and storage infrastructure.
- Retention requirements.
Output Artifact
Audit log schema or implementation code. No file unless requested.
Response Format
Event: {event type}
Actor: {user/system}
Resource: {resource type}:{id}
Action: {read|create|update|delete}
Completion Criteria
- Audit events recorded for all sensitive operations
- Audit log is append-only (immutable)
- Tamper evidence implemented (hash chain or similar)
- Retention policy configured
- Audit logs queryable by actor, resource, and time range
Architecture Decision Trees
Storage Backend Decision Tree
What is the primary compliance requirement?
├── SOC 2 / SOX → PostgreSQL with hash chain (append-only table, partition by month)
├── HIPAA → Encrypted database with strict access controls + hash chain + 6-year retention
├── GDPR → Searchable storage with data deletion capability (anonymization, not deletion)
├── PCI-DSS → Immutable log with strict access controls, 1-year retention, quarterly review
└── General compliance → Cloud-native audit service (AWS CloudTrail, Azure Monitor)
What is the write volume?
├── < 1000 events/sec → Relational database (PostgreSQL, MySQL) with hash chain
├── 1000–10000 events/sec → Time-series database (TimescaleDB, ClickHouse)
└── > 10000 events/sec → Log aggregator (Elasticsearch) + batched hash chain
Tamper Evidence Decision Tree
Is tamper evidence required by compliance framework?
├── Yes → Is regulatory framework HIPAA or PCI-DSS?
│ ├── Yes → Hash chain with periodic verification (quarterly) + external audit service
│ └── No → Hash chain (SHA-256 linked list) or digital signature per entry
└── No → Append-only table with database-level access controls (no hash chain needed)
Volume consideration:
├── Single DB (<1000/s) → Hash chain linking each row via previous_hash
├── Medium (1000–10000/s) → Batch Merkle tree, publish root hash periodically
└── High (>10000/s) → Periodic hash anchor (chain per batch, not per event)
Audit Event Schema Decision Tree
What needs to be recorded?
├── Just who did what? → Minimal: actor, action, resource, timestamp
├── Plus what changed? → Standard: + resource_id, changes (diff), metadata, correlation_id
├── Plus proof of integrity? → Complete: + previous_hash, hash, digital_signature
└── Multi-tenant? → Complete + tenant_id
Workflow
Step 1: Define Audit Events
events:
user.access: User accessed PII data
user.update: User profile updated
payment.process: Payment initiated or completed
role.change: User role or permission changed
data.export: Data exported (GDPR SAR)
data.deletion: Data deleted (right to be forgotten)
settings.change: System configuration changed
auth.login: User authentication succeeded
auth.logout: User session ended
auth.failed: Authentication failed
admin.action: Administrative action performed
integration.call: External API call made
data.masked: Sensitive data masked
consent.granted: User consent recorded
consent.revoked: User consent revoked
Step 2: Create Audit Table (PostgreSQL)
CREATE TABLE audit_log (
id BIGSERIAL PRIMARY KEY,
event_type VARCHAR(50) NOT NULL,
actor_id VARCHAR(100) NOT NULL,
actor_type VARCHAR(20) NOT NULL, -- 'user' | 'system' | 'api'
resource_type VARCHAR(50) NOT NULL,
resource_id VARCHAR(100),
action VARCHAR(10) NOT NULL, -- 'create' | 'read' | 'update' | 'delete'
changes JSONB, -- diff of old/new values
metadata JSONB, -- IP, user-agent, requestId
correlation_id VARCHAR(64), -- trace across services
occurred_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
hash VARCHAR(64), -- SHA-256 of previous row + this row data
previous_hash VARCHAR(64),
tenant_id VARCHAR(50), -- for multi-tenant systems
event_version INT DEFAULT 1
);
-- Prevent UPDATE/DELETE via trigger
CREATE OR REPLACE FUNCTION prevent_audit_mutation()
RETURNS TRIGGER AS $$
BEGIN
RAISE EXCEPTION 'Audit log is append-only. UPDATE and DELETE are not permitted.';
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER prevent_audit_update
BEFORE UPDATE ON audit_log
FOR EACH ROW EXECUTE FUNCTION prevent_audit_mutation();
CRE
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/audit-log-architecture.md
- references/audit-log-compliance.md
- references/audit-log-implementation.md
- references/audit-log-monitoring.md
- references/audit-log-storage-comparison.md
- references/audit-logging-advanced.md
- references/audit-logging-fundamentals.md
- references/audit-trail.md
- references/compliance-logging.md
FAQ
Что делает скилл backend-audit-logging?
Use when the user asks about audit logs, audit trail, who changed what, tamper-evident or append-only logs, hash chains, SOC 2 audit evidence or change tracking tables. Produces an immutable audit trail design and code. Not for application logs (use backend-structured-logging).
Как установить скилл backend-audit-logging?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл backend-audit-logging запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…