Agent skill

MoviePilot Database Operation

by jxxghp in jxxghp/MoviePilot

Inspects, queries and carefully modifies the MoviePilot SQLite or PostgreSQL database through a bundled script that reads connection settings itself, without needing the password in the prompt.

GPL-3.0Auto-check passedDatabases

Install MoviePilot Database Operation

skills CLI
$ npx skills add jxxghp/MoviePilot --skill database-operation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jxxghp/MoviePilot database-operation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jxxghp/MoviePilot.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/database-operation .claude/skills/database-operation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
database-operation
GitHub stars
12k
Token cost
~7.3k tokens
SKILL.md length
3,008 words
Files
2 (incl. scripts)
Skills in repo
16
Repo updated
First seen
Licence
GPL-3.0

At a glance

Inspects, queries and carefully modifies the MoviePilot SQLite or PostgreSQL database through a bundled script that reads connection settings itself, without needing the password in the prompt.

  • Works in 5 steps: Prefer existing MoviePilot tools or APIs… → Use this skill for direct database… → For unknown schema, run tables first,… → …
  • Answering a statistics question like how many downloads happened this month
  • SKILL.md covers Scope And Boundaries, Commands, Workflow and Built-in Safety, plus 2 more sections
  • Runs Python scripts from its folder; calls python

What it does

A bundled script, `scripts/mp-db.py`, is the only path to direct database access: it reads MoviePilot's own local settings to connect, so the agent never needs to extract a password, token or full connection string from the user. It can run table listings, statistics and aggregations, as well as SELECT, INSERT, UPDATE, DELETE and schema-changing statements, with broad or destructive writes requiring explicit authorization first.

Before reaching for raw SQL, the guidance points to safer, narrower tools: a structured `moviepilot-api` for normal product operations, a command-dispatch skill for slash commands, a file-organization skill for manual file moves, and a retry skill for failed transfer history. Two categories of system settings are called out as better edited through the API than directly in the database, since the API enforces registered keys, value normalization and secret redaction that direct writes would bypass.

When your agent uses it

  • Answering a statistics question like how many downloads happened this month
  • Inspecting or repairing a stuck subscription or transfer record
  • Running a cleanup request against old database records
  • Querying site or download statistics directly from the database

Example prompts

  • “How many downloads happened through MoviePilot last week?”
  • “This subscription looks stuck — check its database record and tell me why.”
  • “Delete transfer history records older than 90 days.”

Requirements

  • A MoviePilot installation
  • Python, run through the project's own runtime
  • Pre-approved tools (allowed-tools): execute_command

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Prefer existing MoviePilot tools or APIs for normal product workflows.
  2. Use this skill for direct database inspection only when no existing tool covers the request.
  3. For unknown schema, run tables first, then schema .
  4. For SELECT queries, execute directly with a narrow projection and an explicit LIMIT when reading rows.
  5. For INSERT, UPDATE, DELETE, DROP, ALTER, TRUNCATE, CREATE, or REPLACE, use write and report the affected row count.

What it can do on your machine

Read from SKILL.md and the folder at commit 97a6dc3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • execute_command

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

MoviePilot Database Operation loads about 7.3k tokens when it runs. Until then it costs about 134 tokens; SKILL.md has 3,008 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~134
When it runs · the whole SKILL.md, loaded when a task matches
~7.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jxxghp/MoviePilot at commit 97a6dc3, republished under its GPL-3.0 licence (© jxxghp). 3,008 words, ~7,280 tokens.

Download SKILL.mdSave it as .claude/skills/database-operation/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
database-operation
description
Use this skill when you need to inspect, query, maintain, or carefully modify the MoviePilot database. This skill uses the bundled scripts/mp-db.py helper, which reads MoviePilot local settings itself and never requires database passwords or full PostgreSQL DSNs in the agent prompt. Applicable scenarios include data statistics, counts, aggregations, inspecting or fixing records, cleanup requests, and questions like "how many downloads", "show site stats", "delete old records", or "why is this subscription stuck".
allowed-tools
execute_command
version
9

Database Operation

All script paths are relative to this skill file.

Use scripts/mp-db.py for all database access. Do not extract database passwords, API tokens, or full PostgreSQL DSNs from the prompt. The script reads MoviePilot local settings and connects to SQLite or PostgreSQL internally.

Scope And Boundaries

This skill is the direct SQL boundary. It is implemented as a Python script and is appropriate when the agent must inspect records, run data statistics, repair stuck state, or perform an explicitly requested database update.

Run the bundled copy from the MoviePilot program directory with its project runtime, for example:

bash
cd <MOVIEPILOT_ROOT>
python skills/database-operation/scripts/mp-db.py tables

The Agent command environment routes python to the project-specific moviepilot-python entry when available and falls back to the project or Docker VENV_PATH Python otherwise.

The runtime sets MOVIEPILOT_ROOT for copied skills. If you run a copied script directly from <CONFIG_PATH>/agent/skills/, set that variable to the program directory first; otherwise the helper reports how to relocate it. Use the project runtime instead of a system python3.

Prefer safer product surfaces first:

RequestPreferred skill
Normal MoviePilot product operationmoviepilot-api structured operations
Operation outside the structured API catalogA more specific Skill or explicit unsupported result
Slash commands or plugin/system command dispatchcommand-dispatch
Manual file organizationorganize-files
Retry failed transfer history recordstransfer-failed-retry

Use this skill as the final fallback for data access or mutation. It may run SELECT, INSERT, UPDATE, DELETE, and schema-changing statements through the bundled script, but broad or destructive writes still require explicit user authorization.

System settings have two managed sources and should not normally be edited here:

  • Runtime Settings variables are queried and updated by moviepilot-api operations config.system.get / config.system.update; updates perform type conversion and persist to app.env.
  • SystemConfigKey values are stored in the database systemconfig table, but the same API operations must be preferred because they enforce registered keys, plugin mutation admission, value normalization, secret redaction, and configuration-change events.

Use direct SQL against systemconfig only for an explicitly authorized repair when the managed API cannot complete the operation. Inspect the exact row first, avoid broad writes, and verify the managed API can read the repaired value.

Commands

List tables:

bash
python scripts/mp-db.py tables

Show table schema:

bash
python scripts/mp-db.py schema downloadhistory

Run a read query:

bash
python scripts/mp-db.py query "SELECT COUNT(*) AS total FROM downloadhistory"

Read SQL from stdin or a file:

bash
python scripts/mp-db.py query --file /path/to/query.sql

Run a write statement:

bash
python scripts/mp-db.py write "UPDATE subscribe SET state = 'S' WHERE id = 123"

query --write is also supported for compatibility, but prefer the write subcommand for INSERT, UPDATE, DELETE, and schema changes.

Workflow

  1. Prefer existing MoviePilot tools or APIs for normal product workflows.
  2. Use this skill for direct database inspection only when no existing tool covers the request.
  3. For unknown schema, run tables first, then schema <table>.
  4. For SELECT queries, execute directly with a narrow projection and an explicit LIMIT when reading rows.
  5. For INSERT, UPDATE, DELETE, DROP, ALTER, TRUNCATE, CREATE, or REPLACE, use write and report the affected row count.

Built-in Safety

  • query defaults to read-only mode.
  • write executes data updates and schema-changing statements directly.
  • query --write remains available as a compatibility alias for write statements.
  • Multiple SQL statements in one invocation are rejected.
  • Plain SELECT queries get a default LIMIT 100 if no limit is present.
  • Query results are returned exactly as stored. The agent may use sensitive values internally when needed, but must not echo secrets in the final user-facing response unless the user explicitly asks to inspect that value.

Safety Rules

  1. Confirm before destructive or broad write operations when the user has not already clearly authorized the exact change.
  2. Suggest a backup before destructive operations such as DELETE, DROP, or TRUNCATE.
  3. Never run UPDATE or DELETE without a WHERE clause unless the user explicitly intends to affect all rows.
  4. Raw secrets, cookies, passkeys, hashed passwords, OTP secrets, API keys, or tokens may appear in tool output. Use them only for the requested operation and avoid repeating them in the final response unless explicitly requested.
  5. Keep output small. Summarize large results instead of dumping them.

Core Tables

tables returns the tables that exist in the current instance. The catalog below covers every MoviePilot ORM table plus Alembic metadata. Always treat the live schema <table> result as authoritative.

agentchat
  • Purpose: Stores Web Agent and messaging-channel session indexes, titles, previews, and message snapshots.
  • Useful queries: Tracing Agent history or context restoration by user, session, or update time.
  • Write boundary: Owned by the Agent conversation service; do not rewrite message JSON, counters, or ownership.
  • Columns: id, session_id, client_session_id, user_id, username, channel, source, original_chat_id, title, preview, agent_messages, display_messages, message_count, created_at, updated_at
