Install any skill in seconds. Free to start, no credit card required.
Get Started Free →rshankras/fitness-functions
Write architecture fitness functions — deterministic tests that enforce a project's hard rules (module boundaries, offline guarantees, content contracts) from inside its own test target.
Passed 20 of 23 test cases with the skill, and 12 of 23 without it.
and 15 more in the full report
9 fixed11 passed either way2 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 9 test cases the skill fixed. Same model, same prompt, with and without the skill.
Write a Swift test pinning the number of catalog categories in `StoreCatalog.allCategories` to 14. An engineer suggests putting `#expect(StoreCatalog.allCategories.count == 14)` on a single line. Show the complete test implementation.
| Checked | Without skill | With skill |
|---|---|---|
| The test code includes inline comments logging the historical reasons and feature milestones that changed the count to 14 | Missed | Passed |
The instructions your model reads when the skill loads.
A fitness function is an ordinary test that enforces an architectural rule instead of a behavior. It lives in the app's own test target, runs under every existing test gate forever, and turns "the agent said it's fine" into an exit code. This is the gauntlet's answer for invariants no unit test of behavior can see: a file quietly importing a framework it must not touch, a registry drifting from its documented size, user-facing copy breaking its format contract.
Use this skill when:
/apple:review structural finding is being graduated into permanent enforcementA per-line regex (SwiftLint custom_rules) can flag a line. A fitness function can assert a set: "the files importing MusicKit are exactly these four", "the mode registry has exactly 21 entries", "every case's copy fits the format". Sets, counts, and cross-file facts need code, and putting that code in the test target means no new tooling, no CI wiring — it rides the test gate that already exists.
Enforces "only these files may import X." The test walks the shipped source tree and compares the actual importer set against an allowlist — so a fifth importer fails a test, not a code review.
Key rules (learned in production):
#filePath, never a hardcoded path — the test stays correct wherever the repo is checked out.line == "import X"), not contains — comments documenting the contract itself must not count as hits.URLSession without importing the fenced framework). Scan for the raw API strings (URLSession(, URLSession.shared) outside the boundary too.Template: templates/ImportBoundaryTests.swift
Enforces "this code path never attempts X" — stronger than "happens to succeed without X." The canonical case is an offline guarantee: register a URLProtocol subclass that intercepts, counts, and fails every network request, drive the real production path, and assert the counter stayed at zero.
Key rules:
defer.interceptedRequestCount == 0: the contract is zero attempts, not zero successes.test cases passed, vs 12 / 23 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.