claude-scaffold: Skill for Claude Code

.claude/skills/test-first-patterns/SKILL.md

test-first-patterns is a skill for Claude Code from pyramidheadshark/claude-scaffold. It costs 0 tokens per session (975 once invoked), scanned A, original, MIT.

A test-first development guide: tests are written before implementation, starting with behaviour scenarios and then unit tests. BDD, or Behaviour-Driven Development, describes software behaviour from a user's perspective in executable scenarios.

In plain words
What is it for?
It is for writing pytest-bdd feature files, unit tests, conftest setup, test strategies, and coverage reviews.
Why use it?
It provides a fixed order for turning requirements into tests, helping keep business rules documented and checked as code changes.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is pyramidheadshark/claude-scaffold's own configuration. It tells Claude Code how to work on claude-scaffold itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-scaffold configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is scenarios("../features/knowledge_base.feature").

Reuse

Borrowing it

Nothing to install: this file belongs to pyramidheadshark/claude-scaffold. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/pyramidheadshark/claude-scaffold/main/.claude/skills/test-first-patterns/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/pyramidheadshark/claude-scaffold

Made for: Claude Code.

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 test-first-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/pyramidheadshark/claude-scaffold/test-first-patterns.svg)](https://agentmods.dev/skills/pyramidheadshark/claude-scaffold/test-first-patterns)
Your own site
<a href="https://agentmods.dev/skills/pyramidheadshark/claude-scaffold/test-first-patterns"><img src="https://agentmods.dev/badge/skills/pyramidheadshark/claude-scaffold/test-first-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 975 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.00000 $0.00975
Opus 5 $0.00000 $0.00487
Sonnet 5 $0.00000 $0.00195
Haiku 4.5 $0.00000 $0.00097

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

Security

Grade A, and why

test-first-patterns 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 7d 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.

.claude/skills/test-first-patterns/SKILL.md · 144 lines

How it starts

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

Test-First Patterns

When to Load This Skill

Load when writing tests, creating .feature files, setting up conftest, discussing test strategy, or reviewing coverage.

Philosophy

Tests are written BEFORE code. Always. No exceptions.

The order is: Design Doc → BDD Scenarios → Unit Tests → Implementation.

BDD scenarios come from the design document's use cases section — they are a direct translation of business requirements into executable specifications. This makes tests the living documentation of business logic.

Two-Layer Testing Strategy

Layer 1: BDD (Behaviour-Driven Development)

BDD scenarios live in tests/features/*.feature and describe behaviour from the user's perspective. They directly correspond to use cases in design-doc.md.

Use pytest-bdd (not Behave — stays within pytest ecosystem).

Feature: User asks a question to the knowledge base assistant

  Scenario: Successful answer from knowledge base
    Given the knowledge base contains documents about system usage
    When the user asks "How do I add a new user?"
    Then the assistant returns an answer with steps
    And the answer references the relevant document section

  Scenario: Question outside knowledge base scope
    Given the knowledge base contains documents about system usage
    When the user asks "What is the weather in Moscow?"
    Then the assistant responds that it cannot answer this question
    And no hallucinated information is returned

Layer 2: Unit Tests (TDD Red-Green-Refactor)

Unit tests cover individual functions and classes in core/ and services/. They use pytest directly.

import pytest

from src.project_name.core.domain import KnowledgeQuery, QueryResult


def test_query_result_is_empty_when_no_documents_match():
    query = KnowledgeQuery(text="unrelated question", top_k=3)
    result = QueryResult(matches=[], query=query)
    assert result.is_empty is True


def test_query_result_is_not_empty_when_matches_exist():
    query = KnowledgeQuery(text="how to add user", top_k=3)
    result = QueryResult(matches=["doc1", "doc2"], query=query)
    assert result.is_empty is False

Read the full file on GitHub · 144 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 7d ago First seen · 144 lines · 0 tokens per session scan A 6175ca0d2974

Subscribe to this mod's changes

test-first-patterns is a skill published in the GitHub repository pyramidheadshark/claude-scaffold (4 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 975 tokens. 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.