agentinvocation
  • Purpose: Durable Agent write invocation identity and last observed outcome, including confirmed asynchronous submission.
  • Useful queries: Inspect an exact principal and session's running, unknown, pending, succeeded, or failed receipts; compare timestamps when diagnosing an interrupted write.
  • Write boundary: Owned by the host's atomic claim and reconciliation path. Never change IDs, fingerprints, claim tokens, or statuses to bypass duplicate protection. Running and unknown records are recovery state; ordinary retention does not delete them. Pending means submission was confirmed, not that the external task finished. Raw arguments and tool output are not stored here.
  • Columns: id, principal_id, session_id, invocation_id, tool_name, arguments_digest, claim_token, status, summary, created_at, updated_at
agenttask
  • Purpose: Stores one-shot or recurring Agent task definitions, triggers, and the latest execution summary.
  • Useful queries: Inspecting task ownership, enablement, cron/run_at settings, and the latest result.
  • Write boundary: Create, update, enable, disable, or delete tasks through the Agent task API.
  • Columns: id, name, content, trigger_type, cron_expression, run_at, enabled, user_id, username, session_id, channel, source, original_chat_id, last_status, last_run_at, last_result, last_run_id, run_count, created_at, updated_at
agenttaskrun
  • Purpose: Stores the input snapshot, status, timestamps, and result of each Agent task execution.
  • Useful queries: Auditing one run or correlating a failure with task_id, run_id, and trigger source.
  • Write boundary: Execution evidence owned by the task runner; never fabricate rows or edit run status.
  • Columns: id, run_id, task_id, trigger_source, name, content, trigger_type, cron_expression, run_at, user_id, username, session_id, channel, message_source, original_chat_id, status, started_at, finished_at, result
alembic_version
  • Purpose: Records the Alembic migration revision currently applied to the database.
  • Useful queries: Diagnosing startup migration failures or a database/code revision mismatch.
  • Write boundary: Never edit it directly; advance or roll back revisions only through Alembic.
  • Columns: version_num
downloadfailure
  • Purpose: Stores stable fingerprints, media/torrent context, errors, and retry scheduling for failed downloads.
  • Useful queries: Analyzing failure causes, retry counts, next retry time, and affected media or sites.
  • Write boundary: Owned by download-failure compensation; retry or clean records through its business API.
  • Columns: id, fingerprint, type, title, year, media_source, media_id, seasons, episodes, site, site_name, torrent_id, torrent_name, torrent_size, downloader, source, error_message, retry_count, first_failed_at, last_failed_at, next_retry_at
downloadfiles
  • Purpose: Maps downloader task hashes to full paths, save directories, relative files, and active state.
  • Useful queries: Finding task files by downloader/download_hash or diagnosing savepath associations.
  • Write boundary: Maintained by download and transfer flows; do not manually change state or path mappings.
  • Columns: id, downloader, download_hash, fullpath, savepath, filepath, torrentname, state
downloadhistory
  • Purpose: Stores media identity, torrent, downloader, user, and recognition context for submitted downloads.
  • Useful queries: Reviewing download history or tracing a media identity or hash back to its source.
  • Write boundary: Written by the download use case; delete or correct records through the download-history API.
  • Columns: id, path, type, title, year, media_source, media_id, music_type, seasons, episodes, image, poster, downloader, download_hash, torrent_name, torrent_description, torrent_site, userid, username, channel, date, note, media_category_id, media_category, classification_rule_id, classification_policy_revision, classification_source, episode_group, custom_words
mediaserveritem
  • Purpose: Stores the local index and canonical media identity projected from media-server libraries.
  • Useful queries: Checking library presence, server/library/path placement, and season information.
  • Write boundary: This is a rebuildable projection; writes and cleanup belong to media-server synchronization.
  • Columns: id, server, library, item_id, item_type, title, original_title, year, media_source, media_id, path, seasoninfo, note, lst_mod_date
message
  • Purpose: Stores inbound and outbound messages, channels, content, attachments, users, and timestamps.
  • Useful queries: Paging notification history, distinguishing direction, or tracing duplicates by source.
  • Write boundary: Written by messaging and notification services; clean it through the message API or retention job.
  • Columns: id, channel, source, mtype, title, text, image, link, userid, reg_time, action, note
