Atomic Fluent Database Updater

VerifiedCaution

Atomically update all 6 Fluent databases at session end using a single JSON payload. Persists errors, review results, new vocabulary, and metadata.

Sby Skills Guide Bot
Data & AIIntermediate
7/23/2026
Claude Code
#state-persistence#json-database#atomic-write#spaced-repetition#session-logging

Recommended for

Automated summary

This skill atomically persists the results of a language-practice session into the six Fluent JSON databases by piping a single payload to update-db.py.

Strengths

  • Applies updates to all 6 databases in one atomic write (tmp + fsync + rename), with pre-write backups and payload validation
  • Removes manual JSON editing and the desync/race risks that come with it
  • Automatically rebuilds the spaced-repetition queue (SM-2) from the supplied review_results
  • Documents the payload shape, required fields, and exit codes (0/1/2) clearly

Limitations

  • Handles session deltas only — bootstrapping the databases is fluent-setup's job
  • Requires calling read-db.py first to get next_session_id and current state
  • Depends on plugin environment variables (CLAUDE_PLUGIN_ROOT / CLAUDE_PROJECT_DIR) and the .claude/hooks layout
  • Incomplete new_vocabulary entries yield incomplete spaced-repetition records
When to use it

Use it at the end of any practice session (writing, vocab, speaking, reading, review, learn) when errors, review results, and new vocabulary must be written back to the databases.

When not to use it

Skip it for read-only queries or initial database setup, which belong to fluent-progress/read-db.py and fluent-setup respectively.

Security analysis

Caution
Quality score88/100

The skill uses bash and Python for a legitimate local database-update workflow. It does not fetch remote content, exfiltrate secrets, disable safety mechanisms, or use destructive commands. Risk is limited to executing a trusted local script and mutating local JSON files, with backups and atomic writes described.

Findings
  • •Executes a local Python script (`update-db.py`) via bash; the script source is not included, so safety depends on the trusted plugin repository contents.
  • •Resolves the script path from environment variables (`CLAUDE_PLUGIN_ROOT`/`CLAUDE_PROJECT_DIR`), which could run a different script if those variables are misconfigured.
  • •Writes/overwrites six learner JSON databases and regenerates the spaced-repetition queue; backups mitigate but same `session_id` intentionally overwrites prior data.
  • •No `allowed-tools` are declared even though the skill requires shell execution and file mutation.
How this analysis is made

Examples

Fin de session de révision
Termine la session de révision : enregistre les 5 résultats de révision, les erreurs repérées et les nouveaux mots via update-db.py.
Persister une session d'écriture
La session d'écriture est finie — mets à jour les bases avec les skill_scores, les erreurs et les notes de session.
Ajouter du vocabulaire à la file SRS
Ajoute ces nouveaux mots à la file de répétition espacée et incrémente total_sessions et total_study_minutes.

name: fluent-db-updater description: Atomically update all 6 Fluent learner databases (learner-profile, progress, mistakes, mastery, spaced-repetition, session-log) at session end by calling .claude/hooks/update-db.py with a single JSON payload. Use at the end of every practice session — fluent-writing, fluent-vocab, fluent-speaking, fluent-reading, fluent-review, fluent-learn — to persist the session's errors, review results, new vocabulary, and session metadata.

DB Updater

Overview

Every practice skill ends with a DB update. Instead of hand-editing 6 JSON files (error-prone, racy, easy to desync), pipe one JSON report to update-db.py. The script runs pre-write backups, validates the payload, applies all changes atomically via .tmp + fsync + rename, and rebuilds the spaced-repetition queue.

When to Use

Load this skill whenever the tutor:

  • Finishes a practice session and needs to persist results.
  • Needs to add new vocabulary to the spaced-repetition queue.
  • Needs to record new errors, review results, or mastery changes.
  • Needs to bump total_sessions, current_streak_days, or total_study_minutes.

Skip this skill for read-only operations (use the fluent-progress skill or read-db.py directly) and during session setup (use fluent-setup skill instead — update-db.py is for session deltas, not bootstrap).

Instructions

1. Call the script

Run from the repo root:

python3 "${CLAUDE_PLUGIN_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.claude/hooks/update-db.py" <<'EOF'
{ ...payload... }
EOF

Exit codes: 0 success, 1 validation error, 2 I/O error.

2. Fill the payload

Required fields

  • session_id — string, convention session-NNN. Use computed.next_session_id from read-db.py.
  • date — YYYY-MM-DD.

Optional fields — omit to skip. Full canonical example (copy-paste this and fill in):

