RTLDesignSherpa: Skill for Claude Code

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

test-patterns is a skill for Claude Code from sean-galloway/RTLDesignSherpa. It costs 59 tokens per session (2,550 once invoked), scanned A, original, MIT.

A repository-specific guide for testing RTL, or hardware logic described in code, with the CocoTB Python testing framework. It defines where tests go, how they are named, which testbench methods they need, and how test levels are organized.

In plain words
What is it for?
Use it before writing or changing tests for common, AMBA, or project-specific RTL modules, especially when using BFMs, waveforms, and gate, functional, or full test levels.
Why use it?
It prevents tests from being placed or structured incorrectly in a repository that uses two different test layouts. It also gives contributors a shared target for functional coverage and debugging support.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

This is sean-galloway/RTLDesignSherpa's own configuration. It tells Claude Code how to work on RTLDesignSherpa 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 RTLDesignSherpa configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is 'rtl_stream_fub': '../../../../rtl/fub',.

Reuse

Borrowing it

Nothing to install: this file belongs to sean-galloway/RTLDesignSherpa. 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/sean-galloway/RTLDesignSherpa/main/.claude/skills/test-patterns/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/sean-galloway/RTLDesignSherpa

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/sean-galloway/rtldesignsherpa/test-patterns.svg)](https://agentmods.dev/skills/sean-galloway/rtldesignsherpa/test-patterns)
Your own site
<a href="https://agentmods.dev/skills/sean-galloway/rtldesignsherpa/test-patterns"><img src="https://agentmods.dev/badge/skills/sean-galloway/rtldesignsherpa/test-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,550 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00059 $0.02550
Opus 5 $0.00030 $0.01275
Sonnet 5 $0.00012 $0.00510
Haiku 4.5 $0.00006 $0.00255

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

Security

Grade A, and why

test-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 3d 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-patterns/SKILL.md · 298 lines

How it starts

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

Test patterns

Moved out of the root CLAUDE.md, which loaded all of this into every session whether or not a test was in scope. /GLOBAL_REQUIREMENTS.md remains the enforcement authority and wins on conflict.

Writing Tests

Every RTL module requires a test!

# Run specific test
pytest val/{subsystem}/test_{module}.py -v

# Run all tests in subsystem
pytest val/{subsystem}/ -v

# Run with coverage
pytest val/{subsystem}/ --cov=rtl/{subsystem}/

Test Structure:

  1. Use CocoTB framework
  2. Import appropriate BFMs from bin/TBClasses/
  3. Target >95% functional coverage
  4. Document test methodology in file header
  5. Include waveform dumps for debugging

Test File Location:

  • val/common/test_{module}.py for rtl/common/
  • val/math/test_{module}.py for rtl/math/
  • val/amba/test_{module}.py for rtl/amba/
  • projects/components/{name}/dv/tests/ for project-specific tests (RAPIDS, STREAM, bridge, ...)

🚨 CRITICAL: Test Structure Pattern 🚨

The repository uses TWO different test patterns depending on the location:

Pattern A: Direct CocoTB (val/common/, val/amba/ areas)

import cocotb
from cocotb_test.simulator import run

# CocoTB test function - direct @cocotb.test() decorator
@cocotb.test(timeout_time=3, timeout_unit="ms")
async def fifo_test(dut):
    tb = FifoBufferTB(dut, dut.clk, dut.rst_n)
    await tb.start_clock('clk', 10, 'ns')
    # ... test logic

# Pytest wrapper function
@pytest.mark.parametrize("data_width, depth", params)
def test_fifo_buffer(request, data_width, depth):
    # ... setup paths, filelist, parameters
    run(
        python_search=[tests_dir],
        verilog_sources=verilog_sources,
        toplevel=dut_name,
        module=module,  # Python module containing cocotb tests
        # ... compilation args
    )

Pattern B: CocoTB + Pytest Wrappers (projects/components/ areas)

⚠️ HARD REQUIREMENT for projects/components/: MUST use Pattern B ⚠️

import cocotb
from cocotb_test.simulator import run

# 1. CocoTB test functions - prefix with "cocotb_test_*" to prevent pytest collection
@cocotb.test(timeout_time=100, timeout_unit="ms")
async def cocotb_test_basic(dut):  # ← "cocotb_test_*" prefix!
    """CocoTB test function - NOT collected by pytest"""
    tb = SimpleSRAMTB(dut)
    await tb.setup_clocks_and_reset()
    # ... test logic

@cocotb.test(timeout_time=100, timeout_unit="ms")
async def cocotb_test_stress(dut):  # ← "cocotb_test_*" prefix!
    """Another CocoTB test function"""
    tb = SimpleSRAMTB(dut)
    await tb.setup_clocks_and_reset()
    # ... stress test logic

# 2. Pytest wrapper functions - call specific cocotb_test_* functions
@pytest.mark.parametrize("addr_width, data_width", params)
def test_basic(request, addr_width, data_width):
    """Pytest wrapper - calls cocotb_test_basic"""
    module, repo_root, tests_dir, log_dir, rtl_dict = get_paths({
        'rtl_stream_fub': '../../../../rtl/fub',
    })

    verilog_sources, includes = get_sources_from_filelist(
        repo_root=repo_root,
        filelist_path='projects/components/dmas/stream/rtl/filelists/fub/sram_controller.f'
    )

    run(
        python_search=[tests_dir],
        verilog_sources=verilog_sources,
        includes=includes,
        toplevel=dut_name,
        module=module,
        testcase="cocotb_test_basic",  # ← Explicitly specify which cocotb function to run
        parameters=rtl_parameters,
        # ... compilation args
    )

@pytest.mark.parametrize("addr_width, data_width", params)
def test_stress(request, addr_width, data_width):
    """Pytest wrapper - calls cocotb_test_stress"""
    # ... same setup as above
    run(
        # ... same args except:
        testcase="cocotb_test_stress",  # ← Different cocotb function
        # ...
    )

Read the full file on GitHub · 298 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. 3d ago First seen · 298 lines · 59 tokens per session scan A c94042d21d70

Subscribe to this mod's changes

test-patterns is a skill published in the GitHub repository sean-galloway/RTLDesignSherpa (23 stars, last pushed yesterday), licensed MIT. It adds 59 tokens to every session and 2,550 once invoked, about $0.0003 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-09-04.