Agent skill

Managing Database Replication

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Process use when you need to work with database scalability.

MITAuto-check passedDatabases

Install Managing Database Replication

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-replication -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace managing-database-replication --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/managing-database-replication .claude/skills/managing-database-replication && rm -rf skills-src

Use ~/.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/

Facts

Skill name
managing-database-replication
GitHub stars
2.8k
Token cost
~1.9k tokens
SKILL.md length
792 words
Files
6 (incl. scripts, references, assets)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Process use when you need to work with database scalability.

  • Works in 10 steps: Choose the replication topology based on… → For PostgreSQL streaming replication,… → Initialize the replica with a base… → …
  • You need to work with database scalability
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • Runs Python scripts from its folder; needs SOURCE_PASSWORD

What it does

Managing Database Replication is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to work with database scalability. This skill provides replication and sharding with comprehensive guidance and automation. Trigger with phrases like "set up replication", "implement sharding", or "scale database".

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including scripts, reference files and assets (for example `assets/README.md`, `references/README.md` and `scripts/README.md`). Compatibility notes: Designed for Claude Code

It sits in Databases, covering Database administration. It works with PostgreSQL and MySQL. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • You need to work with database scalability
  • With phrases like set up replication
  • Implement sharding

Example prompts

  • “set up replication”
  • “implement sharding”
  • “scale database”
  • “/managing-database-replication”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. Choose the replication topology based on requirements
  2. For PostgreSQL streaming replication, configure the primary
  3. Initialize the replica with a base backup: pg_basebackup -h primary_host -U replicator -D /var/lib/postgresql/data -Fp -Xs -P -R. The -R…
  4. For MySQL source-replica replication, configure the source
  5. Configure the MySQL replica: CHANGE REPLICATION SOURCE TO SOURCE_HOST='primary_host', SOURCE_USER='replicator', SOURCE_PASSWORD='...'…
  6. For MongoDB replica sets: initialize with rs.initiate({_id: "rs0", members: [{_id: 0, host: "node1:27017"}, {_id: 1, host: "node2:27017"}…
  7. Monitor replication lag continuously
  8. Configure application-level read routing: direct write queries to the primary connection and read queries to a load-balanced replica pool…
  9. Set up automated failover using Patroni (PostgreSQL), MySQL InnoDB Cluster + MySQL Router, or MongoDB's built-in election mechanism. Test…
  10. Configure alerting for replication lag exceeding 10 seconds, replication slot inactive for more than 1 hour, and replica connection drops…

What it can do on your machine

Read from SKILL.md and the folder at commit 23ea8d4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash(psql:*)
    • Bash(mysql:*)
    • Bash(mongosh:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 3 files in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • postgresql.org
    • patroni.readthedocs.io
    • mongodb.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • SOURCE_PASSWORD

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Managing Database Replication loads about 1.9k tokens when it runs, and up to ~1.9k if it reads all its reference files. Until then it costs about 68 tokens; SKILL.md has 792 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~68
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.9k

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.

Safety

Auto-check passed

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); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit 23ea8d4, republished under its MIT licence (© jeremylongshore). 792 words, ~1,858 tokens.

Download SKILL.mdSave it as .claude/skills/managing-database-replication/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
managing-database-replication
description
Process use when you need to work with database scalability. This skill provides replication and sharding with comprehensive guidance and automation. Trigger with phrases like "set up replication", "implement sharding", or "scale database".
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)
compatibility
Designed for Claude Code
version
1.28.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
database, scaling, database-replication

Database Replication Manager

Overview

Configure and manage database replication topologies for PostgreSQL (streaming replication, logical replication), MySQL (source-replica, group replication), and MongoDB (replica sets). This skill covers primary-replica setup, read scaling through replica routing, failover automation, replication lag monitoring, and conflict resolution for multi-primary configurations.

Prerequisites

  • Superuser or replication-role credentials on primary and replica servers
  • Network connectivity between all replication nodes (verify with pg_isready or mysqladmin ping)
  • psql, mysql, or mongosh CLI tools installed on all nodes
  • Matching major database versions across all replication nodes
  • Sufficient disk space on replicas (equal to or greater than primary)
  • SSH access to replica servers for initial base backup transfer

Instructions

  1. Choose the replication topology based on requirements:

    • Single primary + read replicas: Best for read-heavy workloads. All writes go to primary; reads distributed across replicas.
    • Multi-primary (active-active): Best for geographic distribution. Requires conflict resolution. Use PostgreSQL logical replication or MySQL Group Replication.
    • Cascading replication: Replica A replicates from primary, Replica B replicates from Replica A. Reduces primary load for many replicas.
  2. For PostgreSQL streaming replication, configure the primary:

    • Set wal_level = replica, max_wal_senders = 10, max_replication_slots = 10
    • Create replication user: CREATE ROLE replicator WITH REPLICATION LOGIN PASSWORD 'secure_password'
    • Add replication entry to pg_hba.conf: host replication replicator replica_ip/32 scram-sha-256
    • Reload configuration: SELECT pg_reload_conf()
  3. Initialize the replica with a base backup: pg_basebackup -h primary_host -U replicator -D /var/lib/postgresql/data -Fp -Xs -P -R. The -R flag creates standby.signal and configures primary_conninfo automatically.

  4. For MySQL source-replica replication, configure the source:

    • Set server-id = 1, log_bin = mysql-bin, binlog_format = ROW
    • Create replication user: CREATE USER 'replicator'@'replica_ip' IDENTIFIED BY 'secure_password'; GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'replica_ip'
    • Record binary log position: SHOW MASTER STATUS
  5. Configure the MySQL replica: CHANGE REPLICATION SOURCE TO SOURCE_HOST='primary_host', SOURCE_USER='replicator', SOURCE_PASSWORD='...', SOURCE_LOG_FILE='mysql-bin.000001', SOURCE_LOG_POS=154; START REPLICA.

  6. For MongoDB replica sets: initialize with rs.initiate({_id: "rs0", members: [{_id: 0, host: "node1:27017"}, {_id: 1, host: "node2:27017"}, {_id: 2, host: "node3:27017"}]}). MongoDB handles leader election and failover automatically.

  7. Monitor replication lag continuously:

    • PostgreSQL: SELECT client_addr, state, sent_lsn, write_lsn, flush_lsn, replay_lsn, (sent_lsn - replay_lsn) AS lag_bytes FROM pg_stat_replication
    • MySQL: SHOW REPLICA STATUS\G (check Seconds_Behind_Source)
    • MongoDB: rs.printReplicationInfo() and rs.printSecondaryReplicationInfo()
  8. Configure application-level read routing: direct write queries to the primary connection and read queries to a load-balanced replica pool. Use connection poolers (PgBouncer, ProxySQL) or application middleware for automatic routing.

  9. Set up automated failover using Patroni (PostgreSQL), MySQL InnoDB Cluster + MySQL Router, or MongoDB's built-in election mechanism. Test failover by stopping the primary and verifying the replica promotes automatically within the target RTO.

  10. Configure alerting for replication lag exceeding 10 seconds, replication slot inactive for more than 1 hour, and replica connection drops. Stale replication slots in PostgreSQL cause WAL accumulation and can fill the disk.

Output

  • Replication configuration files for primary and replica nodes
  • Base backup and initialization scripts for setting up new replicas
  • Replication monitoring queries with lag measurement and health checks
  • Failover runbook with manual and automated promotion procedures
  • Read routing configuration for application or connection pooler
Show full SKILL.md (302 more words)Show less

Error Handling

ErrorCauseSolution
Replication lag increasing steadilyReplica cannot keep up with primary write volumeCheck replica I/O and CPU; increase max_parallel_workers on replica; consider upgrading replica hardware; reduce write-heavy batch operations on primary
replication slot is inactive warningReplica disconnected or paused, WAL accumulating on primaryReconnect replica; if permanently removed, drop the slot with SELECT pg_drop_replication_slot('slot_name') to prevent disk fill
could not connect to primary on replicaNetwork partition, primary down, or authentication failureVerify network connectivity; check pg_hba.conf entries; confirm replication user credentials; check primary process status
Replica has diverged from primarySplit-brain after failed failover or manual writes to replicaRe-initialize replica from fresh base backup; for PostgreSQL, use pg_rewind if timeline divergence is small
Conflict in logical replicationSame row modified on both publisher and subscriberConfigure conflict resolution policy; use UPDATE conflict handler; design schema to avoid cross-node writes to same rows

Examples

Setting up PostgreSQL read replicas for a web application: A primary database handles 2,000 writes/second but read traffic is 10x higher. Two streaming replicas are added with PgBouncer routing read queries to replicas in round-robin. Result: primary CPU drops from 90% to 40%, read latency improves by 60%.

Automated failover with Patroni: A 3-node PostgreSQL cluster managed by Patroni with etcd for consensus. When the primary fails, Patroni promotes the most up-to-date replica within 10 seconds. Application reconnects automatically through the Patroni-managed VIP or DNS endpoint.

Cross-region logical replication for compliance: EU customer data must stay in EU region. Logical replication publishes only non-PII tables to the US region replica. EU application reads locally; US analytics queries use the replicated subset. Publication filter: CREATE PUBLICATION us_analytics FOR TABLE orders, products, categories.

Resources

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts, references, assets) in skills/.curated/managing-database-replication of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • assets/README.md
  • references/README.md
  • scripts/README.md
  • scripts/failover.py
  • scripts/setup_replication.py

Open the folder on GitHubat commit 23ea8d4

Compare with similar skills

Managing Database Replication 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.

Managing Database Replication compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Managing Database Replication this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.9kAutomated safety check: PassMIT
DB Ops SopOpenDCAI/DataMind423—~388Automated safety check: PassApache-2.0
Database Expertcin12211/orca-q224—~2.8kAutomated safety check: PassMIT
Database OptimizerJeffallan/claude-skills12k—~1.6kAutomated safety check: PassMIT
Whodbxiaoyuge886/aigc198—~894Automated safety check: PassMIT
Database Backupssickn33/agentic-awesome-skills47k2 repos~3.1kAutomated safety check: NotesMIT

Similar skills

  • DB Ops Sop

    OpenDCAI/DataMind

    Database operations runbook — backup, recovery, performance tuning, troubleshooting.

    423 GitHub stars~388 tokensUpdated 18 days ago
    DatabasesAuto-check passed
  • Database Expert

    cin12211/orca-q

    Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration.

    224 GitHub stars~2.8k tokensUpdated 17 days ago
    DatabasesAuto-check passed
  • Database Optimizer

    Jeffallan/claude-skills

    Tunes PostgreSQL and MySQL performance by analyzing slow queries and execution plans, designing indexes, rewriting queries and adjusting configuration, one validated change at a time.

    12k GitHub stars~1.6k tokensUpdated 5 days ago
    DatabasesAuto-check passed
  • Whodb

    xiaoyuge886/aigc

    Database operations including querying, schema exploration, and data analysis.

    198 GitHub stars~894 tokensUpdated 2 mo ago
    DatabasesAuto-check passed
  • Database Backups

    sickn33/agentic-awesome-skills

    Implement database backup strategies. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~3.1k tokens
    DatabasesAuto-check: notes
  • Matlab Use Database

    matlab/matlab-agentic-toolkit

    Reads from, writes to, and manages relational databases using MATLAB Database Toolbox.

    1.1k GitHub stars~3.1k tokensUpdated yesterday
    DatabasesAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Analyzing Text With NLP

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to perform natural language processing and text analysis using the nlp-text-analyzer plugin.

    2.8k GitHub starsUsed in 1 repo~819 tokens
    Auto-check passed
  • Building Neural Networks

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill allows AI assistant to construct and configure neural network architectures using the neural-network-builder plugin.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Detecting Data Anomalies

    jeremylongshore/tons-of-skills-marketplace

    Process identify anomalies and outliers in datasets using machine learning algorithms.

    2.8k GitHub starsUsed in 1 repo~1.4k tokens
    Auto-check passed
  • Explaining Machine Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill enables AI assistant to provide interpretability and explainability for machine learning models.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Optimizing Prompts

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill optimizes prompts for large language models (llms) to reduce token usage, lower costs, and improve performance.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed

Works with

Categories

Questions about Managing Database Replication

What does Managing Database Replication do?

Process use when you need to work with database scalability. Managing Database Replication is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to work with database scalability.

When should I use Managing Database Replication?

Managing Database Replication fits situations like: you need to work with database scalability; with phrases like set up replication; implement sharding.

How do I install Managing Database Replication in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-replication -a claude-code`. Or copy the skill folder (skills/.curated/managing-database-replication in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/managing-database-replication in your project. Claude Code loads it when a task matches its description.

How do I install Managing Database Replication in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-replication -a codex`. Or copy the skill folder (skills/.curated/managing-database-replication in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/managing-database-replication in your project. Codex loads it when a task matches its description.

Can I use Managing Database Replication in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-replication -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/managing-database-replication, .gemini/skills/managing-database-replication, .github/skills/managing-database-replication and .opencode/skills/managing-database-replication in your project.

What does Managing Database Replication need to run?

Going by SKILL.md and its folder, Managing Database Replication needs Python for the scripts in its folder and credentials named SOURCE_PASSWORD. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Managing Database Replication access the network?

SKILL.md names 3 domains. As links in the text: postgresql.org, patroni.readthedocs.io and mongodb.com. This is read from the text; nothing was executed.

Is Managing Database Replication safe to install?

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. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Managing Database Replication use?

Managing Database Replication is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Managing Database Replication use?

About 1.9k tokens (SKILL.md is roughly 7.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 18 tokens, read only when the agent opens those files.

What are the alternatives to Managing Database Replication?

Skills that share tags, products or a category with Managing Database Replication: DB Ops Sop (OpenDCAI/DataMind, 423 stars), Database Expert (cin12211/orca-q, 224 stars), Database Optimizer (Jeffallan/claude-skills, 12k stars) and Whodb (xiaoyuge886/aigc, 198 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Managing Database Replication?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,821 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 8, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.