# Database Operation

Use this skill when you need to inspect, query, maintain, or carefully modify the...

- Repository: https://github.com/jxxghp/MoviePilot (12002 stars)
- Category: Data and ML
- License: GPL-3.0
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add jxxghp/MoviePilot --skill database-operation -g -a claude-code -y`
Codex: `npx skills add jxxghp/MoviePilot --skill database-operation -g -a codex -y`
Cursor: `npx skills add jxxghp/MoviePilot --skill database-operation -g -a cursor -y`
Gemini CLI: `npx skills add jxxghp/MoviePilot --skill database-operation -g -a gemini-cli -y`

## 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".

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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:

| 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:

The rest: https://github.com/jxxghp/MoviePilot/blob/HEAD/skills/database-operation/SKILL.md
