audit-trail

Automate EF Core audit trails with SaveChanges interceptor and user context.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/hiiamsky/multi-agent-dev-team --skill audit-trail-hiiamsky
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-trail
Source: https://github.com/hiiamsky/multi-agent-dev-team/tree/main/.github/skills/dotnet-audit-trail
Command: npx skills add https://github.com/hiiamsky/multi-agent-dev-team --skill audit-trail-hiiamsky

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automatically generate and maintain audit metadata for domain entities, including creation, modification, and soft-delete events, with UTC timestamps and user attribution.

Core Features & Use Cases

  • IAuditable interface and AuditableEntity base class for standardized audit fields.
  • SaveChanges interceptor that auto-populates auditing fields and converts hard deletes to soft deletes.
  • User context integration to track who performed changes.
  • Optional audit patterns for full history logging and easy query filtering.

Quick Start

Add the AuditTrail components to your EF Core stack and register the interceptor and user context in your DI container to start tracking changes.

Frequently Asked Questions about audit-trail

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

FAQPage Schema
How do I implement automatic audit trails for EF Core entities in .NET?

Automatic audit trails for EF Core entities are implemented by integrating the IAuditable interface with a SaveChanges interceptor. This setup auto-populates creation, modification, and soft-delete fields with UTC timestamps and user attribution across typical data access patterns.

Can I automatically convert hard deletes to soft deletes using an EF Core interceptor?

Yes, you can convert hard deletes to soft deletes using an EF Core SaveChanges interceptor. The interceptor automatically intercepts delete operations and applies soft-delete tracking to your auditable entities instead of permanently removing them from the database.

Does EF Core audit tracking require a user context implementation?

EF Core audit tracking requires an IUserContext implementation to attribute changes to specific users. You must register this user context alongside the SaveChanges interceptor in your .NET DI container to populate the audit fields accurately.

What .NET version is required to set up entity auditing with EF Core interceptors?

Entity auditing with EF Core interceptors requires .NET 8 or higher. You also need the EF Core framework and proper interceptor registration within your dependency injection container to enforce UTC timestamps and automatic audit field population.

How does user context integration track who performed entity modifications in EF Core?

User context integration tracks entity modifications by passing the current user identity through an IUserContext implementation. The EF Core SaveChanges interceptor reads this context to automatically populate audit fields with the user who performed the creation, modification, or soft-delete action.

What's the best way to standardize audit fields across multiple EF Core domain models?

The best way to standardize audit fields across EF Core domain models is using an IAuditable interface or AuditableEntity base class. This ensures consistent audit metadata for creation, modification, and soft-delete events, which the interceptor automatically populates.