SQLite best practices for Python -- PRAGMAs per connection, context manager transactions, parameterized queries, row_factory, executemany, FK indexes
92
90%
Does it follow best practices?
Impact
97%
1.73xAverage score across 5 eval scenarios
Passed
No known issues
{
"instruction": "Apply SQLite best practices in Python: connection PRAGMAs, context managers, parameterized queries, row factory",
"relevant_when": "Agent uses sqlite3 in a Python application",
"context": "SQLite foreign keys are OFF by default in Python and must be enabled per connection. WAL mode enables concurrent reads. Context managers handle transaction commit/rollback. Row factory enables dict-like access.",
"sources": [
{
"type": "file",
"filename": "skills/sqlite-python-best-practices/SKILL.md",
"tile": "tessl-labs/sqlite-python-best-practices@0.1.2"
}
],
"checklist": [
{
"name": "wal-mode-enabled",
"rule": "Agent sets PRAGMA journal_mode=WAL on the SQLite connection",
"relevant_when": "Agent creates a SQLite database connection in Python"
},
{
"name": "foreign-keys-enabled",
"rule": "Agent sets PRAGMA foreign_keys=ON on every SQLite connection (not once globally -- must be per connection)",
"relevant_when": "Agent creates a SQLite database connection in Python"
},
{
"name": "busy-timeout-set",
"rule": "Agent sets PRAGMA busy_timeout to a positive value (e.g. 5000) on the connection",
"relevant_when": "Agent creates a SQLite database connection in Python"
},
{
"name": "row-factory-configured",
"rule": "Agent sets conn.row_factory = sqlite3.Row for dict-like row access",
"relevant_when": "Agent creates a SQLite database connection in Python"
},
{
"name": "context-manager-for-writes",
"rule": "Agent uses 'with conn:' context manager for write operations instead of manual conn.commit()",
"relevant_when": "Agent writes data to SQLite in Python"
},
{
"name": "parameterized-queries",
"rule": "Agent uses ? placeholders for all query parameters, never f-strings or string concatenation",
"relevant_when": "Agent writes SQL queries with dynamic values in Python"
},
{
"name": "connection-closed",
"rule": "Agent closes SQLite connections in finally blocks or via context managers / dependency injection",
"relevant_when": "Agent creates SQLite connections in request handlers or functions"
}
]
}evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
skills
sqlite-python-best-practices
verifiers