skills/fortify/SKILL.md
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 (use refactor-plan), or code review (use code-review).
npx skillsauth add helderberto/skills fortifyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Target: $ARGUMENTS (file, directory, or module — if blank, use unstaged changes)
git diff --name-onlyBefore proceeding, use the Read tool to read package.json (for test runner config).
Identify target files. If $ARGUMENTS is blank, use unstaged changed files.
*.test.ts or __tests__/)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.
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:
Test rules:
it('returns empty array when input is null')## 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
| Excuse | Rebuttal | |---|---| | "This function is fine at 40 lines" | If it has multiple responsibilities, split it. Length is a smell, not the rule. | | "No one will pass null here" | System boundaries surprise you. Guard at the edges. | | "It's internal code, no tests needed" | Internal code breaks too. If it has logic, it needs a test. | | "Adding tests will slow us down" | Backfilling tests now is cheaper than debugging regressions later. | | "The happy path covers it" | Bugs live in sad paths. Test the errors, the empties, the boundaries. | | "I'll harden it in a follow-up" | Follow-ups never happen. Harden now or accept the risk explicitly. |
testing
Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.
documentation
Compact the current conversation into a handoff doc so a fresh agent can continue the work. Use when user asks to "handoff", "/handoff", "hand this off", or wants to end a session mid-task. Don't use for summarising completed work, writing PRDs/plans/ADRs, or committing changes.
development
Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill, or asks "make a skill for X".
development
Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.