Token导航 LogoToken导航

Agent Skill · 开发

implementing-database-audit-logging(实施数据库审计日志记录)

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

implementing-database-audit-logging 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在开发类的 21,746 个 Skill 里排第 14,867。

总安装 654周安装 27GitHub Stars 2,061下载 214核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:implementing-database-audit-logging(实施数据库审计日志记录)
来源仓库:https://github.com/jeremylongshore/claude-code-plugins-plus-skills
仓库路径:skills/implementing-database-audit-logging
安装命令:
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill implementing-database-audit-logging
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill implementing-database-audit-logging

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

implementing-database-audit-logging 用于辅助数据库表结构、查询语句和迁移脚本编写,支持索引优化建议。适用于分析 schema、排查查询问题或生成数据维护方案等数据库任务。可编写 SQL 语句,但需明确数据库类型与连接环境,区分只读与分析操作。

安装命令为 npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill implementing-database-audit-logging。

涉及删除或更新操作时应优先 dry-run 或事务保护,避免误操作。

来源仓库内路径:skills/implementing-database-audit-logging

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skill…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

implementing-database-audit-logging 怎么安装?

在终端执行 npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

implementing-database-audit-logging 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

implementing-database-audit-logging 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

implementing-database-audit-logging 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

implementing-database-audit-logging 用的人多吗?

公开数据是累计安装 654 次,近一周安装 27 次,下载 214 次,GitHub 2,061 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

implementing-database-audit-logging 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 来源仓库有 2,061 星,维护活跃度相对可查。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
implementing-database-audit-logging

实施数据库审计日志记录 · 本页

6542,061接触敏感数据未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Database Audit Logger

Overview

Implement database audit logging to track all data modifications (INSERT, UPDATE, DELETE) with full before/after values, user identity, timestamps, and application context. This skill supports trigger-based auditing for PostgreSQL and MySQL, change data capture (CDC) patterns, and application-level audit logging.

Prerequisites

  • Database credentials with CREATE TABLE, CREATE FUNCTION, and CREATE TRIGGER permissions
  • psql or mysql CLI for executing audit setup DDL
  • Understanding of applicable compliance requirements (which tables, which operations, retention period)
  • Estimated storage for audit logs: plan for 10-30% of the audited table's data volume per year
  • Separate tablespace or storage volume for audit data to prevent audit growth from affecting application performance

Instructions

  1. Identify tables requiring audit logging based on compliance and business needs:

- Tables containing PII (users, contacts, addresses) -- GDPR/HIPAA requirement - Tables containing financial data (transactions, payments, invoices) -- SOX/PCI-DSS requirement - Tables containing access control data (roles, permissions, API keys) -- security requirement - Determine which operations to audit per table: INSERT, UPDATE, DELETE, or all three

  1. Create the audit log table with comprehensive metadata: CREATE TABLE audit_log (id BIGSERIAL PRIMARY KEY, table_name VARCHAR(100) NOT NULL, record_id TEXT NOT NULL, action VARCHAR(10) NOT NULL CHECK (action IN ('INSERT', 'UPDATE', 'DELETE')), old_values JSONB, new_values JSONB, changed_columns TEXT[], changed_by VARCHAR(100), changed_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), client_ip INET, application_name VARCHAR(100), transaction_id BIGINT);
  2. Add indexes for common audit queries:

- CREATE INDEX idx_audit_table_record ON audit_log (table_name, record_id) - CREATE INDEX idx_audit_changed_at ON audit_log (changed_at) - CREATE INDEX idx_audit_changed_by ON audit_log (changed_by) - CREATE INDEX idx_audit_action ON audit_log (table_name, action)

  1. Create the PostgreSQL audit trigger function: CREATE OR REPLACE FUNCTION audit_trigger_func() RETURNS TRIGGER AS $$ BEGIN IF TG_OP = 'INSERT' THEN INSERT INTO audit_log (table_name, record_id, action, new_values, changed_by, client_ip, application_name, transaction_id) VALUES (TG_TABLE_NAME, NEW.id::text, 'INSERT', to_jsonb(NEW), current_setting('app.user', true), inet_client_addr(), current_setting('application_name'), txid_current()); ELSIF TG_OP = 'UPDATE' THEN INSERT INTO audit_log (table_name, record_id, action, old_values, new_values, changed_by, client_ip, application_name, transaction_id) VALUES (TG_TABLE_NAME, NEW.id::text, 'UPDATE', to_jsonb(OLD), to_jsonb(NEW), current_setting('app.user', true), inet_client_addr(), current_setting('application_name'), txid_current()); ELSIF TG_OP = 'DELETE' THEN INSERT INTO audit_log (table_name, record_id, action, old_values, changed_by, client_ip, application_name, transaction_id) VALUES (TG_TABLE_NAME, OLD.id::text, 'DELETE', to_jsonb(OLD), current_setting('app.user', true), inet_client_addr(), current_setting('application_name'), txid_current()); END IF; RETURN COALESCE(NEW, OLD); END; $$ LANGUAGE plpgsql;
  2. Attach triggers to each audited table:

