fsharp-persistence

Implement SQLite and JSON file persistence with async CRUD in F#.

1|Updated Nov 26, 2025
One-click install
npx skills add https://github.com/heimeshoff/Cinemarco --skill fsharp-persistence
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fsharp-persistence
Source: https://github.com/heimeshoff/Cinemarco/tree/main/.claude/skills/fsharp-persistence
Command: npx skills add https://github.com/heimeshoff/Cinemarco --skill fsharp-persistence

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides practical patterns for data persistence in F# apps, including SQLite with Dapper, JSON file storage, and event sourcing options. It helps you implement robust, asynchronous I/O, with safe, testable persistence layers.

Core Features & Use Cases

  • SQLite with Dapper: Async CRUD operations, parameterized queries, and indexing best practices.
  • JSON File Persistence: Lightweight storage and easy snapshots for small datasets.
  • Event Sourcing (Patterns): Sample event types and envelope for append-only state rebuilds.
  • Use Case: Persist a TodoItem to SQLite and query by Id, with an option to switch to file storage.

Quick Start

Use this skill to create a Persistence.fs with CRUD operations in src/Server/Persistence.fs and example usage.

Frequently Asked Questions about fsharp-persistence

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

FAQPage Schema
How do I implement SQLite persistence with async CRUD operations in F#?

SQLite persistence in F# uses Dapper for parameterized queries and async I/O. Define repository functions for Create, Read, Update, Delete operations, initialize the database schema on startup, and execute queries asynchronously to maintain responsiveness in server-side applications.

What's the difference between SQLite and JSON file storage for persisting data?

SQLite with Dapper provides indexed, queryable storage with transactional safety for larger datasets and complex queries. JSON file storage offers lightweight, schema-free snapshots ideal for small datasets and quick prototyping, with easier versioning but no query indexing.

Can I use event sourcing patterns with SQLite in F#?

Event sourcing in F# with SQLite appends immutable events to a log and rebuilds domain state from the event stream. This Skill provides event envelope patterns and sample event types to implement append-only persistence, enabling audit trails and state replay.

How do I structure a testable persistence layer in F#?

A testable persistence layer uses repository-style data access with async functions separated from business logic. This Skill demonstrates how to isolate database operations into dedicated modules, enabling unit tests with in-memory or file-based storage without hitting live databases.

Do I need asynchronous I/O for SQLite queries in F#?

Asynchronous I/O is essential for server-side F# applications to prevent thread blocking during database calls. Dapper-based async queries allow concurrent requests to execute without starving other operations, improving throughput and responsiveness.

What are the limitations of file-based JSON storage for persistence?

JSON file storage lacks indexing, concurrency control, and queryable data structures. It suits small datasets and snapshots but becomes impractical at scale, with no built-in transactions or multi-user safety compared to SQLite's ACID guarantees.