Agent skill

Managing Database Sharding

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

Process use when you need to work with database sharding. An agent skill from jeremylongshore/tons-of-skills-marketplace.

MITAuto-check passedDatabases

Install Managing Database Sharding

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

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

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace managing-database-sharding --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-sharding .claude/skills/managing-database-sharding && 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-sharding
GitHub stars
2.8k
Token cost
~1.7k tokens
SKILL.md length
769 words
Files
5 (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 sharding. An agent skill from jeremylongshore/tons-of-skills-marketplace.

  • Works in 10 steps: Analyze the current database size and… → Evaluate candidate shard keys by… → Choose a sharding strategy based on… → …
  • You need to work with database sharding
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • Runs Python scripts from its folder

What it does

Managing Database Sharding is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to work with database sharding. This skill provides horizontal sharding strategies with comprehensive guidance and automation. Trigger with phrases like "implement sharding", "shard database", or "distribute data".

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 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 sharding
  • With phrases like implement sharding
  • Distribute data

Example prompts

  • “implement sharding”
  • “shard database”
  • “distribute data”
  • “/managing-database-sharding”

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. Analyze the current database size and identify tables exceeding single-node capacity thresholds (typically >500GB or >1B rows). Run SELECT…
  2. Evaluate candidate shard keys by examining query WHERE clauses, JOIN patterns, and data distribution. A good shard key has high…
  3. Choose a sharding strategy based on workload patterns
  4. Design the shard topology by determining the number of shards, replication factor, and placement. For PostgreSQL, use Citus extension or…
  5. Create the shard schema on all target nodes, ensuring identical table definitions, indexes, and constraints across every shard. Generate…
  6. Implement the routing layer that directs queries to the correct shard. This can be application-level (connection selection based on shard…
  7. Migrate existing data to shards using batch operations. Extract data in chunks of 10,000-50,000 rows, transform shard key assignments, and…
  8. Validate cross-shard queries work correctly, especially aggregations and JOINs that span multiple shards. Test scatter-gather query…
  9. Set up monitoring for shard balance (data size per shard, query load per shard) and configure alerts for skew exceeding 20% deviation from…
  10. Document the shard map, routing logic, and rebalancing procedures for operational runbooks.

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. 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 2 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):

    • mongodb.com
    • docs.citusdata.com
    • vitess.io
    • proxysql.com

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

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    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 Sharding loads about 1.7k tokens when it runs, and up to ~1.7k if it reads all its reference files. Until then it costs about 67 tokens; SKILL.md has 769 words of instructions outside code blocks.

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

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 cfae287, republished under its MIT licence (© jeremylongshore). 769 words, ~1,676 tokens.

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

Database Sharding Manager

Overview

Implement and manage horizontal database sharding strategies across PostgreSQL, MySQL, and MongoDB. This skill covers shard key selection, data distribution analysis, cross-shard query routing, and rebalancing operations for databases that have outgrown single-node capacity.

Prerequisites

  • Database admin credentials with CREATE DATABASE, CREATE TABLE, and replication permissions
  • psql, mysql, or mongosh CLI tools installed and configured
  • Network connectivity between all shard nodes
  • Current table sizes and growth rate data (query pg_total_relation_size or information_schema.TABLES)
  • Application query patterns documented or access to slow query logs
  • Enough disk and memory on target shard nodes to handle redistributed data

Instructions

  1. Analyze the current database size and identify tables exceeding single-node capacity thresholds (typically >500GB or >1B rows). Run SELECT pg_size_pretty(pg_total_relation_size('table_name')) for PostgreSQL or SELECT data_length + index_length FROM information_schema.TABLES for MySQL.

  2. Evaluate candidate shard keys by examining query WHERE clauses, JOIN patterns, and data distribution. A good shard key has high cardinality, even distribution, and appears in most queries. Run SELECT shard_key_column, COUNT(*) FROM table GROUP BY shard_key_column ORDER BY COUNT(*) DESC LIMIT 20 to check distribution.

  3. Choose a sharding strategy based on workload patterns:

    • Hash-based: Even distribution, best for key-value lookups. Use hash(shard_key) % num_shards.
    • Range-based: Good for time-series or sequential data. Partition by date ranges or ID ranges.
    • Directory-based: Maximum flexibility with a lookup table mapping keys to shards.
    • Geographic: Route by region for data residency or latency requirements.
  4. Design the shard topology by determining the number of shards, replication factor, and placement. For PostgreSQL, use Citus extension or manual foreign data wrappers. For MySQL, configure vitess or ProxySQL routing. For MongoDB, enable sharding on the cluster with sh.enableSharding() and sh.shardCollection().

  5. Create the shard schema on all target nodes, ensuring identical table definitions, indexes, and constraints across every shard. Generate DDL scripts and verify with checksums.

  6. Implement the routing layer that directs queries to the correct shard. This can be application-level (connection selection based on shard key), middleware (ProxySQL, PgBouncer with routing), or database-native (Citus, MongoDB mongos).

  7. Migrate existing data to shards using batch operations. Extract data in chunks of 10,000-50,000 rows, transform shard key assignments, and load into target shards. Verify row counts match after migration.

  8. Validate cross-shard queries work correctly, especially aggregations and JOINs that span multiple shards. Test scatter-gather query performance and implement application-level aggregation where needed.

  9. Set up monitoring for shard balance (data size per shard, query load per shard) and configure alerts for skew exceeding 20% deviation from the average.

  10. Document the shard map, routing logic, and rebalancing procedures for operational runbooks.

Output

  • Shard key analysis report with cardinality, distribution histograms, and recommended key selection
  • Shard topology diagram mapping databases, tables, and key ranges to physical nodes
  • DDL migration scripts for creating shard schemas with matching indexes and constraints
  • Routing configuration files for ProxySQL, Citus, vitess, or application-level routing
  • Data migration scripts with batch extraction, transformation, and verification queries
  • Monitoring queries for shard balance, cross-shard query latency, and hotspot detection
Show full SKILL.md (275 more words)Show less

Error Handling

ErrorCauseSolution
Hotspot shard receiving disproportionate trafficPoor shard key choice with low cardinality or skewed distributionRe-analyze shard key distribution; consider compound shard keys or hash-based sharding
Cross-shard JOIN timeoutScatter-gather query across too many shardsDenormalize frequently joined data onto the same shard; use application-level aggregation
Shard rebalancing data lossMigration interrupted mid-batch without transaction wrappingWrap batch migrations in transactions; verify source and destination row counts before deleting source data
Connection pool exhaustionEach shard requires its own connection pool, multiplying total connectionsReduce per-shard pool size; use connection multiplexing with PgBouncer or ProxySQL
Schema drift between shardsDDL changes applied to some shards but not othersUse centralized DDL deployment scripts; verify schema checksums across all shards after changes

Examples

E-commerce order table sharding by customer_id: A 2TB orders table with 800M rows is sharded across 8 nodes using hash-based distribution on customer_id. All queries for a single customer hit one shard. Cross-customer analytics queries use a separate read replica with full data.

Time-series IoT data with range sharding: Sensor readings partitioned by month into separate shards. Each shard holds one month of data. Queries for recent data hit the active shard; historical analysis queries span multiple shards with parallel execution. Old shards are archived to cold storage quarterly.

Multi-tenant SaaS with directory-based sharding: A tenant-to-shard lookup table routes each tenant to a dedicated shard. Large tenants get dedicated shards; small tenants share shards. Rebalancing moves tenants between shards by updating the directory and migrating data.

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 4 other files (scripts, references, assets) in skills/.curated/managing-database-sharding of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • assets/README.md
  • references/README.md
  • scripts/README.md
  • scripts/init_sharding.py

Open the folder on GitHubat commit cfae287

Compare with similar skills

Managing Database Sharding 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 Sharding compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Managing Database Sharding this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.7kAutomated safety check: PassMIT
DB Ops SopOpenDCAI/DataMind451—~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.

    451 GitHub stars~388 tokensUpdated 20 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 19 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 7 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 2 days ago
    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
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Managing Database Sharding

What does Managing Database Sharding do?

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

When should I use Managing Database Sharding?

Managing Database Sharding fits situations like: you need to work with database sharding; with phrases like implement sharding; distribute data.

How do I install Managing Database Sharding in Claude Code?

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

How do I install Managing Database Sharding in Codex?

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

Can I use Managing Database Sharding 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-sharding -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-sharding, .gemini/skills/managing-database-sharding, .github/skills/managing-database-sharding and .opencode/skills/managing-database-sharding in your project.

What does Managing Database Sharding need to run?

Going by SKILL.md and its folder, Managing Database Sharding needs Python for the scripts in its folder. 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 Sharding access the network?

SKILL.md names 4 domains. As links in the text: mongodb.com, docs.citusdata.com, vitess.io and proxysql.com. This is read from the text; nothing was executed.

Is Managing Database Sharding 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 Sharding use?

Managing Database Sharding 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 Sharding use?

About 1.7k tokens (SKILL.md is roughly 6.7k 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 17 tokens, read only when the agent opens those files.

What are the alternatives to Managing Database Sharding?

Skills that share tags, products or a category with Managing Database Sharding: DB Ops Sop (OpenDCAI/DataMind, 451 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 Sharding?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 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.