MoviePilot Database Operation
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.
Optimize slow PostgreSQL inserts in Python using psycopg2. An agent skill from divinevideo/divine-mobile.
$ npx skills add divinevideo/divine-mobile --skill psycopg2-batch-insert-optimization -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install divinevideo/divine-mobile psycopg2-batch-insert-optimization --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/divinevideo/divine-mobile.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/psycopg2-batch-insert-optimization .claude/skills/psycopg2-batch-insert-optimization && rm -rf skills-srcUse ~/.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/
Install the "psycopg2-batch-insert-optimization" agent skill from https://github.com/divinevideo/divine-mobile/tree/main/.agents/skills/psycopg2-batch-insert-optimization into .claude/skills/psycopg2-batch-insert-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "psycopg2-batch-insert-optimization", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/divinevideo/divine-mobile/tree/main/.agents/skills/psycopg2-batch-insert-optimizationType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add divinevideo/divine-mobile --skill psycopg2-batch-insert-optimization -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install divinevideo/divine-mobile psycopg2-batch-insert-optimization --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/divinevideo/divine-mobile.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/psycopg2-batch-insert-optimization .agents/skills/psycopg2-batch-insert-optimization && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "psycopg2-batch-insert-optimization" agent skill from https://github.com/divinevideo/divine-mobile/tree/main/.agents/skills/psycopg2-batch-insert-optimization into .agents/skills/psycopg2-batch-insert-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "psycopg2-batch-insert-optimization", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add divinevideo/divine-mobile --skill psycopg2-batch-insert-optimization -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install divinevideo/divine-mobile psycopg2-batch-insert-optimization --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/divinevideo/divine-mobile.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/psycopg2-batch-insert-optimization .cursor/skills/psycopg2-batch-insert-optimization && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "psycopg2-batch-insert-optimization" agent skill from https://github.com/divinevideo/divine-mobile/tree/main/.agents/skills/psycopg2-batch-insert-optimization into .cursor/skills/psycopg2-batch-insert-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "psycopg2-batch-insert-optimization", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/divinevideo/divine-mobile.git --path .agents/skills/psycopg2-batch-insert-optimization--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add divinevideo/divine-mobile --skill psycopg2-batch-insert-optimization -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install divinevideo/divine-mobile psycopg2-batch-insert-optimization --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/divinevideo/divine-mobile.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/psycopg2-batch-insert-optimization .gemini/skills/psycopg2-batch-insert-optimization && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "psycopg2-batch-insert-optimization" agent skill from https://github.com/divinevideo/divine-mobile/tree/main/.agents/skills/psycopg2-batch-insert-optimization into .gemini/skills/psycopg2-batch-insert-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "psycopg2-batch-insert-optimization", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install divinevideo/divine-mobile psycopg2-batch-insert-optimizationInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add divinevideo/divine-mobile --skill psycopg2-batch-insert-optimization -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/divinevideo/divine-mobile.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/psycopg2-batch-insert-optimization .github/skills/psycopg2-batch-insert-optimization && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "psycopg2-batch-insert-optimization" agent skill from https://github.com/divinevideo/divine-mobile/tree/main/.agents/skills/psycopg2-batch-insert-optimization into .github/skills/psycopg2-batch-insert-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "psycopg2-batch-insert-optimization", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add divinevideo/divine-mobile --skill psycopg2-batch-insert-optimization -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install divinevideo/divine-mobile psycopg2-batch-insert-optimization --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/divinevideo/divine-mobile.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/psycopg2-batch-insert-optimization .opencode/skills/psycopg2-batch-insert-optimization && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "psycopg2-batch-insert-optimization" agent skill from https://github.com/divinevideo/divine-mobile/tree/main/.agents/skills/psycopg2-batch-insert-optimization into .opencode/skills/psycopg2-batch-insert-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "psycopg2-batch-insert-optimization", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
psycopg2-batch-insert-optimizationOptimize slow PostgreSQL inserts in Python using psycopg2. An agent skill from divinevideo/divine-mobile.
Psycopg2 Batch Insert Optimization is an agent skill from divinevideo/divine-mobile. Optimize slow PostgreSQL inserts in Python using psycopg2. Use when: (1) Row-by-row inserts are taking too long over network, (2) executemany() isn't providing speedup, (3) Migrating large datasets to PostgreSQL, (4) Network latency making individual INSERT statements impractical. The key is using executevalues() from psycopg2.extras instead of executemany() or individual execute() calls.
Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Databases. It works with PostgreSQL, Python and SQLite. The licence is MPL-2.0.
Read from SKILL.md and the folder at commit 8d5fbf2. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are python).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
psycopg.orgpostgresql.orgFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Psycopg2 Batch Insert Optimization loads about 1.2k tokens when it runs. Until then it costs about 107 tokens; SKILL.md has 285 words of instructions outside code blocks.
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.
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); files beside SKILL.md are not scanned.
The full file from divinevideo/divine-mobile at commit 8d5fbf2, republished under its MPL-2.0 licence (© divinevideo). 285 words, ~1,209 tokens.
.claude/skills/psycopg2-batch-insert-optimization/SKILL.md (or your agent's skills folder).When inserting thousands of rows into PostgreSQL over a network connection, row-by-row inserts are extremely slow. Each INSERT requires a round-trip, and with network latency of ~50-100ms, inserting 10,000 rows takes 10+ minutes.
The naive approach of using cursor.executemany() doesn't help much—it still sends
individual statements.
executemany() not providing expected speedupUse execute_values() from psycopg2.extras:
from psycopg2.extras import execute_values
# Instead of this (SLOW):
for row in data:
cursor.execute("INSERT INTO table (a, b, c) VALUES (%s, %s, %s)", row)
# Or this (STILL SLOW):
cursor.executemany("INSERT INTO table (a, b, c) VALUES (%s, %s, %s)", data)
# Use this (FAST):
execute_values(cursor, """
INSERT INTO table (a, b, c)
VALUES %s
ON CONFLICT (id) DO NOTHING
""", data, page_size=500)
conn.commit()page_size: Number of rows per batch (default 100, try 500-1000)VALUES %s placeholder is replaced with multiple value tuplesexecute_values(cursor, """
INSERT INTO users (user_id, username, email)
VALUES %s
ON CONFLICT (user_id) DO UPDATE SET
username = EXCLUDED.username,
email = COALESCE(EXCLUDED.email, users.email)
""", user_data, page_size=500)import sys
sys.stdout.reconfigure(line_buffering=True) # Force unbuffered output
BATCH_SIZE = 500
for i in range(0, len(data), BATCH_SIZE):
batch = data[i:i+BATCH_SIZE]
execute_values(cursor, query, batch)
conn.commit()
print(f"Processed {min(i+BATCH_SIZE, len(data))}/{len(data)} rows...")SELECT COUNT(*) FROM tableReal-world migration of 9,563 users from SQLite to PostgreSQL:
from psycopg2.extras import execute_values
import sys
sys.stdout.reconfigure(line_buffering=True)
BATCH_SIZE = 500
# Fetch from SQLite
sqlite_cur.execute('SELECT user_id, username, avatar_url, verified FROM users')
rows = sqlite_cur.fetchall()
data = [(r['user_id'], r['username'], r['avatar_url'], bool(r['verified']))
for r in rows]
# Batch insert to PostgreSQL
for i in range(0, len(data), BATCH_SIZE):
batch = data[i:i+BATCH_SIZE]
execute_values(pg_cur, '''
INSERT INTO users (user_id, username, avatar_url, verified)
VALUES %s
ON CONFLICT (user_id) DO UPDATE SET
username = COALESCE(EXCLUDED.username, users.username),
avatar_url = COALESCE(EXCLUDED.avatar_url, users.avatar_url)
''', batch)
pg_conn.commit()
print(f"Processed {min(i+BATCH_SIZE, len(data))}/{len(data)} users...")Result: 9,563 users migrated in ~20 seconds instead of ~2.5 hours.
execute_values() constructs a single INSERT with multiple VALUES, drastically
reducing round-tripsexecutemany() is deceptively slow—it still sends individual statementsCOPY command or copy_expert()page_size parameter controls memory usage vs. batch efficiencyWhen migrating, also watch for these SQL differences:
INSERT OR IGNORE → ON CONFLICT DO NOTHINGINSERT OR REPLACE → ON CONFLICT DO UPDATE SET ...MAX(a, b) (SQLite) → GREATEST(a, b) (PostgreSQL)MIN(a, b) (SQLite) → LEAST(a, b) (PostgreSQL)? placeholders → %s placeholdersAUTOINCREMENT → SERIAL or GENERATED ALWAYS AS IDENTITY© divinevideo, MPL-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/psycopg2-batch-insert-optimization of divinevideo/divine-mobile.
Open the folder on GitHubat commit 8d5fbf2
Psycopg2 Batch Insert Optimization 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.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Psycopg2 Batch Insert Optimization this skilldivinevideo/divine-mobile | 265 | — | ~1.2k | Automated safety check: Pass | MPL-2.0 | |
| MoviePilot Database Operationjxxghp/MoviePilot | 12k | — | ~7.1k | Automated safety check: Pass | GPL-3.0 | |
| Cognee Session Memory and Improvetopoteretes/cognee | 32k | — | ~3k | Automated safety check: Pass | Apache-2.0 | |
| SQL Database Support for pRESTprest/prest | 4.6k | — | ~1.6k | Automated safety check: Pass | MIT | |
| Saleor Django Migration Rulessaleor/saleor | 23k | — | ~1.6k | Automated safety check: Pass | BSD-3-Clause | |
| Chdb SQLvemetric/vemetric | 394 | 1 repos | ~1.2k | Automated safety check: Pass | Apache-2.0 |
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.
topoteretes/cognee
Explains how cognee stores session memory by session_id and bridges it into the permanent graph with improve(), including the stages, results and settings.
prest/prest
Guides classifying, gap-analyzing and scaffolding support for a new SQL database in pREST, from Postgres-compatible variants to entirely new dialects.
saleor/saleor
Rules for writing Django migrations in Saleor that avoid long table locks and stay compatible with zero-downtime rolling deploys.
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…
gocronx-team/gocron
Create, review, or verify gocron database migrations across SQLite, MySQL, and PostgreSQL.
divinevideo/divine-mobile
Fix ArgoCD ExternalSecret deployment failing with "namespace X is not permitted in project Y".
divinevideo/divine-mobile
Art direction for any content — reads text, PDF, Word, HTML, PPT, then proposes 2-3 creative directions with photography style, mood, and visual language.
divinevideo/divine-mobile
Fix "Null check operator used on a null value" errors when an object is set to null during an async await.
divinevideo/divine-mobile
Add custom metadata headers (x-amz-meta-) to AWS v4 signed requests for GCS S3-compatible API.
divinevideo/divine-mobile
Fix password/secret authentication failures caused by trailing newlines when creating Google Cloud secrets (or similar) with bash here-strings.
divinevideo/divine-mobile
Fix silent video/media processing failures caused by URL extraction code that filters on file extensions (.mp4, .webm, .webp).
Works with
Categories
Optimize slow PostgreSQL inserts in Python using psycopg2. An agent skill from divinevideo/divine-mobile. Psycopg2 Batch Insert Optimization is an agent skill from divinevideo/divine-mobile. Optimize slow PostgreSQL inserts in Python using psycopg2.
Psycopg2 Batch Insert Optimization fits situations like: row-by-row inserts are taking too long over network; executemany() isnt providing speedup; migrating large datasets to PostgreSQL; network latency making individual INSERT statements impractical.
Run `npx skills add divinevideo/divine-mobile --skill psycopg2-batch-insert-optimization -a claude-code`. Or copy the skill folder (.agents/skills/psycopg2-batch-insert-optimization in divinevideo/divine-mobile) into .claude/skills/psycopg2-batch-insert-optimization in your project. Claude Code loads it when a task matches its description.
Run `npx skills add divinevideo/divine-mobile --skill psycopg2-batch-insert-optimization -a codex`. Or copy the skill folder (.agents/skills/psycopg2-batch-insert-optimization in divinevideo/divine-mobile) into .agents/skills/psycopg2-batch-insert-optimization in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add divinevideo/divine-mobile --skill psycopg2-batch-insert-optimization -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/psycopg2-batch-insert-optimization, .gemini/skills/psycopg2-batch-insert-optimization, .github/skills/psycopg2-batch-insert-optimization and .opencode/skills/psycopg2-batch-insert-optimization in your project.
SKILL.md names no scripts, command-line tools or credentials: Psycopg2 Batch Insert Optimization is instructions for the agent only. Our summary lists: Python 3.
SKILL.md names 2 domains. As links in the text: psycopg.org and postgresql.org. This is read from the text; nothing was executed.
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. Review the folder before installing.
Psycopg2 Batch Insert Optimization is published under the MPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.2k tokens (SKILL.md is roughly 4.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Psycopg2 Batch Insert Optimization: MoviePilot Database Operation (jxxghp/MoviePilot, 12k stars), Cognee Session Memory and Improve (topoteretes/cognee, 32k stars), SQL Database Support for pREST (prest/prest, 4.6k stars) and Saleor Django Migration Rules (saleor/saleor, 23k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
divinevideo (a GitHub organization) maintains it in divinevideo/divine-mobile, which has 265 GitHub stars. The repository holds 103 skills in this directory. The repository was last updated on October 7, 2026.
Source: divinevideo/divine-mobile on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.