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.
curl -O https://raw.githubusercontent.com/mitchdenny/hex1b/main/.github/skills/writing-unit-tests/SKILL.mdgit clone --depth 1 https://github.com/mitchdenny/hex1bWrote 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.
[](https://agentmods.dev/skills/mitchdenny/hex1b/writing-unit-tests)<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>- NVIDIA SkillSpector warn
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.
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.
| Model | Per session | Once 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 |
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.
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
- Prefer full terminal stack testing - Use
Hex1bTerminal.CreateBuilder()to create complete terminal environments - Use
.WithHex1bApp()for TUI functionality tests - This wires up the full app lifecycle - Keep tests simple and linear - Avoid excessive abstractions; repeating patterns are beneficial for AI agents
- Assert on visual behavior - Use
CellPatternSearcherand color assertions for render verification - 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"));
}
}
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.
- 8d ago First seen · 562 lines · 33 tokens per session scan A b5921a2d086c
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.
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.
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…
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.
dotnet-testing-autofixture-nsubstitute-integration
A .NET testing guide for using AutoFixture and NSubstitute to automatically create test data and substitute versions of dependencies.
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.
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.