Token导航 LogoToken导航TokenDH.com
运维和基础设施执行命令github未标认证来源可访问许可证需确认审计异常

database-operation数据库操作

Agent Skill

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

总安装

768

周安装

32

GitHub Stars

11,023

下载量

256
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:database-operation(数据库操作)
来源仓库:https://github.com/jxxghp/moviepilot
仓库路径:skills/database-operation
安装命令:
npx skills add https://github.com/jxxghp/moviepilot --skill database-operation
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/jxxghp/moviepilot --skill database-operation

简介

针对 MoviePilot 系统的专用 SQL 查询执行辅助工具。

  • 支持 SQLite 与 PostgreSQL 两种连接方式自动识别处理。
  • 可直接运行 SELECT/UPDATE 等命令读取或修改应用数据。
  • 需依赖系统已配置的数据库连接凭证方可正常使用。
  • database-operation 属于运维和基础设施类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Database Query (数据库查询)

This skill guides you through executing SQL against the MoviePilot database. Both read and write operations are supported.

Prerequisites

You need the following tools:

  • execute_command - Execute shell commands to run database queries

Getting Database Connection Info

The system prompt <system_info> section already contains all the database connection details you need:

  • 数据库类型sqlite or postgresql
  • 数据库 — Full connection info:

- For SQLite: the database file path, e.g. SQLite (/config/db/moviepilot.db) - For PostgreSQL: the connection string, e.g. PostgreSQL (user:password@host:port/database)

Do NOT run any detection commands. Extract the database type and connection details directly from <system_info>.

Executing Queries

SQLite Mode

Extract the database file path from <system_info> (the path inside the parentheses after SQLite).

Use execute_command to run queries:

sqlite3 -header -column <DB_PATH> "YOUR SQL QUERY HERE;"

For JSON-formatted output (easier to parse):

sqlite3 -json <DB_PATH> "YOUR SQL QUERY HERE;"

List all tables:

sqlite3 -header -column <DB_PATH> "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"

View table schema:

sqlite3 <DB_PATH> ".schema tablename"

PostgreSQL Mode

Extract the connection parameters from <system_info> (parse user:password@host:port/database from the parentheses after PostgreSQL).

Use execute_command to run queries via psql:

PGPASSWORD=<password> psql -h <host> -p <port> -U <user> -d <database> -c "YOUR SQL QUERY HERE;"

List all tables:

PGPASSWORD=<password> psql -h <host> -p <port> -U <user> -d <database> -c "SELECT tablename FROM pg_tables WHERE schemaname='public' ORDER BY tablename;"

View table schema:

PGPASSWORD=<password> psql -h <host> -p <port> -U <user> -d <database> -c "\d tablename"

Interpret Results

After executing the query, analyze the results and present them in a clear, user-friendly format. Use aggregation, sorting, and filtering as needed.

Database Schema Reference

MoviePilot uses the following 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 (整理历史)

Key columns: id, src, dest, mode, type, category, title, year, tmdbid, seasons, episodes, download_hash, status (boolean: true=success, false=failed), errmsg, date

subscribe (订阅)

Key columns: id, name, year, type, tmdbid, doubanid, season, total_episode, start_episode, lack_episode, state ('N'=new, 'R'=running, 'S'=paused), filter, include, exclude, quality, resolution, sites, best_version, date, username

subscribehistory (订阅历史)

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 (priority), cookie, proxy, is_active, downloader, limit_interval, limit_count

siteuserdata (站点用户数据)

Key columns: id, domain, name, username, user_level, bonus, upload, download, ratio, seeding, leeching, seeding_size, updated_day

sitestatistic (站点统计)

Key columns: id, domain, success, fail, seconds, lst_state, lst_mod_date

mediaserveritem (媒体库条目)

Key columns: id, server, library, item_id, item_type, title, original_title, year, tmdbid, imdbid, tvdbid, path

systemconfig (系统配置)

Key columns: id, key, value (JSON)

userconfig (用户配置)

Key columns: id, username, key, value (JSON)

plugindata (插件数据)

Key columns: id, plugin_id, key, value (JSON)

message (消息)

Key columns: id, channel, source, mtype, title, text, image, link, userid, reg_time

workflow (工作流)

Key columns: id, name, description, timer, trigger_type, event_type, state ('W'=waiting, 'R'=running), run_count, actions, flows, last_time

passkey (通行密钥)

Key columns: id, user_id, credential_id, public_key, name, created_at, last_used_at, is_active

siteicon (站点图标)

Key columns: id, name, domain, url, base64

Common Query Examples

Count total downloads

SELECT COUNT(*) AS total FROM downloadhistory;

Recent download history

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

Failed transfers

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

Active subscriptions

SELECT name, year, type, season, state, lack_episode FROM subscribe WHERE state = 'R';

Site upload/download statistics

SELECT name, domain, upload, download, ratio, bonus, seeding, user_level FROM siteuserdata ORDER BY upload DESC;

Media library statistics

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

Site access success rate

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;

Plugin data inspection

SELECT plugin_id, key FROM plugindata ORDER BY plugin_id, key;

Delete old download history (write operation)

DELETE FROM downloadhistory WHERE date < '2024-01-01';

Update subscription state (write operation)

UPDATE subscribe SET state = 'S' WHERE id = 123;

Clean up failed transfer records (write operation)

DELETE FROM transferhistory WHERE status = 0 AND date < '2024-06-01';

Safety Rules

  1. Confirm before writing — For any INSERT, UPDATE, DELETE, DROP, ALTER, or TRUNCATE operation, always describe what the statement will do and ask the user to confirm before executing. For SELECT queries, execute directly without confirmation
  2. Back up before destructive operations — Before executing DELETE, DROP, or TRUNCATE on important tables, suggest the user back up the data first (e.g., export with .dump for SQLite or pg_dump for PostgreSQL)
  3. Use WHERE clauses — Never run UPDATE or DELETE without a WHERE clause unless the user explicitly intends to affect all rows
  4. Use LIMIT for queries — When querying large tables with SELECT, add LIMIT to prevent excessive output
  5. Sensitive data — The site table contains cookie, apikey, and token fields. NEVER display these values to the user. Exclude them from SELECT or replace with '***'
  6. Password data — The user table contains hashed_password and otp_secret fields. NEVER display these values
  7. Output limits — If the query results are very long, summarize or truncate them

SQL Dialect Differences

When writing queries, be aware of differences between SQLite and PostgreSQL:

FeatureSQLitePostgreSQL
Boolean values0 / 1false / true
String concat`\\``\\ or CONCAT()`
Current timedatetime('now')NOW()
LIMIT syntaxLIMIT nLIMIT n
JSON accessjson_extract(col, '$.key')col->>'key'
Case sensitivityCase-insensitive by defaultCase-sensitive
LIKECase-insensitiveUse ILIKE for case-insensitive

Troubleshooting

  • sqlite3 not found: The sqlite3 CLI should be pre-installed in the MoviePilot Docker container. If missing, you can try using Python: python3 -c "import sqlite3;..."
  • psql not found: For PostgreSQL, if psql is not available, use Python: python3 -c "import psycopg2;..."
  • Permission denied: Database queries require admin privileges
  • Table not found: Use the "list all tables" query first to verify table names

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.57%
按下载量换算91

Claude

29.97%
按下载量换算77

Cursor

16.37%
按下载量换算42

Gemini CLI

8.98%
按下载量换算23

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

未通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/jxxghp/moviepilot --skill database-operation 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills