/shiny:shiny-efcorefrom shiny
Generate code using Shiny EF Core Extensions — feature packages for EF Core 10: SQLite spatial (NetTopologySuite without SpatiaLite), sqlite-vec vector search and FTS5 full-text search that work on iOS/Android; a transactional outbox; provider-agnostic temporal history; scoped Microsoft.Extensions.AI tools and an MCP server over a DbContext; versioned run-once seeding; and an Aspire AppHost seed gate
Ships in shiny. 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.
None: SKILL.md is the whole skill.
Independent feature packages for EF Core 10 (net10.0). Each one plugs in through EF's own extension points:
options-builder extensions, modelBuilder/EntityTypeBuilder extensions, and EF.Functions. Never generate a
custom base DbContext for any of them.
Providers: Outbox, Temporal, AI and Seeding support SQLite, PostgreSQL (Npgsql), SQL Server and MySQL
(MySql.EntityFrameworkCore / UseMySQL, not Pomelo, which has no EF 10 build). Sqlite.Mobile is SQLite-only.
Shiny.EntityFrameworkCore.Sqlite.Mobile: spatial, vectors, FTS5 on SQLiteUse this instead of Microsoft.EntityFrameworkCore.Sqlite.NetTopologySuite / UseNetTopologySuite(),
which needs mod_spatialite and can't run on iOS or Android.
services.AddDbContext<AppDbContext>(o => o.UseSqlite(cs, s => s
.UseShinySpatial()
.UseShinyVectors() // throws at startup if sqlite-vec can't load; call SqliteVec.RegisterAutoExtension() before opening raw connections
.UseShinyFullText()));
protected override void OnModelCreating(ModelBuilder mb)
{
mb.Entity<Place>().HasSpatialIndex(x => x.Location); // R*Tree pre-filter
mb.Entity<Doc>().HasVectorIndex(x => x.Embedding, 384, VectorDistanceMetric.Cosine); // vec0
mb.Entity<Doc>().HasFullTextIndex(x => new { x.Title, x.Body }); // FTS5 external content
}
Point, Polygon, …). Every NTS predicate translates:
Intersects, Contains, Within, Covers, CoveredBy, Touches, Crosses, Overlaps, Disjoint,
EqualsTopologically, Distance, IsWithinDistance, plus X/Y, Area, Length, SRID and IsEmpty. NTS distance is
planar; for meters use EF.Functions.GeoDistanceMeters(a, b) / EF.Functions.IsWithinMeters(a, b, meters).IsWithinDistance / IsWithinMeters use the R*Tree; Distance(...) < d does not.float[] or ReadOnlyMemory<float> properties. Exact distance via
EF.Functions.VectorDistance(x.Embedding, q, VectorDistanceMetric.Cosine) in OrderBy. The KNN form is
db.Docs.NearestTo(d => d.Embedding, q, k) → IQueryable<VectorMatch<T>> (Entity, Distance). Filters
apply after the k nearest are found, so it can return fewer than k.EF.Functions.FullTextMatch(entity, q) or FullTextMatch(entity.Prop, q);
order by EF.Functions.FullTextRank(entity, q) (bm25, lower is better). Pass user input through
FullTextQuery.Escape(text, prefixLastTerm: true).ExecuteUpdate/ExecuteDelete/raw SQL, and both
EnsureCreated and migrations create them.SqliteSpatial.RegisterFunctions(connection).<ShinySqliteVecNative>false</ShinySqliteVecNative>.Shiny.EntityFrameworkCore.Outboxprotected override void OnModelCreating(ModelBuilder mb) => mb.AddOutbox(); // table "outbox"; migrations pick it up
services.AddDbContext<AppDbContext>(o => o.UseNpgsql(cs)
.AddOutboxPublishing(p => p.Publish<Order>(
c => c.Operation == OutboxOperations.Delete ? null : new OrderChanged(c.Entity.Id), // null = publish nothing
OutboxOperations.Insert | OutboxOperations.Update,
partitionKey: c => c.Entity.Id.ToString())));
services.AddDbContextOutbox<AppDbContext, BusDispatcher>(o => { o.OrderedPartitions = true; o.MaxAttempts = 8; });
// or: services.AddDbContextOutbox<AppDbContext>((msg, ct) => bus.Publish(msg.MessageType, msg.Payload, ct));
db.Orders.Add(order);
db.Enqueue(new OrderPlaced(order.Id)); // tracked entity, commits with the order
await db.SaveChangesAsync();
IOutboxDispatcher.Dispatch(OutboxMessage, ct): return to acknowledge, throw to retry. It is resolved from a
fresh scope for each message. Delivery is at least once, so consumers must be idempotent.EnableRetryOnFailure, wrap the save in db.Database.CreateExecutionStrategy() with
your own transaction.IOutboxAdmin provides PendingCount, ScheduledCount, DeadLetterCount, OldestPendingAt, DeadLetters,
Requeue, RequeueAllDeadLettered and PurgeProcessed. OutboxRunner.DrainOnce is for tests and mobile;
db.WatchOutbox<TEvent>() streams messages.OutboxColumns). Relational providers only.Shiny.EntityFrameworkCore.Temporalmb.Entity<Order>().HasHistory(h => { h.Retention = TimeSpan.FromDays(90); h.MaxVersions = 50; });
services.AddDbContext<AppDbContext>(o => o.UseNpgsql(cs).UseEntityHistory(h =>
h.ResolveActor = sp => sp.GetService<ICurrentUser>()?.Name)); // or h.CaptureActor = () => ...
UseEntityHistory(), writes record nothing and reads throw. Actor delegates go
on UseEntityHistory, not HasHistory, which keeps the model migration-safe.DbContext (keys work like Find; use object[] for composite keys): HistoryAsync<T>(key),
AsOfAsync<T>(key, instant), AsOfAllAsync<T>(instant), ChangesByActorAsync<T>(actor),
ChangesBetweenAsync<T>(from, to) (half-open), RestoreAsync<T>(key, version) (writes a new version and
calls SaveChangesAsync), GetDiffBetweenAsync<T>(key, v1, v2) → RFC 6902 JsonPatchDocument<T>.EntityVersion<T> (Key, Version, ValidFrom, ValidTo, Operation, Actor, Entity, detached).ExecuteUpdate/ExecuteDelete on a history entity throw unless AllowBulkWrites = true. Raw SQL bypasses
history.AddDbContextPool, ResolveActor only sees the root provider. Use AddDbContext for request-scoped actors.Shiny.EntityFrameworkCore.AI + .Mcpservices.AddScoped<ICurrentTenant, CurrentTenant>(); // register before the tools
services.AddDbContextAITools<AppDbContext>(b => b
.AddEntity<Order>(t => t
.Where<ICurrentTenant>((tenant, _) => o => o.TenantId == tenant.Id) // the model cannot remove or widen it
.AllowQuery().AllowCount().AllowAggregate().AllowGet()
.Description("Customer orders")
.Ignore(o => o.InternalNotes)
.MaxPageSize(50))
.AddEntity<Customer>()); // no Allow* call = read-only
IReadOnlyList<AITool> tools = sp.GetRequiredService<DbContextAITools<AppDbContext>>().Tools;
// no DI: dbContextFactory.CreateAITools(b => ...)
services.AddMcpServer().WithHttpTransport()
.WithDbContext<AppDbContext>(m => m.AllowWrites().ExposeResources().ExposePrompts()
.AddEntity<Order>(t => t.Where<ICurrentTenant>((x, _) => o => o.TenantId == x.Id).AllowAll()));
app.MapMcp("/mcp");
{entity_snake}_get_by_id|_query|_count|_aggregate|_insert|_update|_delete.OnInsert((o, ctx) => o.TenantId = ...) to stamp hidden fields first.AllowWrites() and the entity's write capabilities.Shiny.EntityFrameworkCore.Seedingpublic sealed class CountrySeeder : IDbSeeder<AppDbContext>
{
public string Name => "countries";
public int Version => 2; // bump to re-run
public async Task SeedAsync(AppDbContext db, CancellationToken ct) { /* idempotent upserts */ }
}
services.AddDbContext<AppDbContext>(o => o.UseNpgsql(cs).UseVersionedSeeding<AppDbContext>()); // runs on Migrate/EnsureCreated
services.AddDbSeeder<AppDbContext, CountrySeeder>();
services.AddDbSeeding<AppDbContext>(o => o.Initialization = DbInitialization.Migrate); // hosted service: migrate, then seed
// no generic host (MAUI):
await DbSeedRunner.RunAsync(db, [new CountrySeeder()], ct);
__ShinySeedHistory is created with raw SQL, so the model needs no changes. A seeder runs
exactly once across concurrent instances (row lock + re-check). Seeders must still be idempotent, because a
version bump re-runs them over existing data.AddDbContext, use the generic UseVersionedSeeding<AppDbContext>().EnsureCreated. Prefer Migrate, or call EnsureCreated before
any seeding.Shiny.EntityFrameworkCore.Aspire.Hostingbuilder.AddPostgres("pg").WithDataVolume().AddDatabase("appdb")
.WithDbContextSeeder<AppDbContext>(
(o, cs) => o.UseNpgsql(cs),
(db, gate, ct) => DbSeedRunner.RunAsync(db, [new CountrySeeder()], ct),
DbSeedMode.FirstTimeOnly, // or Recreate (EnsureDeleted, then seed on every start)
DbInitialization.Migrate);
WithDbSeeder(configureMarkerConnection, seed, mode) is the raw form: the callback owns the schema and the wipe.DbContext project.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub shinyorg/skills --plugin shiny57 skills in this plugin
/localizegenGenerate strongly-typed localization classes from .resx resource files using Shiny.Extensions.Localization.Generator for .NET applications/shiny-accessorysetupGenerate code using Shiny.BluetoothLE.AccessorySetup - the system accessory pairing sheet for BLE devices (AccessorySetupKit on iOS 18+, CompanionDeviceManager on Android) with no MFi, no location prompt and no general Bluetooth prompt on iOS; picked accessories open as Shiny.BluetoothLE peripherals, and Android adds background presence (device appeared / disappeared) events/shiny-actorsGenerate code using Shiny.Actors — Orleans-style virtual actors without the ceremony, AOT/trim-clean, running anywhere .NET runs including .NET MAUI and Blazor WebAssembly. Covers actor interfaces and source-generated proxies, the ShinyActorBuilder (AddShinyActors), persistent state with ETags, named states and auto-save, event-sourced JournaledActor with snapshots, state and event migrations, typed streams (durable, implicit consumers), timers and persistent reminders (background jobs via Shiny.Jobs, on-time OS notifications via Shiny.Notifications), concurrency control ([Reentrant], [AlwaysInterleave], [ReadOnly], [StatelessWorker]), call filters and request context, OpenTelemetry traces and metrics, remoting over HTTP (Shiny.Net.HttpServer server, RemoteActorSystem client), mDNS discovery of actor servers, Shiny.DocumentDb storage (SQLite, PostgreSQL, IndexedDB...), and the ActorTestHost testing kit.Other plugins' skills for the same job