mcpbeat

Sqlite Ops

aiskillstore/sqlite-ops

Patterns for SQLite databases in Python projects - state management, caching, and async operations. Triggers on: sqlite, sqlite3, aiosqlite, local database, database schema, migration, wal mode.

20k tokens
context cost
the whole folder, loaded on every use
7
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
404
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/aiskillstore/marketplace --skill sqlite-ops

What comes with it

78 554 bytes besides the instruction
assets/.gitkeep
references/async-patterns.md
references/migration-patterns.md
references/schema-patterns.md
scripts/.gitkeep
skill-report.json

The instruction itself

8 sections, as written by the author

SQLite Operations

Patterns for SQLite databases in Python projects.

Quick Connection

import sqlite3

def get_connection(db_path: str) -> sqlite3.Connection:
    conn = sqlite3.connect(db_path, check_same_thread=False)
    conn.row_factory = sqlite3.Row  # Dict-like access
    conn.execute("PRAGMA journal_mode=WAL")  # Better concurrency
    conn.execute("PRAGMA foreign_keys=ON")
    return conn

Context Manager Pattern

from contextlib import contextmanager

@contextmanager
def db_transaction(conn: sqlite3.Connection):
    try:
        yield conn
        conn.commit()
    except Exception:
        conn.rollback()
        raise

WAL Mode

Enable for concurrent read/write:

conn.execute("PRAGMA journal_mode=WAL")

| Mode | Reads | Writes | Best For |

|------|-------|--------|----------|

| DELETE (default) | Blocked during write | Single | Simple scripts |

| WAL | Concurrent | Single | Web apps, MCP servers |

Common Gotchas

| Issue | Solution |

|-------|----------|

| "database is locked" | Use WAL mode |

| Slow queries | Add indexes, check EXPLAIN QUERY PLAN |

| Thread safety | Use check_same_thread=False |

| FK not enforced | Run PRAGMA foreign_keys=ON |

CLI Quick Reference

sqlite3 mydb.sqlite    # Open database
.tables                # Show tables
.schema items          # Show schema
.headers on && .mode csv && .output data.csv  # Export CSV
VACUUM;                # Reclaim space

When to Use

  • Local state/config storage
  • Caching layer
  • Event logging
  • MCP server persistence
  • Small to medium datasets

Additional Resources

For detailed patterns, load:

  • ./references/schema-patterns.md - State, cache, event, queue table designs
  • ./references/async-patterns.md - aiosqlite CRUD, batching, connection pools
  • ./references/migration-patterns.md - Version migrations, JSON handling

How to use it

Copy the folder

Take aiskillstore/sqlite-ops from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.