Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Test Writer

ASecurity

Use this skill when writing tests for AI pipelines, LLM integrations, or ML systems. Triggers include: "write tests for my AI code", "how do I test an LLM call", "mock the API", "test my RAG pipeline", "non-deterministic output testing", or any request to add test coverage to code that calls LLMs.

3 stars
0 votes
0 copies
0 views
Added 9/19/2026
ai-agentspythontestingapi

Works with

cliapi

Security Analysis

A100/100

Scanned 9/19/2026

Install to Claude Code

$npx -y skills add satishkc7/claude-config --skill test-writer --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Test Writer?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Test Writer
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/satishkc7-test-writer/badge)](https://www.skillsdirectory.com/skills/satishkc7-test-writer)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: test-writer
description: Use this skill when writing tests for AI pipelines, LLM integrations, or ML systems. Triggers include: "write tests for my AI code", "how do I test an LLM call", "mock the API", "test my RAG pipeline", "non-deterministic output testing", or any request to add test coverage to code that calls LLMs.
---

# Test Writer Skill (AI/LLM Systems)

## Core Principle
Never assert exact LLM output. Assert structural correctness, constraints, and semantic properties.

## Pattern 1: Mock the LLM (Unit Tests)
```python
# conftest.py
import pytest, json
from unittest.mock import patch, MagicMock

@pytest.fixture
def mock_bedrock():
    with patch("boto3.client") as mock_client:
        resp = MagicMock()
        resp["body"].read.return_value = json.dumps({
            "content": [{"type": "text", "text": "Mocked response"}],
            "usage": {"input_tokens": 10, "output_tokens": 5}
        }).encode()
        mock_client.return_value.invoke_model.return_value = resp
        yield mock_client
```

## Pattern 2: Structural Assertions
```python
def test_extract_returns_valid_schema(monkeypatch):
    monkeypatch.setattr("mymodule.invoke_claude",
                        lambda _: '{"name": "John", "age": 30}')
    result = extract_person_info("John is 30 years old.")
    assert isinstance(result, dict)
    assert "name" in result and "age" in result
    assert isinstance(result["age"], int)
```

## Pattern 3: Constraint-Based Assertions
```python
def test_summary_constraints(monkeypatch):
    monkeypatch.setattr("mymodule.invoke_claude", lambda _: "A short summary.")
    summary = summarize("Long document text here...")
    assert len(summary) < 500
    assert summary.strip()
    assert "." in summary
```

## Pattern 4: Gated Integration Tests
```python
@pytest.mark.integration  # run with: pytest -m integration
def test_real_api_response():
    result = invoke_claude("What is 2 + 2?")
    assert "4" in result
    assert len(result) < 2000
```

## Pattern 5: Prompt Regression
```python
import hashlib
PROMPT_HASHES = {"summarize_v2": "abc123def456"}

def test_prompt_unchanged():
    from mymodule.prompts import SUMMARIZE_PROMPT
    actual = hashlib.md5(SUMMARIZE_PROMPT.encode()).hexdigest()
    assert actual == PROMPT_HASHES["summarize_v2"], \
        "Prompt changed! Update hash and run evals before merging."
```

## Coverage Checklist
- [ ] All LLM calls mocked in unit tests
- [ ] Output schema validated (not exact content)
- [ ] Length and format constraints asserted
- [ ] Error paths tested (throttling, timeout, malformed output)
- [ ] Retry logic tested with mock failures
- [ ] Prompt hashes tracked for regression detection
- [ ] Integration tests marked and gated
- [ ] RAG fallback ("no results") case covered

Attribution

satishkc7satishkc7
View sourceMore from satishkc7 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.

1023331 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

686011 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3331 votes

catchup

Recovers prior coding-agent session context by running `catchup <agent> --since-compact`, which extracts a clean summary of a previous Codex, Claude Code, Antigravity, OpenCode, or Pi Agent session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", or asks to recover/summarize a previous session before continuing. Do NOT use for the current conversation, git history, or any non-agent log.

611 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →