Fortify
Fortify existing code by splitting large functions, adding edge-case coverage, and backfilling unit tests. Use when user asks to "fortify", "harden", "bulletproof", "make robust", "make solid", "strengthen", "add missing tests", "split functions", or wants to improve reliability of existing code. Don't use for new features (use tdd), refactoring plans, or code review (use code-review).From its SKILL.md
npx -y skills add helderberto/agent-skills --skill fortifyAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 12 stars12 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.3 KB, 696 tokens by cl100k_base, as published. Nobody here has run it
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.tsor__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
Rules
- Never change external behavior — hardening is internal improvement
- Skip files with zero test infrastructure unless user explicitly asks to set it up
Error Handling
- If no test runner found → ask user which runner to use before proceeding
- If test suite fails before hardening → report failures and stop; don't harden broken code
- If a split introduces a regression → revert that split immediately, note it as blocked
- If target file has no exports (script/entrypoint) → audit only, skip test backfill unless user confirms
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 2 of the 12 instructions most test skills give in 696 tokens
Counted across 1,201 of the 2,096 authors here whose files we hold, read 2026-09-06
- Write a failing test before writing codein 43 of 1201, across 36 files
- Run the full test suitehere, and in 36 of 1201, across 35 files
- Test only one variable per experimentin 34 of 1201, across 17 files
- Read product marketing context before asking questionsin 34 of 1201, across 14 files
- Mock external dependenciesin 34 of 1201, across 30 files
- Define primary, secondary, and guardrail metricsin 33 of 1201, across 16 files
- Pre-determine sample size before startingin 31 of 1201, across 14 files
- Test behavior rather than implementationhere, and in 31 of 1201, across 29 files
- Formulate a hypothesis before designing a testin 30 of 1201, across 13 files
- Document every test hypothesis, variant, and resultin 29 of 1201, across 11 files
- Use descriptive test function namesin 25 of 1201, across 21 files
- Commit to the methodology without stopping earlyin 24 of 1201, across 8 files
Said here and by no other author read
- Identify target files or unstaged changes
- Audit files for split, edge cases, and test gaps
- Present audit findings as a checklist
- Ask user which items to address
- Apply red-green-refactor loop for each item
- Extract pure logic into named helpers
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.