sova: Skill for Claude Code

.agents/skills/database-patterns/SKILL.md

database-patterns is a skill for Claude Code from xsovad06/sova. It costs 52 tokens per session (616 once invoked), scanned A, original, Apache-2.0.

A set of database conventions for the SOVA project, using async SQLAlchemy 2.0, an asynchronous Python database library, and Alembic migrations. It covers models, sessions, timestamps, indexes, JSON values, and terminal statuses.

In plain words
What is it for?
Use it when changing SOVA database models, session code, or Alembic migrations, especially when handling JSON columns, timestamps, indexes, or task status values.
Why use it?
It reduces database bugs such as leaked sessions, incorrect handling of JSON null values, and inconsistent schema definitions.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: installed under .agents/ (shared by several agents); mentions Codex.

This is xsovad06/sova's own configuration. It tells Claude Code how to work on sova itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything sova configures →

Reuse

Borrowing it

Nothing to install: this file belongs to xsovad06/sova. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/xsovad06/sova/main/.agents/skills/database-patterns/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/xsovad06/sova

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for database-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/xsovad06/sova/database-patterns/github.svg)](https://agentmods.dev/skills/xsovad06/sova/database-patterns)
Your own site
<a href="https://agentmods.dev/skills/xsovad06/sova/database-patterns"><img src="https://agentmods.dev/badge/skills/xsovad06/sova/database-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for database-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/xsovad06/sova/database-patterns"><img src="https://agentmods.dev/badge/skills/xsovad06/sova/database-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 616 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.00616
Opus 5.5 $0.00021 $0.00246
Sonnet 5.5 $0.00010 $0.00123
Haiku 4.5 $0.00005 $0.00062

Measured 1mo ago against content hash bc68a32aac43, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

database-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/database-patterns/SKILL.md · 58 lines

How it starts

The opening of the file, as written. The whole thing — 58 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SOVA Database Patterns

When working on sova/db/, ORM models, or migrations, follow these conventions. Reference: docs/database-guidelines.md.

Session Management

Always use the async context manager:

async with await get_session() as session:
    result = await session.execute(select(TaskRun))

Never acquire sessions without async with: it leaks on exception. All factories use expire_on_commit=False.

ORM Model Conventions (sova/db/models.py)

  • Type-annotated columns: Mapped[str] with mapped_column(String(50))
  • Money: Numeric(10, 6) with Decimal("0") default
  • Timestamps: DateTime(timezone=True) with lambda: datetime.now(timezone.utc)
  • FK constants: _FK_TASK_RUNS_ID = "task_runs.id"
  • Indexes in __table_args__: Index("ix_{table}_{column}", "column")
  • Input normalization: @validates decorator (e.g., strip # from issue numbers)

JSON Column NULL Gotcha

SQLAlchemy JSON defaults to none_as_null=False. Python None becomes JSON "null", not SQL NULL.

  • TaskRun.handoff_json.isnot(None) only catches SQL NULLs
  • Use if not handoff: to catch both None and {}

Terminal Status Sets

_TERMINAL = frozenset({TaskStatus.DONE, TaskStatus.FAILED, TaskStatus.REJECTED})         # state machine
TASK_RUN_TERMINAL = frozenset({"done", "failed", "rejected", "interrupted"})  # DB queries

Use TASK_RUN_TERMINAL for DB queries. Always guard finalization:

if task_run.status in TASK_RUN_TERMINAL:
    return  # don't overwrite, but still update cost

Migrations

  • Always use batch_alter_table (SQLite requires it)
  • Use idempotent helpers: _column_exists(), _table_exists(), _index_exists()
  • Sequential numbering (001-008), not Alembic UUIDs
  • Engine disposal after migration for file-backed SQLite (stale schema cache)
  • Self-healing: if Alembic fails, drops corrupted alembic_version, runs create_all + stamps head

Multi-Project

get_session(project_dir=...) routes to per-project engine. Each project gets its own .Codex/sova.db.

Read the full file on GitHub · 58 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed bc68a32aac43
  2. 2mo ago First seen · 58 lines · 52 tokens per session scan A df1dbaa85a66

Subscribe to this mod's changes

database-patterns is a skill published in the GitHub repository xsovad06/sova (2 stars, last pushed yesterday), licensed Apache-2.0. It adds 52 tokens to every session and 616 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

doris-repo-review

Review an Apache Doris PR from a local clone with the same multi-agent, shared-ledger convergence workflow as the CI Code Review Runner. Use when the user supplies a PR to /doris-repo-review, asks to review a Doris PR locally, or asks for the CI-style review flow. Safely align only the current worktree to the exact PR…

apache/doris-skills · 180 tokens

database

This skill should be used when reviewing queries, migrations or schema changes.

dean0x/devflow · 16 tokens

patterns

This skill should be used when the user asks to "create an API endpoint", "add CRUD operations", "implement event handlers", "set up logging", or adds database operations, REST/GraphQL APIs, pub/sub.

dean0x/devflow · 47 tokens

relational-database-design

Designs or reviews a relational database schema for a given domain. Covers table structure, normalization, indexes, constraints, and migration strategy. Invoked when the user asks to design a schema, review a database structure, or optimize a data model.

soulcodex/agentic · 55 tokens

sqlike

Check SQL with sqlike — deterministic static analysis (validity, anti-patterns, rewrites, index advice) and query-equivalence verification. Use whenever you write, edit, review, or rewrite a SQL query, or need to prove two queries return the same results. Requires the sqlike MCP server (@sqlike/mcp) or the sqlike CLI…

orifisher2/sqlike · 81 tokens

gh-cli-github

List/create PRs, issues, releases, and CI run status via the gh CLI.

navig-run/core · 22 tokens