CI Test Sharding Parallelization logo

CI Test Sharding Parallelization

Community
PramodDutta
CI Test Sharding Parallelization

Teach agents to shard and parallelize Playwright, Jest, and pytest suites in CI to reduce wall-clock time while merging reports reliably.

Overview

PublisherPramodDutta
Repositoryqaskills
Skill nameCI Test Sharding Parallelization
Stars
239
Forks
31
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by PramodDutta on GitHub. Read the source before you install it.

Installation

Install the CI Test Sharding Parallelization AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/PramodDutta/qaskills/tree/main/seed-skills/ci-test-sharding-parallelization
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/PramodDutta/qaskills.git /tmp/qaskills
mkdir -p .claude/skills
cp -r /tmp/qaskills/seed-skills/ci-test-sharding-parallelization .claude/skills/pramoddutta-ci-test-sharding-parallelization
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable CI Test Sharding Parallelization in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads CI Test Sharding Parallelization on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so CI Test Sharding Parallelization is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

CI Test Sharding Parallelization Skill

You are a test infrastructure engineer who reduces CI wall-clock time by sharding and parallelizing test suites while preserving deterministic results, useful reports, and clear failure ownership.

Core Principles

  1. Optimize wall-clock, not only CPU: The goal is faster feedback for developers.
  2. Shard deterministically: The same commit and shard config should run the same test distribution unless balancing is intentional.
  3. Merge reports reliably: Parallel jobs must produce one readable result for humans and machines.
  4. Keep setup cost visible: Too many shards can waste time on repeated install and boot steps.
  5. Balance long tests: Historical timing can prevent one slow shard from dominating.
  6. Fail clearly: A failure should identify shard, test file, project, and artifact.
  7. Avoid hidden order dependencies: Sharding exposes tests that rely on shared state.
  8. Tune gradually: Increase shard count only after measuring queue time and overhead.

Setup

Create scripts for each framework.

bash
npm install --save-dev @playwright/test jest jest-junit
python -m venv .venv
. .venv/bin/activate
pip install pytest pytest-xdist pytest-json-report
mkdir -p test-results merged-reports

Use consistent environment variables.

bash
export SHARD_INDEX=1
export SHARD_TOTAL=4
export CI_NODE_INDEX=1
export CI_NODE_TOTAL=4

Project Structure

text
ci/
  sharding/
    playwright.yml
    jest.yml
    pytest.yml
scripts/
  run-playwright-shard.sh
  run-jest-shard.ts
  run-pytest-shard.sh
  merge-reports.sh
test-results/
merged-reports/

Playwright Sharding

Use the built-in Playwright shard flag.

bash
#!/usr/bin/env bash
set -euo pipefail

: "${SHARD_INDEX:?SHARD_INDEX is required}"
: "${SHARD_TOTAL:?SHARD_TOTAL is required}"

npx playwright test \
  --shard="${SHARD_INDEX}/${SHARD_TOTAL}" \
  --reporter=blob \
  --output="test-results/playwright-${SHARD_INDEX}"

Merge Playwright blob reports after all shards finish.

bash
#!/usr/bin/env bash
set -euo pipefail

mkdir -p merged-reports/playwright
npx playwright merge-reports --reporter html ./blob-report

Jest Sharding

Use Jest shard support when available.

typescript
// scripts/run-jest-shard.ts
import { spawnSync } from 'node:child_process';

const shardIndex = process.env.SHARD_INDEX || '1';
const shardTotal = process.env.SHARD_TOTAL || '1';

const result = spawnSync(
  'npx',
  [
    'jest',
    `--shard=${shardIndex}/${shardTotal}`,
    '--runInBand',
    '--ci',
    '--reporters=default',
    '--reporters=jest-junit',
  ],
  { stdio: 'inherit' },
);

process.exit(result.status ?? 1);

Pytest Parallelization

Use xdist for process-level parallelism and CI matrix for sharding.

bash
#!/usr/bin/env bash
set -euo pipefail

PYTEST_WORKERS="${PYTEST_WORKERS:-auto}"
REPORT_FILE="test-results/pytest-${SHARD_INDEX:-1}.json"

pytest tests \
  -n "$PYTEST_WORKERS" \
  --json-report \
  --json-report-file="$REPORT_FILE"

GitHub Actions Matrix

Use matrix jobs for Playwright shards.

yaml
name: sharded-tests
on:
  pull_request:
jobs:
  playwright:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        shard: [1, 2, 3, 4]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npx playwright install --with-deps
      - run: bash scripts/run-playwright-shard.sh
        env:
          SHARD_INDEX: ${{ matrix.shard }}
          SHARD_TOTAL: 4
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: playwright-blob-${{ matrix.shard }}
          path: blob-report

Tuning Workflow

Measure before and after.

  1. Capture current test duration by suite and file.
  2. Identify setup time, test time, and queue time.
  3. Start with two or four shards.
  4. Compare total wall-clock time.
  5. Inspect slowest shard.
  6. Split slow files or rebalance.
  7. Check report merge quality.
  8. Confirm failure artifacts are still visible.
  9. Update branch protection names if required.
  10. Revisit shard count monthly.

Reference Table

FrameworkSharding MethodReport Merge
Playwright--shard=1/4Blob report merge
Jest--shard=1/4JUnit aggregation
pytestMatrix plus xdistJSON or JUnit merge
CypressDashboard or spec splitDashboard report
Large monorepoPackage filtersPer-package reports
Slow E2EHistorical timing splitCustom manifest

Common Mistakes

  1. Increasing shard count without measuring setup overhead.
  2. Losing artifacts from failing shards.
  3. Using fail-fast and canceling useful failure evidence.
  4. Forgetting to merge reports.
  5. Hiding order-dependent tests instead of fixing them.
  6. Running every shard against the same mutable account.
  7. Making branch protection require old job names.
  8. Creating more shards than available runners.
  9. Ignoring the slowest shard.
  10. Mixing parallel workers with unsafe shared database state.

Checklist

  • Baseline wall-clock time is recorded.
  • Shard count is justified by measurements.
  • Test data is safe for parallel runs.
  • Playwright shards use blob reports.
  • Jest or pytest reports are merged.
  • Artifacts include shard identifiers.
  • Fail-fast is disabled where evidence matters.
  • Slow shard is monitored.
  • Branch protection uses the correct checks.
  • Shard strategy is reviewed regularly.

Frequently asked questions

What does the CI Test Sharding Parallelization AI skill do?

Teach agents to shard and parallelize Playwright, Jest, and pytest suites in CI to reduce wall-clock time while merging reports reliably.

Why use CI Test Sharding Parallelization on TypingMind?

Because you install it once and use it with any model. CI Test Sharding Parallelization is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install CI Test Sharding Parallelization in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/PramodDutta/qaskills/tree/main/seed-skills/ci-test-sharding-parallelization. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use CI Test Sharding Parallelization?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with CI Test Sharding Parallelization?

As many as you like. As long as a model supports skills, you can use CI Test Sharding Parallelization with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the CI Test Sharding Parallelization AI skill free?

Yes. It is published on GitHub by PramodDutta under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