nara-database

nara-database is a skill for Claude Code, Codex from MasRama/nara. It costs 18 tokens per session (848 once invoked), scanned A, original, MIT.

Database guidance for writing SQLite queries and transactions in a TypeScript application using prepared statements.

In plain words
What is it for?
It helps implement reads, writes, parameterized searches, dynamic lists of values, and shared database access with better-sqlite3.
Why use it?
It keeps database access in the right repository layer and prevents user input from being inserted unsafely into SQL.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Not installable on its own: it reads a path above its own folder, which only exists inside its repository. The line is import { getDatabase } from '../../../shared/database';.

Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

Made for: Claude Code, Codex.

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 nara-database

README.md
[![agentmods](https://agentmods.dev/badge/skills/masrama/nara/nara-database.svg)](https://agentmods.dev/skills/masrama/nara/nara-database)
Your own site
<a href="https://agentmods.dev/skills/masrama/nara/nara-database"><img src="https://agentmods.dev/badge/skills/masrama/nara/nara-database.svg" alt="Measured on agentmods" height="20"></a>
Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 848 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00018 $0.00848
Opus 5 $0.00009 $0.00424
Sonnet 5 $0.00004 $0.00170
Haiku 4.5 $0.00002 $0.00085

Measured today against content hash 174ab12923af, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

nara-database 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 today.

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/nara-database/SKILL.md · 108 lines

How it starts

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

Database (SQLite Usage)

Ownership

Feature repositories own SQL. Shared database lifecycle lives in src/shared/database/; route modules and browser code must not access SQLite directly.

import { getDatabase } from '../../../shared/database';

export function findUserById(userId: string): StoredUser | undefined {
  return getDatabase()
    .prepare(
      'SELECT id, name, email, password, avatar, created_at, updated_at FROM users WHERE id = ?',
    )
    .get(userId) as StoredUser | undefined;
}

Use better-sqlite3 prepared statements for values. Keep row interfaces near the repository that reads them or export them through the Feature's public boundary when another module needs the type.

Parameter binding

Never interpolate user-controlled values into SQL. Bind values through .get(), .all(), or .run():

const pattern = `%${search}%`;
const rows = getDatabase()
  .prepare(
    `SELECT id, name
     FROM products
     WHERE name LIKE ?
     ORDER BY created_at DESC
     LIMIT ? OFFSET ?`,
  )
  .all(pattern, limit, offset) as ProductRow[];

For dynamic IN clauses, generate one placeholder per validated value and spread the values into the prepared statement:

const placeholders = roleIds.map(() => '?').join(', ');
const rows = getDatabase()
  .prepare(`SELECT * FROM roles WHERE id IN (${placeholders})`)
  .all(...roleIds) as Role[];

Dynamic identifiers cannot be bound. Prefer fixed SQL; if an identifier must be dynamic, validate it against a closed allowlist before inserting it into the statement.

Transactions

Use a better-sqlite3 transaction for multi-statement writes that must be atomic:

const database = getDatabase();
const replace = database.transaction(() => {
  database.prepare('DELETE FROM user_roles WHERE user_id = ?').run(userId);
  const statement = database.prepare(
    `INSERT INTO user_roles (id, user_id, role_id, created_at)
     VALUES (?, ?, ?, ?)`,
  );
  const now = Date.now();
  for (const roleId of roleIds) {
    statement.run(randomUUID(), userId, roleId, now);
  }
});
replace();

Read the full file on GitHub · 108 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. today First seen · 108 lines · 18 tokens per session scan A 174ab12923af

Subscribe to this mod's changes

nara-database is a skill published in the GitHub repository MasRama/nara (5 stars, last pushed today), licensed MIT. It adds 18 tokens to every session and 848 once invoked, about $0.0001 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-09-05.