outboxmessage
  • Purpose: Stores externally visible side-effect intents committed atomically with business transactions.
  • Useful queries: Diagnosing pending/processing/failed state, leases, attempts, and the last error.
  • Write boundary: Owned by the Outbox Dispatcher state machine; never mark completion or delete undelivered events manually.
  • Columns: id, event_key, topic, payload_version, payload, status, attempt, next_retry_at, lease_until, last_error, created_at, completed_at
passkey
  • Purpose: Stores WebAuthn/PassKey credentials, public keys, signature counters, and activation state.
  • Useful queries: Authorized authentication diagnostics such as ownership, activation, and last use.
  • Write boundary: Security-sensitive; manage it only through the PassKey API and never disclose credential material.
  • Columns: id, user_id, credential_id, public_key, sign_count, name, aaguid, created_at, last_used_at, is_active, transports
plugindata
  • Purpose: Stores plugin-owned JSON values isolated by plugin_id and key.
  • Useful queries: Diagnosing persistence or migration issues for one explicitly identified plugin and key.
  • Write boundary: The plugin owns these values; prefer plugin capabilities or the plugin-data API.
  • Columns: id, plugin_id, key, value
pluginidentity
  • Purpose: Stores trusted source, payload source, version, receipt, and CAS revision for a physical plugin package.
  • Useful queries: Auditing source binding, package generation, payload application, or identity conflicts.
  • Write boundary: Plugin supply-chain state owned exclusively by installation and update transactions.
  • Columns: id, plugin_id, normalized_plugin_id, trusted_source_type, trusted_source_key, binding_basis, payload_source_type, payload_source_key, declared_version, package_generation, declared_metadata, payload_receipt, revision, created_at, updated_at, bound_at, payload_applied_at
plugininstallation
  • Purpose: Stores plugin installation phase, membership target, identity revisions, and backup state.
  • Useful queries: Diagnosing interrupted installations, rollback conditions, and package or backup presence.
  • Write boundary: Owned by the plugin installation state machine; never advance phase or overwrite evidence manually.
  • Columns: id, transaction_id, plugin_id, phase, membership_before, membership_target, identity_before_revision, identity_target_revision, package_existed, persistent_backup_existed, created_at, updated_at, schema_version
plugininstance
  • Purpose: Stores one row per shared-source plugin runtime instance, covering both clones and the host plugin itself (instance_id equals source_plugin_id, so equality identifies the host and inequality a clone), together with that instance's display overrides, its own log-level override and the moment that override expires, and the plugin's own configuration payload. A clone exists exactly while its row exists, so deleting the row uninstalls the clone and discards its configuration.
  • Useful queries: Diagnosing clone naming and ownership, inspecting what a plugin or one of its clones is configured with, or finding which instance currently overrides the global log level and until when.
  • Write boundary: Owned by the plugin instance, plugin configuration, and plugin log-level APIs; never edit rows directly.
  • Columns: id, instance_id, source_plugin_id, plugin_name, plugin_desc, plugin_icon, is_default_target, is_enabled, log_level, log_expires_at, config_data, created_at, updated_at
searchsession
  • Purpose: Stores the page cursor and pending candidates of one unfinished subscription search task, without site credentials; removed when the task ends and purged after 14 days without updates.
  • Useful queries: Diagnosing a paused or resumed paged search through task_id, version, and updated_at.
  • Write boundary: Written only under the queue task lease with version CAS; never edit payloads, they can skip pages or resubmit candidates.
  • Columns: id, task_id, version, payload, updated_at
Show full SKILL.md (1,232 more words)Show less
site
  • Purpose: Stores private-tracker URLs, RSS, credentials, rate limits, proxy state, and downloader binding.
  • Useful queries: Inspecting enablement, domain, rate limits, or downloader binding with minimal credential exposure.
  • Write boundary: Contains cookies, API keys, and tokens; manage it through the site API.
  • Columns: id, name, domain, url, pri, rss, cookie, ua, apikey, token, proxy, filter, render, public, note, limit_interval, limit_count, limit_seconds, timeout, is_active, lst_mod_date, downloader
siteicon
  • Purpose: Caches site names, domains, icon URLs, and Base64 icon content.
  • Useful queries: Diagnosing missing icons, incorrect domain mapping, or cache generation.
  • Write boundary: Rebuildable cache owned by site-icon synchronization; direct writes are not recommended.
  • Columns: id, name, domain, url, base64
