---
name: "sqlite-litestream-s3-replication"
description: "Replicate SQLite databases continuously to object storage with sub-second Recovery Point Objective (RPO)."
metadata:
  author: "Ben Johnson"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "replicate sqlite to s3 litestream"
  - "restore sqlite from litestream"
  - "continuous sqlite backup"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Litestream Real-Time SQLite S3 Replication

Streams SQLite WAL changes to AWS S3, Cloudflare R2, or MinIO using Litestream: continuous background replication, zero-interruption restores, point-in-time recovery, and zero data loss on container restarts.

## When to Invoke
Invoke this skill whenever you need to:
- replicate sqlite to s3 litestream
- restore sqlite from litestream
- continuous sqlite backup

## Execution SOP & Rules
1. Write litestream.yml defining db path and replica S3 bucket URL with credentials.
2. Launch application wrapped with: litestream replicate -exec 'node server.js' /data/app.db.
3. Configure automatic restore on cold container start: litestream restore -if-replica-exists /data/app.db.
4. Check replication progress using litestream generations and litestream snapshots commands.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
