Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/xsovad06/sova/database-patternsnpx skills add xsovad06/sova --skill database-patternsgit clone --depth 1 https://github.com/xsovad06/sovaWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00052 | $0.00616 |
| Opus 5 | $0.00026 | $0.00308 |
| Sonnet 5 | $0.00010 | $0.00123 |
| Haiku 4.5 | $0.00005 | $0.00062 |
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 yesterday.
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.
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]withmapped_column(String(50)) - Money:
Numeric(10, 6)withDecimal("0")default - Timestamps:
DateTime(timezone=True)withlambda: datetime.now(timezone.utc) - FK constants:
_FK_TASK_RUNS_ID = "task_runs.id" - Indexes in
__table_args__:Index("ix_{table}_{column}", "column") - Input normalization:
@validatesdecorator (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 bothNoneand{}
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, runscreate_all+ stamps head
Multi-Project
get_session(project_dir=...) routes to per-project engine. Each project gets its own .claude/sova.db.
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.
- yesterday First seen · 58 lines · 52 tokens per session scan A df1dbaa85a66
database-patterns is a skill published in the GitHub repository xsovad06/sova (2 stars, last pushed 2d ago), licensed Apache-2.0. It adds 52 tokens to every session and 616 once invoked, about $0.0003 per session on Opus 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.
Other skills, from other repositories
codex-autonomous-dev
NightPilot / 夜航员: reusable autonomous Codex development workflow for long-running, unattended, goal-mode, overnight, full-auto, hands-off, low-interruption software development. Use when the user mentions NightPilot, 夜航员, $codex-autonomous-dev, codex-autonomous-dev, 全自动, 无人开发, 长时间开发, 目标模式, 撒手不管, 睡觉也能跑, 老工作流接管…
skill-integration
Patterns for agent skill discovery, referencing, and composition using progressive disclosure architecture. Use when building agents, composing skills, or optimizing context usage. TRIGGER when: skill discovery, agent integration, skill composition, progressive disclosure. DO NOT TRIGGER when: implementing features…
api-design
REST API design best practices covering versioning, error handling, pagination, and OpenAPI documentation. Use when designing or implementing REST APIs or HTTP endpoints. TRIGGER when: API design, REST endpoint, HTTP route, OpenAPI, swagger, pagination. DO NOT TRIGGER when: internal library code, CLI tools, non-HTTP…
api-integration-patterns
Subprocess safety, GitHub CLI integration, retry logic, authentication, rate limiting, and timeout handling. Use when integrating external APIs or CLI tools. TRIGGER when: subprocess, gh cli, API call, retry logic, rate limiting, authentication. DO NOT TRIGGER when: internal function calls, pure Python logic, config…
agent-output-formats
Standardized output formats for research, planning, implementation, and review agents. Use when generating agent outputs or parsing agent responses.
advisor-triggers
Detects when user requests warrant critical analysis via /advise command.