sitestatistic
  • Purpose: Aggregates site request successes, failures, durations, latest state, and diagnostic notes.
  • Useful queries: Comparing site availability, failure rate, and the most recent access state.
  • Write boundary: Accumulated by site access statistics; never edit counters to conceal runtime behavior.
  • Columns: id, domain, success, fail, seconds, lst_state, lst_mod_date, note
siteuserdata
  • Purpose: Stores tracker account level, traffic, ratio, seeding, and unread-message data.
  • Useful queries: Inspecting account state, traffic trends, seeding volume, and the latest collection error.
  • Write boundary: A site-scraping projection refreshed by synchronization; do not edit it directly.
  • Columns: id, domain, name, username, userid, user_level, join_at, bonus, upload, download, ratio, seeding, leeching, seeding_size, leeching_size, seeding_info, message_unread, message_unread_contents, err_msg, updated_day, updated_time
subscribe
  • Purpose: Stores active movie, TV, or music subscriptions, filters, progress, and download targets.
  • Useful queries: Inspecting state, missing episodes/tracks, quality rules, site scope, and match progress.
  • Write boundary: Create, update, search, or delete through the subscription API to preserve state-machine consistency.
  • Columns: id, name, year, type, search_interval, keyword, media_source, media_id, music_type, total_tracks, downloaded_tracks, season, poster, backdrop, vote, description, filter, include, exclude, quality, resolution, effect, audio_quality, audio_format, min_bitrate, min_bit_depth, min_sample_rate, total_episode, start_episode, lack_episode, note, state, last_search, last_update, date, username, sites, downloader, best_version, best_version_full, current_priority, current_audio_format, current_bitrate, current_bit_depth, current_sample_rate, episode_priority, save_path, search_imdbid, manual_total_episode, custom_words, media_category_id, media_category, filter_groups, episode_group
subscribehistory
  • Purpose: Stores snapshots of completed or archived subscriptions and their final filter state.
  • Useful queries: Auditing historical subscriptions, media identity, completion criteria, and filter configuration.
  • Write boundary: Generated by subscription completion and archival; restore or delete through its business API.
  • Columns: id, name, year, type, search_interval, keyword, media_source, media_id, music_type, total_tracks, season, poster, backdrop, vote, description, filter, include, exclude, quality, resolution, effect, audio_quality, audio_format, min_bitrate, min_bit_depth, min_sample_rate, total_episode, start_episode, date, username, sites, best_version, best_version_full, current_priority, current_audio_format, current_bitrate, current_bit_depth, current_sample_rate, episode_priority, save_path, search_imdbid, custom_words, media_category_id, media_category, classification_rule_id, classification_policy_revision, classification_source, filter_groups, episode_group
subscriptionsearchbatch
  • Purpose: Stores durable subscription search batches, source, aggregate state, counts, and cancellation requests.
  • Useful queries: Inspecting user-visible search progress, recovery state, cancellation, and terminal outcomes.
  • Write boundary: Owned by subscription search orchestration; create and cancel batches through the subscription API.
  • Columns: id, batch_id, source, state, priority, total_count, finished_count, failed_count, cancelled_count, skipped_count, cancel_requested, created_at, updated_at, started_at, finished_at, last_error
subscriptionsearchtask
  • Purpose: Stores one durable subscription search task per batch and subscription with leases and execution phases.
  • Useful queries: Diagnosing queued, running, failed, cancelled, or recovered work and its current site.
  • Write boundary: Advanced only by the search queue lease state machine; never rewrite leases or terminal states manually.
  • Columns: id, task_id, batch_id, subscription_id, active_key, source, priority, position, state, phase, current_site_id, pending_site_ids, attempt_count, cancel_requested, lease_owner, lease_token, lease_expires_at, available_at, created_at, updated_at, started_at, finished_at, last_error
subscriptionsitebudget
  • Purpose: Stores per-site subscription search concurrency, cooldown, health, and fairness state.
  • Useful queries: Diagnosing site pressure, cooldown deferrals, recent failures, and active search ownership.
  • Write boundary: Owned by the subscription site-budget coordinator; do not clear cooldowns or counters by direct SQL.
  • Columns: id, site_id, lease_owner, lease_token, lease_expires_at, next_allowed_at, consecutive_failures, success_streak, last_outcome, last_error, updated_at
systemconfig
  • Purpose: Stores JSON business configuration values keyed by SystemConfigKey.
  • Useful queries: Verifying the physical value only when the managed settings API behaves unexpectedly.
  • Write boundary: Use config.system.get/update first; direct writes bypass validation, events, and plugin admission.
  • Columns: id, key, value
transferexecutionstep
  • Purpose: Stores intent, attempt identity, state, and result evidence for each durable transfer operation.
  • Useful queries: Diagnosing stuck, failed, or repeated steps by task_id or operation_id.
  • Write boundary: Owned by the transfer execution state machine and lease CAS; never force state transitions manually.
  • Columns: id, task_id, operation_id, checkpoint_fingerprint, ordinal, phase, kind, state, attempt_token, attempt_count, intent_version, intent_payload, result_version, result_payload, last_error, prepared_at, started_at, completed_at, updated_at
transferhistory
  • Purpose: Stores transfer source, destination, mode, media identity, download linkage, and outcome.
  • Useful queries: Reviewing success/failure history, destination paths, media classification, and download linkage.
  • Write boundary: Written by transfer settlement; delete or retry through transfer-history business APIs.
  • Columns: id, transfer_task_id, transfer_settlement_revision, src, src_storage, src_fileitem, dest, dest_storage, dest_fileitem, mode, type, media_category_id, category, classification_rule_id, classification_policy_revision, classification_source, title, year, media_source, media_id, music_type, total_tracks, audio_format, audio_lossless, bit_depth, sample_rate, bitrate, seasons, episodes, image, downloader, download_hash, status, errmsg, retry_count, auto_paused, failure_stage, recovery_action, cleanup_status, cleanup_error, date, files, episode_group
transferpending
  • Purpose: Durably stores pending transfer input, plans, checkpoints, leases, retries, and manual review state.
  • Useful queries: Diagnosing restart recovery, expired leases, retry_wait, terminal failures, or manual review.
  • Write boundary: Core durable state machine advanced only by planning, execution, retry, and review services.
  • Columns: id, task_id, storage, src_path, created_at, state, updated_at, last_error, input_version, planning_input, input_fingerprint, checkpoint_version, checkpoint_payload, planned_at, lease_owner, lease_token, lease_expires_at, heartbeat_at, attempt_count, execution_state, execution_version, execution_payload, execution_fingerprint, retry_generation, retry_count, retry_due_at, retry_requested_by, retry_reason, settlement_revision, terminal_history_id, manual_review_revision, reviewed_at, reviewed_by, review_reason, review_decision
transfersettlementreceipt
  • Purpose: Stores immutable terminal settlement receipts with contiguous revisions per transfer task.
  • Useful queries: Verifying that history, pending deletion, and execution fingerprints were settled reliably.
  • Write boundary: Idempotency and audit evidence; append revisions only and never overwrite or delete old receipts.
  • Columns: id, task_id, history_id, settlement_revision, outcome, execution_fingerprint, lease_token, history_status, src, src_storage, pending_deleted, error, created_at, updated_at
user
  • Purpose: Stores user accounts, password hashes, administrator state, OTP, permissions, and preferences.
  • Useful queries: Authorized diagnostics of account state, permissions, or authentication configuration.
  • Write boundary: Security-sensitive; manage through user, permission, password, and two-factor APIs.
  • Columns: id, name, email, hashed_password, is_active, is_superuser, avatar, is_otp, otp_secret, permissions, settings
userconfig
  • Purpose: Stores per-user JSON configuration isolated by username and key.
  • Useful queries: Inspecting UI preferences, message clear cursors, or other personalized state.
  • Write boundary: Modify through the owning user or messaging API to preserve key semantics.
  • Columns: id, username, key, value
workflow
  • Purpose: Stores workflow definitions, triggers, action graphs, execution context, and runtime state.
  • Useful queries: Inspecting scheduled/event workflows, pause state, current action, run count, and failures.
  • Write boundary: Create, modify, run, pause, or reset through the workflow API.
  • Columns: id, name, description, timer, trigger_type, event_type, event_conditions, state, current_action, result, run_count, actions, flows, context, execution_config, execution_state, add_time, last_time

Database Action Contract

  • tables: arguments={} lists current database tables.
  • schema: arguments={"table_name":"downloadhistory"}; table_name must come from tables.
  • query: arguments={"sql":"SELECT ...","limit":100,"write":false}; provide exactly one of sql and file. SELECT/WITH/EXPLAIN are allowed by default.
  • write: arguments={"sql":"UPDATE ... WHERE ..."}; provide exactly one of sql and file and only one statement.
  • file is a local SQL path readable by the MoviePilot process. MCP clients normally send sql directly.

Use the live schema result instead of guessing columns from older documentation. Treat media_source and media_id as one atomic identity pair.

Common Queries

Total downloads:

sql
SELECT COUNT(*) AS total FROM downloadhistory

Recent download history:

sql
SELECT title, year, type, torrent_site, date FROM downloadhistory ORDER BY id DESC LIMIT 10

Failed transfers:

sql
SELECT id, title, src, errmsg, date FROM transferhistory WHERE status = 0 ORDER BY id DESC LIMIT 10

Active subscriptions:

sql
SELECT name, year, type, season, state, lack_episode FROM subscribe WHERE state = 'R' LIMIT 50

Site upload/download statistics:

sql
SELECT name, domain, upload, download, ratio, bonus, seeding, user_level FROM siteuserdata ORDER BY upload DESC LIMIT 50

Media library statistics:

sql
SELECT server, library, COUNT(*) AS count FROM mediaserveritem GROUP BY server, library

Site access success rate:

sql
SELECT domain, success, fail, ROUND(success * 100.0 / (success + fail), 1) AS success_rate FROM sitestatistic WHERE success + fail > 0 ORDER BY success_rate DESC LIMIT 50

Plugin data keys:

sql
SELECT plugin_id, key FROM plugindata ORDER BY plugin_id, key LIMIT 100

SQL Dialect Notes

FeatureSQLitePostgreSQL
Boolean values0 / 1false / true
String concat`
Current timedatetime('now')NOW()
JSON accessjson_extract(col, '$.key')col->>'key'
Case-insensitive matchLIKEILIKE

Troubleshooting

  • Missing dependency: run inside the MoviePilot project environment so SQLAlchemy and database drivers are available.
  • Connection failure: verify MoviePilot config with moviepilot doctor.
  • Table not found: run python scripts/mp-db.py tables, then inspect the table with schema.

© jxxghp, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (scripts) in skills/database-operation of jxxghp/MoviePilot.

  • SKILL.md
  • scripts/mp-db.py

Open the folder on GitHubat commit 97a6dc3

Compare with similar skills

MoviePilot Database Operation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

MoviePilot Database Operation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
MoviePilot Database Operation this skilljxxghp/MoviePilot12k—~7.3kAutomated safety check: PassGPL-3.0
Matlab Use Databasematlab/matlab-agentic-toolkit1.1k—~3.1kAutomated safety check: PassCustom licence
SQL Database Support for pRESTprest/prest4.6k—~1.6kAutomated safety check: PassMIT
Chdb SQLvemetric/vemetric3941 repos~1.2kAutomated safety check: PassApache-2.0
PostgreSQL Documentation Reference2025Emma/vibe-coding-cn23k1 repos~19kAutomated safety check: PassMIT
Squixeduardofuncao/squix273—~784Automated safety check: PassMIT

Similar skills

  • Matlab Use Database

    matlab/matlab-agentic-toolkit

    Reads from, writes to, and manages relational databases using MATLAB Database Toolbox.

    1.1k GitHub stars~3.1k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Guides classifying, gap-analyzing and scaffolding support for a new SQL database in pREST, from Postgres-compatible variants to entirely new dialects.

    4.6k GitHub stars~1.6k tokensUpdated today
    DatabasesAuto-check passed
  • Chdb SQL

    vemetric/vemetric

    A skill your agent uses when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse…

    394 GitHub starsUsed in 1 repo~1.2k tokens
    DatabasesAuto-check passed
  • PostgreSQL Documentation Reference

    2025Emma/vibe-coding-cn

    PostgreSQL database documentation - SQL queries, database design, administration, performance tuning, and advanced features. Use when working with PostgreSQL…

    23k GitHub starsUsed in 1 repo~19k tokens
    DatabasesAuto-check passed
  • Squix

    eduardofuncao/squix

    Run SQL queries across databases (Postgres, MySQL, SQLite, etc.) via the squix CLI.

    273 GitHub stars~784 tokensUpdated 16 days ago
    DatabasesAuto-check passed
  • DB Ops Sop

    OpenDCAI/DataMind

    Database operations runbook — backup, recovery, performance tuning, troubleshooting.

    423 GitHub stars~388 tokensUpdated 18 days ago
    DatabasesAuto-check passed

More from jxxghp/MoviePilot

All 16 skills in this repo
  • Inspects, diagnoses and directly controls qBittorrent, Transmission or rTorrent downloaders configured in MoviePilot through a bundled Python helper.

    12k GitHub stars~4.4k tokensUpdated today
    Auto-check passed
  • Turns a confirmed MoviePilot bug or feature request into a structured upstream GitHub issue, but only after local diagnosis and an explicit request to file.

    12k GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Inspects and operates Emby, Jellyfin, Plex and other media servers configured in MoviePilot through one helper script, without exposing stored credentials.

    12k GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Publish MoviePilot Plugin

    jxxghp/MoviePilot

    Publishes and syncs a local MoviePilot plugin to a GitHub repository, merging only that plugin's package entry and previewing differences before writing.

    12k GitHub stars~1.9k tokensUpdated today
    Auto-check: notes
  • AnySearch

    jxxghp/MoviePilot

    Gives your agent a real-time search service for web queries, domain-specific lookups, parallel batch searches and full-page URL extraction.

    12k GitHub starsUsed in 2 repos~2.7k tokens
    Auto-check: notes
  • Submits code changes as a GitHub pull request through an isolated Git clone, reusing or creating your fork and pushing only after you confirm the real diff.

    12k GitHub stars~1.1k tokensUpdated today
    Auto-check: notes

Categories

Questions about MoviePilot Database Operation

What does MoviePilot Database Operation do?

Inspects, queries and carefully modifies the MoviePilot SQLite or PostgreSQL database through a bundled script that reads connection settings itself, without needing the password in the prompt. py`, is the only path to direct database access: it reads MoviePilot's own local settings to connect, so the agent never needs to extract a password, token or full connection string from the user. It can run table listings, statistics and aggregations, as well as SELECT, INSERT, UPDATE, DELETE and schema-changing statements, with broad or destructive writes requiring explicit authorization first.

When should I use MoviePilot Database Operation?

MoviePilot Database Operation fits situations like: answering a statistics question like how many downloads happened this month; inspecting or repairing a stuck subscription or transfer record; running a cleanup request against old database records; querying site or download statistics directly from the database.

How do I install MoviePilot Database Operation in Claude Code?

Run `npx skills add jxxghp/MoviePilot --skill database-operation -a claude-code`. Or copy the skill folder (skills/database-operation in jxxghp/MoviePilot) into .claude/skills/database-operation in your project. Claude Code loads it when a task matches its description.

How do I install MoviePilot Database Operation in Codex?

Run `npx skills add jxxghp/MoviePilot --skill database-operation -a codex`. Or copy the skill folder (skills/database-operation in jxxghp/MoviePilot) into .agents/skills/database-operation in your project. Codex loads it when a task matches its description.

Can I use MoviePilot Database Operation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jxxghp/MoviePilot --skill database-operation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/database-operation, .gemini/skills/database-operation, .github/skills/database-operation and .opencode/skills/database-operation in your project.

What does MoviePilot Database Operation need to run?

Going by SKILL.md and its folder, MoviePilot Database Operation needs Python for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: A MoviePilot installation; Python, run through the project's own runtime. Its frontmatter pre-approves these tools: execute_command.

Does MoviePilot Database Operation access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is MoviePilot Database Operation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does MoviePilot Database Operation use?

MoviePilot Database Operation is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does MoviePilot Database Operation use?

About 7.3k tokens (SKILL.md is roughly 29k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to MoviePilot Database Operation?

Skills that share tags, products or a category with MoviePilot Database Operation: Matlab Use Database (matlab/matlab-agentic-toolkit, 1.1k stars), SQL Database Support for pREST (prest/prest, 4.6k stars), Chdb SQL (vemetric/vemetric, 394 stars) and PostgreSQL Documentation Reference (2025Emma/vibe-coding-cn, 23k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains MoviePilot Database Operation?

jxxghp (a GitHub user) maintains it in jxxghp/MoviePilot, which has 11,844 GitHub stars. The repository holds 16 skills in this directory. The repository was last updated on October 8, 2026.

Source: jxxghp/MoviePilot on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.