audit-trail

Generate audit trails for .NET EF Core entities with UTC timestamps and user attribution.

69|13|Updated Jan 26, 2026
One-click install
npx skills add https://github.com/ronnythedev/dotnet-clean-architecture-skills --skill audit-trail
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-trail
Source: https://github.com/ronnythedev/dotnet-clean-architecture-skills/tree/main/sample/POS/.claude/skills/18-audit-trail
Command: npx skills add https://github.com/ronnythedev/dotnet-clean-architecture-skills --skill audit-trail

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires Entity Framework Core.

What problem does it solve?

Developers often struggle to consistently track who created or modified a domain entity and when, including soft-deletes, across the data layer. This Skill provides a ready-made auditing framework that enforces UTC timestamps and user attribution.

Core Features & Use Cases

  • Implements IAuditable and AuditableEntity base to store CreatedAtUtc, CreatedBy, UpdatedAtUtc, UpdatedBy, and soft delete fields.
  • Provides EF Core SaveChanges interceptor to auto-populate audit fields and convert hard deletes to soft deletes.
  • Supports integration with a user context for automated attribution in both typical web requests and background tasks.

Quick Start

  1. Create entities by deriving from AuditableEntity and/or implementing IAuditable.
  2. Register AuditSaveChangesInterceptor in your DI container and wire the interceptor into EF Core.
  3. Apply the AuditableEntityConfiguration base configuration to your entities and enable a global query filter for soft deletes.

Frequently Asked Questions about audit-trail

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

FAQPage Schema
How do I automatically track who created and modified entities in EF Core?

You can track entity changes by registering a SaveChanges interceptor in EF Core to auto-populate audit fields like CreatedAtUtc, CreatedBy, UpdatedAtUtc, and UpdatedBy across saves. Deriving entities from an AuditableEntity base class enforces this tracking automatically.

What is the best way to implement soft deletes with UTC timestamps in .NET?

Implementing soft deletes with UTC timestamps involves using an EF Core interceptor that converts hard deletes to soft deletes and enforces UTC time recording. Applying a global query filter then automatically excludes soft-deleted entities from query results.

Can I use an EF Core interceptor to enforce user attribution in background tasks?

Yes, you can use an EF Core interceptor to enforce user attribution in background tasks. The auditing framework supports integration with a user context, enabling automated attribution of entity changes for both typical web requests and background processing.

How do I set up an audit trail for domain entities using Entity Framework Core?

To set up an audit trail, derive entities from AuditableEntity, implement IAuditable, and register the AuditSaveChangesInterceptor in your DI container. Wire the interceptor into EF Core and apply the AuditableEntityConfiguration to enforce auditing rules.

Why does my EF Core SaveChanges interceptor need a user context for auditing?

Your EF Core SaveChanges interceptor needs a user context to accurately attribute entity modifications to specific users. Integrating a user context allows the interceptor to automatically populate the CreatedBy and UpdatedBy fields during save operations.

Do I need to implement IAuditable on all entities to track CreatedAt and UpdatedAt?

No, you do not need to implement IAuditable on every entity individually. Deriving your domain entities from the AuditableEntity base class automatically provides the required CreatedAt, UpdatedAt, and soft-delete tracking fields.

Related Skills