hex1b: Skill for Claude Code

.github/skills/writing-unit-tests/SKILL.md

writing-unit-tests is a skill for Claude Code, Codex from mitchdenny/hex1b. It costs 33 tokens per session (4,789 once invoked), scanned A, original, MIT.

Testing guidance for the Hex1b library, which builds text-based user interfaces in a terminal. It explains how to test widgets, nodes, input handling, navigation, and what appears on screen using MSTest.

In plain words
What is it for?
Use it when adding tests for Hex1b widgets, layout, rendering, keyboard input, focus movement, or terminal functionality, including checks of displayed text, colors, and visual patterns.
Why use it?
It gives developers consistent ways to test terminal interfaces instead of checking only isolated pieces or relying on manual viewing. The guidance favors testing the complete terminal application where that reflects real behavior.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

This is mitchdenny/hex1b's own configuration. It tells Claude Code and Codex how to work on hex1b 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 hex1b configures →

Reuse

Borrowing it

Nothing to install: this file belongs to mitchdenny/hex1b. 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/mitchdenny/hex1b/main/.github/skills/writing-unit-tests/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/mitchdenny/hex1b

Made for: Claude Code, Codex.

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 writing-unit-tests

README.md
[![agentmods](https://agentmods.dev/badge/skills/mitchdenny/hex1b/writing-unit-tests.svg)](https://agentmods.dev/skills/mitchdenny/hex1b/writing-unit-tests)
Your own site
<a href="https://agentmods.dev/skills/mitchdenny/hex1b/writing-unit-tests"><img src="https://agentmods.dev/badge/skills/mitchdenny/hex1b/writing-unit-tests.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,789 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 warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Rogue Agent · line 16
    Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
    Fix: Prevent the skill from modifying its own code, SKILL.md, or configuration files. Treat skill files as read-only at runtime.
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.00033 $0.04789
Opus 5 $0.00016 $0.02395
Sonnet 5 $0.00007 $0.00958
Haiku 4.5 $0.00003 $0.00479

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

Security

Grade A, and why

writing-unit-tests 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 8d 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.

.github/skills/writing-unit-tests/SKILL.md · 562 lines

How it starts

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

Writing Unit Tests Skill

This skill provides guidelines for AI agents writing unit tests for the Hex1b TUI library. It outlines the preferred testing approach, patterns, and anti-patterns to avoid. Tests use MSTest 4 with MSTest.Sdk/4.2.3, OutputType=Exe, and Microsoft.Testing.Platform (MTP). global.json configures dotnet test to use MTP; test projects can also run in executable mode with dotnet run --project tests/SomeProject/.

Core Philosophy

  1. Prefer full terminal stack testing - Use Hex1bTerminal.CreateBuilder() to create complete terminal environments
  2. Use .WithHex1bApp() for TUI functionality tests - This wires up the full app lifecycle
  3. Keep tests simple and linear - Avoid excessive abstractions; repeating patterns are beneficial for AI agents
  4. Assert on visual behavior - Use CellPatternSearcher and color assertions for render verification
  5. Update this skill when discovering new patterns - Build the body of knowledge as part of PRs

When to Use Full Stack vs Isolation

Test Type Approach
Widget behavior, layout, rendering Full stack with Hex1bTerminal.CreateBuilder()
Input handling, focus navigation Full stack with WithHex1bApp()
Low-level APIs (Surface, SurfaceCell) Test in isolation (dependencies of Hex1bApp)
Color/theme verification Full stack with snapshot color assertions

Standard Test Structure

Full Stack Integration Test

Test files import Microsoft.VisualStudio.TestTools.UnitTesting. The Hex1b.Testing namespace is global-using'd via Directory.Build.props for helpers such as TestSeq. For test output, add public TestContext TestContext { get; set; } = null!; and call TestContext.WriteLine(...). Suppressed MSTest analyzers are MSTEST0014, MSTEST0030, MSTEST0032, and MSTEST0057.

This is the preferred pattern for most tests:

using Microsoft.VisualStudio.TestTools.UnitTesting;

[TestClass]
public class WidgetNameTests
{
    [TestMethod]
    public async Task WidgetName_Scenario_ExpectedBehavior()
    {
        // Arrange - Build the terminal with the app
        await using var terminal = Hex1bTerminal.CreateBuilder()
            .WithHex1bApp((app, options) => ctx => new VStackWidget([
                new TextBlockWidget("Hello"),
                new ButtonWidget("Click Me")
            ]))
            .WithHeadless()
            .WithDimensions(80, 24)
            .Build();

        // Act & Assert - Use input sequencer with WaitUntil
        var snapshot = await new Hex1bTerminalInputSequenceBuilder()
            .WaitUntil(s => s.ContainsText("Hello"), TimeSpan.FromSeconds(2), "initial render")
            .Down()  // Navigate to button
            .WaitUntil(s => s.ContainsText("> Click Me"), TimeSpan.FromSeconds(2), "button focused")
            .Capture("focused-button")
            .Ctrl().Key(Hex1bKey.C)
            .Build()
            .ApplyWithCaptureAsync(terminal, TestContext.Current.CancellationToken);

        // Assert (often redundant if WaitUntil already verified)
        Assert.IsTrue(snapshot.ContainsText("> Click Me"));
    }
}

Read the full file on GitHub · 562 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. 8d ago First seen · 562 lines · 33 tokens per session scan A b5921a2d086c

Subscribe to this mod's changes

writing-unit-tests is a skill published in the GitHub repository mitchdenny/hex1b (175 stars, last pushed today), licensed MIT. It adds 33 tokens to every session and 4,789 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-30.

Related

Other skills, from other repositories

author-test

Generate a test given sample. Parameters: C# SDK repository root; Package name: one of Azure.AI.Projects, Azure.AI.Projects.Agents or Azure.AI.Extensions.OpenAI; the sample to use as a starting point for the test.

Azure/azure-sdk-for-net · 68 tokens

migrate-xunit-to-xunit-v3

Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest…

managedcode/dotnet-skills · 149 tokens

dotnet-testing-autodata-xunit-integration

A guide for using AutoFixture, a .NET library that creates test data, with xUnit, a .NET testing framework. It explains attributes such as AutoData, InlineAutoData, and MemberAutoData for supplying values to parameterized tests.

kevintsengtw/dotnet-testing-agent-skills · 181 tokens

dotnet-testing-autofixture-nsubstitute-integration

A .NET testing guide for using AutoFixture and NSubstitute to automatically create test data and substitute versions of dependencies.

kevintsengtw/dotnet-testing-agent-skills · 217 tokens

dotnet-testing-bogus-fake-data

A guide to Bogus, a .NET library for generating realistic fake data such as names, addresses, phone numbers, emails, and product records. It shows how to define generation rules and create one or many records.

kevintsengtw/dotnet-testing-agent-skills · 178 tokens

dotnet-testing-nsubstitute-mocking

A guide to using NSubstitute to create test doubles, which are stand-ins for real dependencies such as databases, files, or web services. It explains how to set return values, raise errors, and check whether methods were called.

kevintsengtw/dotnet-testing-agent-skills · 184 tokens