hai-audit

Manage audit logs with lifecycle, query, and statistics operations.

3|7|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/hai-series/hai-framework --skill hai-audit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hai-audit
Source: https://github.com/hai-series/hai-framework/tree/main/packages/cli/templates/skills/hai-audit
Command: npx skills add https://github.com/hai-series/hai-framework --skill hai-audit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

审计日志的记录、查询、清理与统计是确保系统操作可追溯、合规审计的关键。本 Skill 提供基于 @h-ai/reldb 的统一审计日志模块,简化日志生成、检索、清理和统计分析的整合。

Core Features & Use Cases

  • 记录审计日志:集中记录用户行为、安全事件等关键操作,确保可追溯性。
  • 分页查询与统计:提供分页列表、按时间/用户筛选与统计分析,支持报表生成。
  • 便捷助手与集成:提供 audit.helper 便捷方法,集成到应用的身份认证与权限体系中。
  • 兼容性与初始化:依赖已初始化的 reldb 实例,统一的生命周期管理,提高稳定性。

常见场景包括登录/登出审计、CRUD 操作审计、合规报表等。

Quick Start

在应用中先初始化依赖的 reldb,然后初始化 audit 模块并开始记录日志。

Frequently Asked Questions about hai-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I record and query audit logs for user activity and security events?

To record and query audit logs for user activity and security events, use a unified auditing module that supports initialization, logging, paginated listing, and statistics for traceable compliance reporting across your applications.

What is audit log management and when do I need it for compliance reporting?

Audit log management is the process of consistently recording, querying, and cleaning security events to ensure system traceability. You need it for compliance reporting when your applications require tracking user behavior and regulatory reporting.

How do I implement audit logging for login, logout, and CRUD operations?

Implement audit logging for login, logout, and CRUD operations by initializing the audit module after your database instance, then using the provided helper methods to consistently record events into the unified tracking system.

Do I need an initialized reldb instance before setting up audit log tracking?

Yes, you need an initialized reldb instance before setting up audit log tracking, because the auditing module depends on it for unified lifecycle management and safe dependency-based operation.

Can I filter security and compliance logs by time and user for report generation?

Yes, you can filter security and compliance logs by time and user for report generation, because the module provides paginated lists and statistical analysis capabilities to support these specific querying requirements.

What is the best way to manage the lifecycle and cleanup of old activity tracking logs?

The best way to manage the lifecycle and cleanup of old activity tracking logs is using a modular auditing API that provides built-in cleanup functionality alongside clear error handling and safe lifecycle management.