fortify

fortify is a skill for Claude Code, Codex from helderberto/agent-skills. It costs 93 tokens per session (800 once invoked), scanned A, original, MIT.

A reliability improvement workflow for existing code. It looks for oversized functions, unhandled edge cases, and missing unit tests, then strengthens approved areas with tests and smaller changes.

In plain words
What is it for?
Use it to harden a file, directory, or module, split functions with too many responsibilities, cover boundary cases, and add tests for untested behavior.
Why use it?
It makes fragile code easier to understand and helps catch failures that existing tests do not cover. Unit tests are small automated checks of individual pieces of code.

Skill for Claude CodeCodex

Part of the hb plugin — 40 skills, 6 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/helderberto/agent-skills/fortify
Any agent
npx skills add helderberto/agent-skills --skill fortify
Clone the repo
git clone --depth 1 https://github.com/helderberto/agent-skills

Made for: Claude Code, Codex.

Or install hb, the plugin that ships this one along with the rest of its 40 skills, 6 agents.

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 fortify

README.md
[![agentmods](https://agentmods.dev/badge/skills/helderberto/agent-skills/fortify.svg)](https://agentmods.dev/skills/helderberto/agent-skills/fortify)
Your own site
<a href="https://agentmods.dev/skills/helderberto/agent-skills/fortify"><img src="https://agentmods.dev/badge/skills/helderberto/agent-skills/fortify.svg" alt="Measured on agentmods" height="20"></a>
Per session 93 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 800 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00093 $0.00800
Opus 5 $0.00046 $0.00400
Sonnet 5 $0.00019 $0.00160
Haiku 4.5 $0.00009 $0.00080

Measured 4d ago against content hash e543ab27ad45, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

fortify 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 4d 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.

skills/fortify/SKILL.md · 91 lines

How it starts

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

Fortify

Target: $ARGUMENTS (file, directory, or module — if blank, use unstaged changes)

Workflow

1. Scope

Identify target files. If $ARGUMENTS is blank, use unstaged changed files.

  • Read each target file
  • Read its existing test file (co-located *.test.ts or __tests__/)
  • If no test file exists, note it

2. Audit

For each file, list findings in three buckets:

Bucket What to look for
Split Functions > 20 lines, multiple responsibilities, deeply nested logic (> 2 levels), God functions doing I/O + logic
Edge cases Missing null/empty/boundary checks at system boundaries, unhandled error paths, implicit assumptions
Test gaps Untested public functions, branches with no coverage, missing sad-path tests

Present the audit as a checklist. Ask "Which items should I address?" — list each finding as an option, with "All items" as first option marked (Recommended). Use AskUserQuestion (multiSelect) when available; otherwise present as a numbered checklist.

3. Harden (TDD loop per item)

For each approved item, apply red-green-refactor:

RED:    Write a failing test that exposes the gap
GREEN:  Minimal code change to pass
REFACTOR: Extract/simplify if the fix introduced complexity

One item at a time. Run tests after each cycle. Never batch.

Splitting rules:

  • Extract pure logic into named helpers — keep I/O at the edges
  • New functions must be testable through public interface when possible
  • Preserve the original function's signature (no breaking changes)

Test rules:

  • Test behavior, not implementation
  • Each test gets a descriptive name: it('returns empty array when input is null')
  • Prefer real values over mocks; mock only external I/O

4. Verify

  • Run full test suite
  • Confirm no regressions
  • Report summary: items addressed, tests added, functions extracted

Output format

## Fortify Report

### Audit
- [ ] Split: `processOrder` (45 lines, validation + persistence + notification)
- [ ] Edge: `parseConfig` — no handling for missing file
- [ ] Test: `formatOutput` — zero test coverage

### Changes
- Extracted `validateOrder()` from `processOrder()` (+1 fn, +3 tests)
- Added null-guard to `parseConfig` (+2 tests)
- Backfilled `formatOutput` tests (+4 tests)

### Result
Tests: 42 passed (was 35) | 0 failed

Read the full file on GitHub · 91 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. 4d ago First seen · 91 lines · 93 tokens per session scan A e543ab27ad45

Subscribe to this mod's changes

fortify is a skill published in the GitHub repository helderberto/agent-skills (14 stars, last pushed 3d ago), licensed MIT. It adds 93 tokens to every session and 800 once invoked, about $0.0005 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

golang-testing

Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak, snapshot testing, code coverage, integration tests, idiomatic test naming. Use when writing or reviewing Go tests, choosing a testing approach, setting up Go test CI…

samber/cc-skills-golang · 115 tokens

golang-stretchr-testify

Comprehensive guide to stretchr/testify for Golang testing. Covers assert, require, mock, and suite packages in depth. Use when writing tests with testify, creating mocks, setting up test suites, or choosing between assert and require. Covers testify assertions, mock expectations, argument matchers, call verification…

samber/cc-skills-golang · 97 tokens

js-in-html-testing

Test JS logic embedded in HTML using two-layer strategy - Python unit tests + Playwright browser integration tests.

liaohch3/claude-tap · 25 tokens

api-testing

Testing patterns for MCP tool/resource handlers using createMockContext and Vitest. Covers mock context options, handler testing, McpError assertions, format testing, Vitest config setup, and test isolation conventions.

cyanheads/obsidian-mcp-server · 46 tokens

test-writer

name: test-writer description: Generates comprehensive unit tests for code version: 1.0.0 owner: example tasktype: testing.

Observal/Observal · 0 tokens

testing

Use this skill when writing, reviewing, or improving tests in WrongStack. Triggers: user says "test", "unit test", "integration test", "e2e", "mock", "vitest", "coverage", "assert", "expect", "test strategy", "write tests".

WrongStack/WrongStack · 61 tokens