Skip to content
Automation
Skill

/database-operation

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

From plugin
moviepilot
12k16 skills

Claude Code

$ npx -y skills add jxxghp/moviepilot --skill database-operation --agent claude-code

SKILL.md

database-operation.SKILL.md
name: database-operation
version: 18
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

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:

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:

| Request | Preferred skill | |---|---| | Normal MoviePilot product operation | `moviepilot-api` structured operations | | Operation outside the structured API catalog | A more specific Skill or explicit unsupported result | | Slash commands or plugin/system command dispatch | `command-dispatch` | | Manual file organization | `organize-files` | | Retry failed transfer history records | `transfer-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. The script blocks any statement that references `systemconfig` until you pass `--show-secrets`, so inspect the exact row first, avoid broad writes, and verify the managed API can read the repaired value.

Commands

List tables:

python scripts/mp-db.py tables

Show table schema:

python scripts/mp-db.py schema downloadhistory

Run a read query:

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

Read SQL from stdin or a file:

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

Run a write statement:

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.

SQLite also checks the actual table accesses while executing each statement, including single-quoted table names and reads through views. The temporary authorizer is removed when that statement finishes. PostgreSQL retains the identifier check described below.

Statements that reference `systemconfig` are rejected until you add `--show-secrets`, in read and write mode alike:

python scripts/mp-db.py query "SELECT key, value FROM systemconfig WHERE key = 'TMDB_API_KEY'" --show-secrets

The gate is per table, not per column, so even a count or key listing over `systemconfig` needs the flag. Read normal settings through `moviepilot-api` `config.system.get` instead, which redacts secrets for you, and pass the flag only for an explicitly authorized repair.

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.
  • Keywords and semicolons inside SQL literals, quoted identifiers, and comments

do not change a query into a write or a multi-statement request. Unclosed lexical structures remain invalid.

  • Plain `SELECT` queries get a default `LIMIT 100` if no limit is present.
  • `systemconfig` aggregates every instance-level API key, cookie and password,

so it stays unreadable and unwritable until you pass `--show-secrets

Read more
@jxxghp
Ships withmoviepilot

基于 NAStool 部分代码重新设计,聚焦自动化核心需求,减少问题同时更易于扩展和维护。

Stars on GitHub

Momentum

stars in total
12.1k
Star history of jxxghp/moviepilot on GitHub, a chart by star-history.com

Other skills on moviepilot.

anysearch

anysearch

API key for higher rate limits. Anonymous access available with lower rate limits.

@jxxghp@jxxghpInstall Skill
browser-use

browser-use

Use this skill when the user asks the agent to open, browse, inspect, extract content from, click through, fill forms on,…

@jxxghp@jxxghpInstall Skill
command-dispatch

command-dispatch

Use this skill when the user sends a slash command or asks to run a MoviePilot system or plugin command in natural language.…

@jxxghp@jxxghpInstall Skill
create-moviepilot-plugin

create-moviepilot-plug…

Use this skill when the user asks to create, modify, debug, validate, or scaffold a MoviePilot local plugin. Covers version-aware…

@jxxghp@jxxghpInstall Skill
create-moviepilot-skill

create-moviepilot-skil…

Use this skill when the user asks to create, scaffold, update, or review a MoviePilot agent skill. This includes adding a new…

@jxxghp@jxxghpInstall Skill
downloader-operation

downloader-operation

Use this skill when the user asks to inspect, diagnose, or directly control a configured qBittorrent, Transmission, or rTorrent…

@jxxghp@jxxghpInstall Skill

More skills from other plugins.

agent-builder

agent-builder

Load immediately after an Agent intent, before the first agent_builder_* call. Governs how you create, configure, test, and…

n8n11d209k
@n8n-io@n8n-ioInstall Skill
browser-use

browser-use

Direct browser control via CDP for web interaction: automation, scraping, testing, screenshots, and site/app work. Also covers…

@browser-use@browser-useInstall Skill
agent-browser

agent-browser

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…

@vercel-labs-2@vercel-labs-2Install Skill
add-anydoc

add-anydoc

Add local office-document-to-Markdown conversion to NanoClaw agent containers with the pinned Firecrawl AnyDoc CLI. Use when…

@nanocoai@nanocoaiInstall Skill

Questions about database-operation.

Which coding agents can use database-operation?
database-operation installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.