${CLAUDE_PLUGIN_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.claude/references/db-updater-payload.example.json

Key blocks the example covers: skill_scores, errors[], new_vocabulary[], review_results[], topics_covered, breakthroughs, focus_next_session, session_notes, achievements_earned, milestones.

3. Field notes

  • errors[] — one entry per distinct mistake this session. Collapse duplicates (same pattern_id) before sending; frequency is bumped by the script.
  • new_vocabulary[] — items the learner met for the first time. Fill every field; incomplete entries yield incomplete spaced-repetition records.
  • review_results[] — items already in the queue that were reviewed. The script runs SM-2 on each. See the fluent-sm2-calculator skill. Mapping: quality = floor(score / 2).
  • skill_scores[].correct counts correct exercises, not a percentage. Accuracy is derived.
  • confidence in learner-profile.skills is 0–100 integer; accuracy in progress-db is 0.0–1.0 float. The script handles the conversion.
  • milestones[] — each entry is a bare string OR an object { "milestone": <required non-empty string>, "date": <optional YYYY-MM-DD, defaults to the session date> }. Don't set a nested session_id; the script stamps the authoritative top-level one. A malformed entry (neither string nor object, or an object missing/empty milestone) exits 1 with no files written. Each milestone becomes both a session-log.milestones[] record and a learner-profile.achievements[] entry.

4. Read before writing

Always call read-db.py at session start to get current state + next_session_id. Don't read each JSON file separately:

python3 "${CLAUDE_PLUGIN_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.claude/hooks/read-db.py"

Returns all 6 databases plus computed fields (due_reviews_count, next_session_id, streak_active, days_since_last_session).

Examples

Example 1 — /fluent-review session with 5 items

python3 "${CLAUDE_PLUGIN_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.claude/hooks/update-db.py" <<'EOF'
{
  "session_id": "session-012",
  "date": "2026-04-24",
  "duration_minutes": 12,
  "command_used": "/fluent-review",
  "skills_practiced": ["vocabulary", "grammar"],
  "skill_scores": {
    "vocabulary": { "exercises": 3, "correct": 3, "time_minutes": 7 },
    "grammar":    { "exercises": 2, "correct": 1, "time_minutes": 5 }
  },
  "review_results": [
    { "item_id": "vocab_huis", "quality": 5 },
    { "item_id": "vocab_deur", "quality": 4 },
    { "item_id": "vocab_raam", "quality": 5 },
    { "item_id": "grammar_omdat_word_order", "quality": 2 },
    { "item_id": "grammar_past_tense", "quality": 4 }
  ],
  "errors": [
    {
      "pattern_id": "grammar_omdat_word_order",
      "category": "grammar",
      "your_answer": "omdat ik ben moe",
      "correct_answer": "omdat ik moe ben",
      "context": "subordinate clause word order",
      "severity": "critical"
    }
  ],
  "focus_next_session": ["Drill 'omdat' word order"]
}
EOF

Example 2 — /fluent-vocab session with a new word

python3 "${CLAUDE_PLUGIN_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.claude/hooks/update-db.py" <<'EOF'
{
  "session_id": "session-013",
  "date": "2026-04-25",
  "command_used": "/fluent-vocab",
  "skills_practiced": ["vocabulary"],
  "new_vocabulary": [
    {
      "item_id": "vocab_keuken",
      "item_type": "vocabulary",
      "content": "de keuken",
      "answer": "the kitchen",
      "category": "household_rooms",
      "difficulty": "A1",
      "initial_quality": 4,
      "priority": "medium"
    }
  ]
}
EOF

Critical Rules

  • Call once per session, at the end. The script rebuilds the review queue each run — partial updates risk inconsistency.
  • Never hand-edit spaced-repetition.review_queue. It's regenerated from scratch on every run.
  • Same session_id replaces. Sending the same ID twice overwrites the first call. Useful for corrections, dangerous if unintentional.
  • Backups are automatic. Written to .backups/pre-update-<session_id>/ before any change. Check there to roll back.
  • Exit code 1 means validation failed, no files touched. Fix the payload and retry.
  • Exit code 2 means I/O failure, no files touched. Check disk space, permissions, then retry.

Why This Matters

Six interdependent JSON files must agree: a new session-log entry, a bumped total_sessions, updated SM-2 params, new mistake patterns, recalculated accuracy, refreshed streak. Hand-editing causes silent desync — streak says 7 days but session-log has 6 entries, mastery says 4 stars but accuracy says 45%. The script is the single source of truth.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/atomic-fluent-database-updater-mrx3xzpq/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/atomic-fluent-database-updater-mrx3xzpq' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/atomic-fluent-database-updater-mrx3xzpq/download' --output '.skill-downloads/atomic-fluent-database-updater-mrx3xzpq/SKILL.md.part' && mv '.skill-downloads/atomic-fluent-database-updater-mrx3xzpq/SKILL.md.part' '.skill-downloads/atomic-fluent-database-updater-mrx3xzpq/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/atomic-fluent-database-updater-mrx3xzpq/SKILL.md' && test -s '.skill-downloads/atomic-fluent-database-updater-mrx3xzpq/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/fluent-db-updater' && cp -R '.skill-downloads/atomic-fluent-database-updater-mrx3xzpq' '.claude/skills/fluent-db-updater'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/atomic-fluent-database-updater-mrx3xzpq'

openskills read 'atomic-fluent-database-updater-mrx3xzpq'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/atomic-fluent-database-updater-mrx3xzpq/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills