fairness-testing

fairness-testing is a skill for Claude Code from obielin/responsible-ai-skills. It costs 38 tokens per session (1,959 once invoked), scanned A, original, MIT.

A required testing process for checking whether an AI model or classifier performs fairly across groups of people. The tests compare a chosen performance measure and can run in continuous integration, the automated checks before code is accepted.

In plain words
What is it for?
Use it when writing tests for models whose outputs affect people. It supports a red-green-refactor testing cycle and limits differences between groups.
Why use it?
It turns fairness from a one-time review into a repeatable check that can catch regressions before release.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the responsible-ai-skills plugin — 9 skills shipped together

Good fit Use it when writing tests for models whose outputs affect people. It supports a red-green-refactor testing cycle and limits differences between groups.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/obielin/responsible-ai-skills/fairness-testing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add obielin/responsible-ai-skills --skill fairness-testing
Clone the repo
git clone --depth 1 https://github.com/obielin/responsible-ai-skills

Made for: Claude Code.

Or install responsible-ai-skills, the plugin that ships this one along with the rest of its 9 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fairness-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/obielin/responsible-ai-skills/fairness-testing/github.svg)](https://agentmods.dev/skills/obielin/responsible-ai-skills/fairness-testing)
Your own site
<a href="https://agentmods.dev/skills/obielin/responsible-ai-skills/fairness-testing"><img src="https://agentmods.dev/badge/skills/obielin/responsible-ai-skills/fairness-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fairness-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/obielin/responsible-ai-skills/fairness-testing"><img src="https://agentmods.dev/badge/skills/obielin/responsible-ai-skills/fairness-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,959 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00038 $0.01959
Opus 5 $0.00019 $0.00979
Sonnet 5 $0.00008 $0.00392
Haiku 4.5 $0.00004 $0.00196

Measured 10d ago against content hash b6ec15e0419b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

fairness-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/fairness-testing/SKILL.md · 262 lines

How it starts

The opening of the file, as written. The whole thing — 262 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Fairness Testing

Fairness is not a property you check once — it's a property you test continuously. These tests run in CI and fail the build if the model regresses on fairness metrics.

The RED-GREEN-REFACTOR Cycle for Fairness

RED: Write a fairness test. Run it. Watch it fail (or confirm the threshold matters). GREEN: Adjust the model or data until the test passes. REFACTOR: Clean up. Do not delete the test.

This is non-negotiable. If you write no fairness tests, you have no fairness guarantees.


Test Structure

Every fairness test follows this pattern:

def test_<metric>_parity_across_<attribute>(model, test_data):
    """
    <metric> must not differ by more than <threshold> across <attribute> groups.
    
    Regulatory basis: Equality Act 2010 s.149 (PSED) / EU AI Act Art. 10
    """
    results = {}
    for group in test_data[attribute].unique():
        mask = test_data[attribute] == group
        results[group] = compute_metric(
            model, test_data[mask]
        )
    
    max_gap = max(results.values()) - min(results.values())
    assert max_gap <= THRESHOLD, (
        f"{metric} gap across {attribute} is {max_gap:.3f} "
        f"(max allowed: {THRESHOLD}). "
        f"Group breakdown: {results}"
    )

Required Test Suite

Write ALL of these. Skip none.

Test 1: Demographic Parity

import pytest
import numpy as np

DEMOGRAPHIC_PARITY_THRESHOLD = 0.05

def test_demographic_parity(model, test_df):
    """Positive prediction rate must not vary by more than 5% across protected groups."""
    protected_attrs = ['sex', 'ethnicity', 'age_group']  # adjust to your attributes
    
    for attr in protected_attrs:
        if attr not in test_df.columns:
            continue
        
        rates = {}
        for group in test_df[attr].unique():
            mask = test_df[attr] == group
            if mask.sum() < 30:  # skip groups too small to be meaningful
                continue
            X = test_df[mask].drop(columns=['label'])
            rates[group] = model.predict(X).mean()
        
        if len(rates) < 2:
            continue
        
        gap = max(rates.values()) - min(rates.values())
        assert gap <= DEMOGRAPHIC_PARITY_THRESHOLD, (
            f"Demographic parity violation on '{attr}': gap={gap:.3f} "
            f"(threshold={DEMOGRAPHIC_PARITY_THRESHOLD}). "
            f"Rates: {rates}"
        )

Read the full file on GitHub · 262 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 262 lines · 38 tokens per session scan A b6ec15e0419b

Subscribe to this mod's changes

fairness-testing is a skill published in the GitHub repository obielin/responsible-ai-skills (2 stars, last pushed 5mo ago), licensed MIT. It adds 38 tokens to every session and 1,959 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

validate

Validate Semantica pipelines, extraction quality, graph schemas, and ontology consistency. Returns structured error/warning checklists. Uses PipelineValidator, PipelineBuilder.validatepipeline(), GraphValidator, and OntologyValidator. Sub-commands: pipeline, step, dependencies, extraction, graph, ontology, performance.

semantica-agi/semantica · 0 tokens

cli-eval

Create and run evaluation suites, watch live benchmark progress, view scorecards, compare model performance, and integrate eval runs with CI workflows from the CLI.

diegosouzapw/OmniRoute · 34 tokens

model-merging

Merge multiple fine-tuned models using mergekit to combine capabilities without retraining. Use when creating specialized models by blending domain-specific expertise (math + coding + chat), improving performance beyond single models, or experimenting rapidly with model variants. Covers SLERP, TIES-Merging, DARE, Task…

davila7/claude-code-templates · 73 tokens

darwinian-evolver

Evolve prompts/regex/SQL/code with Imbue's evolution loop.

NousResearch/hermes-agent · 22 tokens

extract

Run the full Semantica semantic extraction pipeline on a file or selected text — NER, relations, events, coreference resolution, triplets, and validation. Clears result cache before each run. Returns Markdown tables with entity/relation/event/triplet results and inline validator warnings.

semantica-agi/semantica · 59 tokens

policy

Define and enforce policies, access controls, and compliance rules over Semantica knowledge graphs.

semantica-agi/semantica · 20 tokens