Adds row history and auditing to any stack using database-native temporal tables (SQL Server, MariaDB), PostgreSQL trigger-based history, or ORM hooks (EF Core, Prisma, TypeORM, SQLAlchemy, Django, Hibernate, GORM).
Ships in AI for Developers Toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Add change history to tables - either database-native history (automatic, queryable point-in-time state) or an application-level audit log (DB-agnostic, captures who and why) - depending on the database and what the user actually needs.
Works on a target: a file, folder, project/repo, or GitHub URL. Report the database and ORM you detected and which tables you'd version.
| Manifest | ORM / migrations | Detect the database from |
|---|---|---|
*.csproj | EF Core | UseSqlServer / UseNpgsql / UseMySql |
package.json | Prisma / TypeORM / Drizzle / Knex | provider = "..." in schema.prisma, DataSource type, driver package |
pyproject.toml, requirements*.txt | SQLAlchemy + Alembic / Django | URL scheme (postgresql+psycopg, mssql+pyodbc, mariadb+...), ENGINE |
pom.xml, build.gradle(.kts) | JPA / Hibernate + Flyway/Liquibase | spring.datasource.url (jdbc:sqlserver, jdbc:postgresql, jdbc:mariadb) |
go.mod | GORM / golang-migrate / goose | driver import (gorm.io/driver/postgres, go-mssqldb, go-sql-driver/mysql) |
| Database | Native support | How |
|---|---|---|
| SQL Server 2016+ / Azure SQL | system-versioned temporal tables | PERIOD FOR SYSTEM_TIME + SYSTEM_VERSIONING = ON; query FOR SYSTEM_TIME AS OF / BETWEEN / ALL |
| MariaDB 10.3+ | system-versioned tables | ALTER TABLE t ADD SYSTEM VERSIONING; query FOR SYSTEM_TIME AS OF TIMESTAMP '...' |
| PostgreSQL | none built in | temporal_tables extension (if your host allows it) or a trigger-based history table (works everywhere) |
| MySQL | none | trigger-based history table or app audit log |
ALTER TABLE dbo.Orders ADD
ValidFrom datetime2 GENERATED ALWAYS AS ROW START HIDDEN NOT NULL DEFAULT SYSUTCDATETIME(),
ValidTo datetime2 GENERATED ALWAYS AS ROW END HIDDEN NOT NULL DEFAULT CONVERT(datetime2, '9999-12-31 23:59:59.9999999'),
PERIOD FOR SYSTEM_TIME (ValidFrom, ValidTo);
ALTER TABLE dbo.Orders SET (SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.OrdersHistory));
SELECT * FROM dbo.Orders FOR SYSTEM_TIME AS OF '2026-10-01T00:00:00' WHERE Id = @id;
Retention: HISTORY_RETENTION_PERIOD (Azure SQL / SQL Server 2017+). Schema changes to a versioned table need care - some require turning versioning off and on in the migration.
ALTER TABLE orders ADD COLUMN sys_period tstzrange NOT NULL DEFAULT tstzrange(now(), NULL);
CREATE TABLE orders_history (LIKE orders);
CREATE OR REPLACE FUNCTION orders_versioning() RETURNS trigger AS $$
BEGIN
INSERT INTO orders_history SELECT (OLD).*; -- history has identical columns (LIKE orders)
UPDATE orders_history SET sys_period = tstzrange(lower(OLD.sys_period), now())
WHERE id = OLD.id AND sys_period = OLD.sys_period; -- close the copied row's period
IF TG_OP = 'UPDATE' THEN NEW.sys_period := tstzrange(now(), NULL); RETURN NEW; END IF;
RETURN OLD;
END $$ LANGUAGE plpgsql;
CREATE TRIGGER orders_versioning BEFORE UPDATE OR DELETE ON orders
FOR EACH ROW EXECUTE FUNCTION orders_versioning();
Point-in-time: SELECT * FROM orders WHERE sys_period @> $1::timestamptz UNION ALL SELECT * FROM orders_history WHERE sys_period @> $1::timestamptz. Capture the actor by having the app run SET LOCAL app.user_id = '...' per transaction and storing current_setting('app.user_id', true) in a history column. With the temporal_tables extension, the trigger is versioning('sys_period', 'orders_history', true); check your managed host supports it before choosing it. Ship the trigger through the project's migration tool.
SQL Server temporal tables are first-class (EF Core 6+):
modelBuilder.Entity<Order>().ToTable("Orders", t => t.IsTemporal(tt =>
{
tt.HasPeriodStart("ValidFrom");
tt.HasPeriodEnd("ValidTo");
tt.UseHistoryTable("OrdersHistory");
}));
var asOf = await db.Orders.TemporalAsOf(timestamp).ToListAsync(ct);
var changes = await db.Orders.TemporalAll().Where(o => o.Id == id)
.OrderBy(o => EF.Property<DateTime>(o, "ValidFrom")).ToListAsync(ct);
Also TemporalFromTo, TemporalBetween, TemporalContainedIn. Application audit log (any provider, captures "who") via a SaveChangesInterceptor:
public class AuditInterceptor(ICurrentUser user) : SaveChangesInterceptor
{
public override ValueTask<InterceptionResult<int>> SavingChangesAsync(
DbContextEventData e, InterceptionResult<int> r, CancellationToken ct = default)
{
var ctx = e.Context!;
foreach (var entry in ctx.ChangeTracker.Entries()
.Where(x => x.State is EntityState.Added or EntityState.Modified or EntityState.Deleted)
.ToList())
{
ctx.Add(new AuditEntry {
Entity = entry.Metadata.GetTableName(), KeyValues = /* pk */,
Action = entry.State.ToString(), Changes = /* changed props: OriginalValue -> CurrentValue */,
User = user.Id, At = DateTime.UtcNow });
}
return base.SavingChangesAsync(e, r, ct);
}
}
Materialize the entries (ToList()) before adding audit rows, and skip AuditEntry itself. Generated keys of Added entities are only known after save - capture them in SavedChangesAsync if needed.
--create-only and edit migration.sql); map the history table as a read-only model.prisma.$extends({ query: { $allModels: { async update({ model, args, query }) { ... } } } })); the older $use middleware is deprecated. TypeORM: an EntitySubscriberInterface with afterInsert/afterUpdate/afterRemove (use event.databaseEntity for old values). Pass the actor via AsyncLocalStorage.before_flush session event iterating session.new, session.dirty, session.deleted and using inspect(obj).attrs[x].history for old/new values; or SQLAlchemy-Continuum for versioned tables. Ship native history SQL through Alembic op.execute(...).django-simple-history (history = HistoricalRecords() on the model, records history_user from the request via its middleware) or django-auditlog. Signals (pre_save/post_save) work but miss QuerySet.update() and bulk operations.@Audited on entities + a custom RevisionEntity with a RevisionListener that stores the current user; query with AuditReader (forRevisionsOfEntity, forEntitiesAtRevision). Spring Data Envers adds RevisionRepository.@CreatedBy, @LastModifiedBy, @LastModifiedDate + AuditorAware) records who touched the current row only - not history.@Immutable entity.BeforeUpdate/AfterUpdate/AfterDelete, or global db.Callback().Update().After("gorm:update").Register(...) callbacks writing audit rows; pass the actor via context.Context (db.WithContext(ctx), read with tx.Statement.Context).Exec or some batch updates - native history (triggers / temporal tables) is safer when completeness matters.## Summary
<database + ORM detected; point-in-time vs who-changed-what; chosen approach and why>
## Setup
<migration SQL / ORM configuration / hook code in the project's idiom>
## Querying history
<as-of and full-history queries for the main entity>
## Retention and PII
<retention plan; which fields are excluded or masked>
"Add history to my Order entity", "track who changed what", "set up SQL Server temporal tables with EF Core", "point-in-time query for this record", "add system versioning in MariaDB", "audit trail for Postgres without extensions", "set up Hibernate Envers". (Stefan has a blog post on EF Core temporal tables - this complements it.) Pairs with db-migration-reviewer and crud-vs-event-sourcing.
What SKILL.md sets; muted values are Claude Code's defaults
/ai-dev-toolkit:temporal-tables-setupfrom AI for Developers Toolkit
npx claudepluginhub stefanthecode/ai-for-developers --plugin ai-dev-toolkit45 skills in this plugin
/api-endpoint-scaffolderScaffold HTTP API endpoints in any stack - ASP.NET Core Minimal APIs or controllers, Express, Fastify, NestJS, FastAPI, Django REST Framework, Spring Boot controllers, Go net/http, chi, Gin - one feature per endpoint (REPR style) with request validation, typed responses, route grouping, auth, and OpenAPI metadata. Use this skill whenever the user wants to add an endpoint or route, convert controllers to minimal APIs, structure routes or routers, set up endpoint groups, TypedResults, route handlers, request DTOs/schemas (zod, Pydantic, Bean Validation, binding tags), or asks "how do I add an endpoint / structure my API routes". Always use this skill for endpoint scaffolding; it generates a complete, validated endpoint that matches the project's conventions./architecture-test-generatorGenerate architecture tests / fitness functions that fail the build when architectural rules are violated - layer dependencies, module boundaries, cycles, naming, and visibility conventions - in any stack: NetArchTest or ArchUnitNET (.NET), ArchUnit or Konsist (Java/Kotlin), dependency-cruiser or eslint-plugin-boundaries (TypeScript/JavaScript), import-linter (Python), go-arch-lint or depguard (Go). Use this skill whenever the user wants architecture tests, to enforce layering or the dependency rule, dependency rules as tests, import rules, forbidden imports, no circular dependencies, naming conventions, fitness functions, or asks "how do I stop people breaking the architecture / enforce my layers / keep modules from importing each other". Always use this skill for architecture-test requests; it generates rules matching the project's real structure.Other plugins' skills for the same job