- Home
- Skills
- Prompt & Skill Engineering
- sharpino architecture
sharpino architecture
Architectural patterns and F# code skeletons for Sharpino event-sourced aggregates in BlazorBookLibrary.
$3
Works with the AI Agents you already use
sharpino architecture
Example session with this skill installed
Create a new Member aggregate for the library with a TenantId, Name, and Email, including a command to update the email.
- Read your context and instructions
- Compiled the sharpino architecture
I have generated the Sharpino aggregate, command, and event structures for the Member slice.
Member Domain Slice
namespace BookLibrary.Domain
open System
open System.Text.Json
open FsToolkit.ErrorHandling
open Sharpino
open BookLibrary.Shared.Commons
type MemberId = | MemberId of Guid with
static member New() = MemberId(Guid.NewGuid())
member this.Value = match this with MemberId v -> v
type Member =
{
TenantId: TenantId
MemberId: MemberId
Name: string
Email: string
}
with
static member New (tenantId: TenantId) name email =
{ TenantId = tenantId; MemberId = MemberId.New(); Name = name; Email = email }
member this.UpdateEmail (newEmail: string) (dt: DateTime) : Result<Member, string> =
if not (newEmail.Contains("@")) then Error "Invalid email format"
else Ok { this with Email = newEmail }
// Sharpino Contract
member this.Id = this.MemberId.Value
static member Version = "_01"
static member StorageName = "_member"
static member SnapshotsInterval = 100
member this.Serialize = JsonSerializer.Serialize(this, jsonOptions)
static member Deserialize (data: string) : Result<Member, string> =
try JsonSerializer.Deserialize<Member>(data, jsonOptions) |> Ok
with ex -> Error ex.Message
type MemberCommand =
| UpdateEmail of string * DateTime
interface AggregateCommand<Member, MemberEvent> with
member this.Execute (m: Member) =
match this with
| UpdateEmail (email, dt) ->
m.UpdateEmail email dt |> Result.map (fun updated -> updated, [EmailUpdated (email, dt)])
member this.Undoer = None
and MemberEvent =
| EmailUpdated of string * DateTime
interface Event<Member> with
member this.Process (m: Member) =
match this with | EmailUpdated (email, dt) -> m.UpdateEmail email dt
Next steps
- Add
MemberIdtoShared/Slices/Common/Commons.fs. - Generate the PostgreSQL migration using
./generateAggregateByTemplate.sh "_01" "_member" "text". - Implement
IMemberServicein the Server project to handle theUpdateEmailcommand.
Connects securely to your tools. The creator never sees your data.
About this skill
Building event-sourced systems in F# often leads to boilerplate sprawl and inconsistent tenant isolation. This skill provides the exact architectural invariants and code skeletons required to implement Sharpino-based aggregates and services within the blazorBookLibrary stack.
What it does
- Enforces Domain Purity: Generates immutable F# records for aggregates and entities, ensuring zero I/O or side effects in business logic.
- Automates Sharpino Skeletons: Provides boilerplate for
AggregateCommand,Event, andAggregateViewerAsync2implementations. - Secures Multi-Tenancy: Embeds
TenantIdandUserContextvalidation directly into the service layer to prevent cross-tenant data leaks. - Handles CQRS Read Models: Scaffolds
RefreshableAsyncmodels and cache invalidation logic for complex UI views. - Generates Database Migrations: Provides the mandatory PL/pgSQL functions and table schemas required for Sharpino event store optimistic locking.
How it works
- Define the Value Objects: Use the provided DU templates in
Commons.fsto wrap primitive types likeGuidorstring. - Implement the Aggregate: Create the core record in the domain layer following the Sharpino contract for serialization and versioning.
- Map Commands and Events: Define the DU transitions that evolve the aggregate state and emit event streams.
- Wire the Service: Implement the service interface using
runAggregateCommandMdAsyncfor write operations andAggregateViewerAsync2for reads.
Frameworks & tools
F#, .NET, Blazor, PostgreSQL, Sharpino, FsToolkit.ErrorHandling, and SQL.
Why this beats prompting it yourself
Generic AI prompts often miss the strict "No I/O in domain" rule or fail to include the specific PL/pgSQL stored procedures Sharpino requires for its runtime. This skill ensures every generated line respects the blazorBookLibrary tenant isolation patterns and deterministic event-processing requirements.
Use cases
- Adding a new feature slice with full event-sourcing and audit history.
- Refactoring a legacy service to use immutable records and result-driven control flow.
- Generating PostgreSQL migration scripts for new aggregate roots.
- Implementing a multi-aggregate transaction using Sharpino command runners.
Known limitations
Does not support direct SQL updates on aggregate tables. Requires FsToolkit.ErrorHandling for result monads. migrations must follow the exact naming convention for Sharpino to detect streams.
Requires FsToolkit.ErrorHandling. Supports only Sharpino-style event sourcing. No support for mutable domain states. Migration naming is strict.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 12 days ago