- CREATE TRIGGER audit_users AFTER INSERT OR UPDATE OR DELETE ON users FOR EACH ROW EXECUTE FUNCTION audit_trigger_func() - Repeat for each table requiring audit logging

  1. Pass application-level user context to the database session so audit logs capture the actual application user (not just the database role):

- At the start of each request: SET LOCAL app.user = 'user@example.com' - For connection pools, set in the connection checkout hook - This value is captured by current_setting('app.user', true) in the trigger

  1. Partition the audit_log table by month for efficient querying and archival:

- CREATE TABLE audit_log (...) PARTITION BY RANGE (changed_at) - Create monthly partitions: CREATE TABLE audit_log_2024_01 PARTITION OF audit_log FOR VALUES FROM ('2024-01-01') TO ('2024-02-01') - Automate partition creation for future months

  1. Protect audit log integrity:

- Revoke UPDATE and DELETE permissions on audit_log from all application users - Grant only INSERT permission to the trigger execution context - Consider using pg_audit extension for additional tamper protection - Ship audit logs to an external system (SIEM, S3) for independent retention

  1. Create compliance report queries:

- Change history for a record: SELECT * FROM audit_log WHERE table_name = 'users' AND record_id = '12345' ORDER BY changed_at - All changes by a user: SELECT * FROM audit_log WHERE changed_by = 'user@example.com' ORDER BY changed_at DESC - Bulk operations detection: SELECT changed_by, table_name, action, COUNT(*) FROM audit_log WHERE changed_at > NOW() - INTERVAL '1 hour' GROUP BY 1,2,3 HAVING COUNT(*) > 100 - Off-hours activity: SELECT * FROM audit_log WHERE EXTRACT(HOUR FROM changed_at) NOT BETWEEN 8 AND 18

  1. Set up audit log archival: move audit records older than the retention period to cold storage (S3, Azure Blob). Maintain the archive manifest for retrieval. Typical retention: 1-3 years in database, 7+ years in cold storage for financial data.

Output

  • Audit table DDL with proper columns, indexes, and partitioning
  • Audit trigger function capturing full before/after values with user context
  • Trigger attachment scripts for each audited table
  • Compliance report queries for common audit scenarios
  • Archival configuration for audit log lifecycle management

Error Handling

ErrorCauseSolution
Audit trigger slows INSERT/UPDATE operationsTrigger overhead on high-write tablesAudit only critical columns instead of full rows; use asynchronous audit with pg_notify and a listener process; batch audit writes
Audit table consuming excessive disk spaceHigh write volume tables generating millions of audit recordsPartition by month; archive old partitions to cold storage; audit only specific columns with WHEN clause on trigger
current_setting('app.user') returns NULLApplication not setting session variable before database operationsSet default in trigger: COALESCE(current_setting('app.user', true), current_user); add connection pool checkout hook
Audit log INSERT fails, blocking application operationAudit table full, permission error, or constraint violationUse BEGIN... EXCEPTION WHEN OTHERS THEN NULL; END in trigger to prevent audit failures from blocking operations; alert on audit failures
Cannot determine which columns changed in UPDATEFull row stored as JSON, no column-level diffAdd changed_columns computation in trigger: compare OLD and NEW field by field; store only changed fields in new_values

Examples

HIPAA-compliant audit logging for a healthcare database: Audit triggers on patient_records, prescriptions, and lab_results tables capture all modifications with practitioner identity. Audit logs are immutable (no UPDATE/DELETE grants), partitioned monthly, and archived to encrypted S3 after 1 year. Quarterly compliance reports show access patterns per practitioner and flag unusual access (patient records accessed without an appointment).

Detecting unauthorized data modifications: Audit log query reveals 500 DELETE operations on the billing table by a service account at 3 AM, outside normal business hours. Alert triggers for bulk operations exceeding 100 rows. Investigation traces the operations to a misconfigured cleanup job. Audit log provides the complete list of deleted records for restoration.

GDPR data access request fulfillment: When a user requests their data access log under GDPR Article 15, the audit system provides a complete history of who accessed or modified their personal data: SELECT changed_by, action, changed_at, changed_columns FROM audit_log WHERE table_name = 'users' AND record_id = '12345' ORDER BY changed_at. The report is generated within the 30-day compliance window.

Resources

平台分布

Codex

33.28%
按下载量换算71

Claude

28.5%
按下载量换算61

Cursor

18.35%
按下载量换算39

Gemini CLI

10.36%
按下载量换算22

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills