/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
$ npx -y skills add jxxghp/moviepilot --skill database-operation --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/database-operation
Context preview
The summary Claude sees to decide when to auto-load this skill.
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
SKILL.md
database-operation.SKILL.mdname: database-operation
version: 3
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".
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.
Prefer safer product surfaces first:
| Request | Preferred skill | |---|---| | Normal local MoviePilot product operation exposed as an MCP tool | `moviepilot-cli` | | Direct REST endpoint call | `moviepilot-api` | | 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.
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.
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
downloadhistory
Key columns: `id`, `path`, `type`, `title`, `year`, `tmdbid`, `imdbid`, `doubanid`, `seasons`, `episodes`, `downloader`, `download_hash`, `torrent_name`, `torrent_site`, `userid`, `username`, `date`, `media_category`
downloadfiles
Key columns: `id`, `downloader`, `download_hash`, `fullpath`, `savepath`, `filepath`, `torrentname`, `state`
transferhistory
Music rows persist actual `audio_format`, `audio_lossless`, `bit_depth`, `sample_rate`, and `bitrate` values read during organization. Bitrate uses bps and sample rate uses Hz. Key columns: `id`, `src`, `dest`, `mode`, `type`, `category`, `title`, `year`, `tmdbid`, `seasons`, `episodes`, `download_hash`, `status`, `errmsg`, `date`
subscribe
Music filters use `audio_quality`, `audio_format`, `min_bitrate`, `min_bit_depth`, and `min_sample_rate`. Quality upgrades reuse `current_priority` and persist the current exact values in `current_audio_format`, `current_bitrate`, `current_bit_depth`, and `current_sample_rate`. Key columns: `id`, `name`, `year`, `type`, `tmdbid`, `doubanid`, `season`, `total_episode`, `start_episode`, `lack_episode`, `state`, `filter`, `include`, `exclude`, `quality`, `resolution`, `sites`, `best_version`, `best_version_full`, `date`, `username`
subscribehistory
Completed music subscriptions retain both audio filters and the final current-quality snapshot for auditing. Key columns: `id`, `name`, `year`, `type`, `tmdbid`, `doubanid`, `season`, `total_episode`, `start_episode`, `date`, `username`
user
Key columns: `id`, `name`, `email`, `is_active`, `is_superuser`, `permissions`, `settings`
site
Key columns: `id`, `name`, `domain`, `url`, `pri`, `cookie`, `proxy`, `is_active`, `downloader`, `limit_interval`, `limit_count`
siteuserdata
Key columns: `id`, `domain`, `name`, `username`, `us
Read more
name: database-operation version: 3 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".
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.
Prefer safer product surfaces first:
| Request | Preferred skill | |---|---| | Normal local MoviePilot product operation exposed as an MCP tool | `moviepilot-cli` | | Direct REST endpoint call | `moviepilot-api` | | 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.
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.
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
downloadhistory
Key columns: `id`, `path`, `type`, `title`, `year`, `tmdbid`, `imdbid`, `doubanid`, `seasons`, `episodes`, `downloader`, `download_hash`, `torrent_name`, `torrent_site`, `userid`, `username`, `date`, `media_category`
downloadfiles
Key columns: `id`, `downloader`, `download_hash`, `fullpath`, `savepath`, `filepath`, `torrentname`, `state`
transferhistory
Music rows persist actual `audio_format`, `audio_lossless`, `bit_depth`, `sample_rate`, and `bitrate` values read during organization. Bitrate uses bps and sample rate uses Hz. Key columns: `id`, `src`, `dest`, `mode`, `type`, `category`, `title`, `year`, `tmdbid`, `seasons`, `episodes`, `download_hash`, `status`, `errmsg`, `date`
subscribe
Music filters use `audio_quality`, `audio_format`, `min_bitrate`, `min_bit_depth`, and `min_sample_rate`. Quality upgrades reuse `current_priority` and persist the current exact values in `current_audio_format`, `current_bitrate`, `current_bit_depth`, and `current_sample_rate`. Key columns: `id`, `name`, `year`, `type`, `tmdbid`, `doubanid`, `season`, `total_episode`, `start_episode`, `lack_episode`, `state`, `filter`, `include`, `exclude`, `quality`, `resolution`, `sites`, `best_version`, `best_version_full`, `date`, `username`
subscribehistory
Completed music subscriptions retain both audio filters and the final current-quality snapshot for auditing. Key columns: `id`, `name`, `year`, `type`, `tmdbid`, `doubanid`, `season`, `total_episode`, `start_episode`, `date`, `username`
user
Key columns: `id`, `name`, `email`, `is_active`, `is_superuser`, `permissions`, `settings`
site
Key columns: `id`, `name`, `domain`, `url`, `pri`, `cookie`, `proxy`, `is_active`, `downloader`, `limit_interval`, `limit_count`
siteuserdata
Key columns: `id`, `domain`, `name`, `username`, `us
Repo: jxxghp/moviepilot
Other skills on moviepilot.
- /anysearch
API key for higher rate limits. Anonymous access available with lower rate limits.
Open skill - /browser-use
Use this skill when the user asks the agent to open, browse, inspect, extract content from, click through, fill forms on, screenshot, or verify a web page with a browser. Also use it for MoviePilot scenarios that need browser interaction, such as checking a site page, confirming
Open skill - /command-dispatch
Use this skill when the user's intent is to execute a system or plugin function. Applicable scenarios include: 1) The user sends a slash command starting with / (e.g. /cookiecloud, /sites, /subscribes, etc.); 2) The user describes an action in natural language that can be
Open skill - /create-moviepilot-plugin
Use this skill when the user asks to create, modify, debug, validate, or scaffold a MoviePilot local plugin. Covers MoviePilot V2 plugin development, _PluginBase implementations, package.v2.json/package.json market metadata, plugins.v2/plugins source layout,
Open skill - /create-moviepilot-skill
Use this skill when the user asks to create, scaffold, update, or review a MoviePilot agent skill. This includes adding a new built-in skill under the repository `skills/` directory, editing an existing built-in skill, writing `SKILL.md` frontmatter and workflow instructions,
Open skill - /feedback-issue
Use this skill ONLY when the user EXPLICITLY requests filing an upstream issue for MoviePilot core, frontend, or an installed plugin, for example "反馈 issue", "提 issue", "报 bug", "给 MP 提 issue", "让上游修一下", "提交错误报告", "提问题", "提需求", "功能请求", or English "file an issue / report a bug /
Open skill

