fitness-functions

fitness-functions is a skill for Claude Code from rshankras/claude-code-apple-skills. It costs 58 tokens per session (1,870 once invoked), scanned A, original, MIT.

A set of ordinary tests that checks whether a project still follows its fixed design rules, such as module boundaries, offline operation, or required content formats.

In plain words
What is it for?
It helps enforce which files may depend on which modules, verify exact counts in registries, and check that user-facing content follows a required format.
Why use it?
Rules written only in notes or review checklists can be forgotten or applied inconsistently. These tests turn them into automatic checks that run with the rest of the test suite.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md.

Part of the apple-skills plugin — 182 skills shipped together , and of apple-skills

Good fit It helps enforce which files may depend on which modules, verify exact counts in registries, and check that user-facing content follows a required format.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rshankras/claude-code-apple-skills/fitness-functions
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.

Any agent
npx skills add rshankras/claude-code-apple-skills --skill fitness-functions
Clone the repo
git clone --depth 1 https://github.com/rshankras/claude-code-apple-skills

Made for: Claude Code.

Or install apple-skills, the plugin that ships this one along with the rest of its 182 skills.

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 fitness-functions

README.md
[![agentmods](https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/fitness-functions/github.svg)](https://agentmods.dev/skills/rshankras/claude-code-apple-skills/fitness-functions)
Your own site
<a href="https://agentmods.dev/skills/rshankras/claude-code-apple-skills/fitness-functions"><img src="https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/fitness-functions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fitness-functions

Your own site · 80×15
<a href="https://agentmods.dev/skills/rshankras/claude-code-apple-skills/fitness-functions"><img src="https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/fitness-functions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,870 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00058 $0.01870
Opus 5.5 $0.00023 $0.00748
Sonnet 5.5 $0.00012 $0.00374
Haiku 4.5 $0.00006 $0.00187

Measured 1mo ago against content hash baeac2db17ea, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

fitness-functions 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 1mo 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/testing/fitness-functions/SKILL.md · 143 lines

How it starts

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

Architecture Fitness Functions

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.

When This Skill Activates

Use this skill when:

  • A project hard rule exists only in prose — CLAUDE.md constraints, file-header comments, review checklists ("deck games must run fully offline", "only the sync layer may import CloudKit")
  • A code review keeps re-checking the same structural rule by hand
  • An /apple:review structural finding is being graduated into permanent enforcement
  • A count, boundary, or content format was broken silently once already

Why a Test, Not a Lint Rule

A 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.

The Three Patterns

Pattern 1: Import-Boundary Allowlist Scan

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):

  • Resolve the source root from #filePath, never a hardcoded path — the test stays correct wherever the repo is checked out.
  • Match exact trimmed lines (line == "import X"), not contains — comments documenting the contract itself must not count as hits.
  • Compare full sets, not counts — the failure message then names the drifted file.
  • Exclude non-shipping directories deliberately (DEBUG-only spikes, generated code) and say why in a comment: the guarantee is about what ships.
  • The allowlist is a fence, not a headcount. Widening it is a legitimate, documented decision: when a new file genuinely belongs inside the boundary, the test failing is the system working — record why in the allowlist comment, then add it.
  • Add a companion API-surface scan for bypass routes the import check can't see. An import-only check misses a file calling the underlying API directly (every file already imports Foundation, which is enough to reach URLSession without importing the fenced framework). Scan for the raw API strings (URLSession(, URLSession.shared) outside the boundary too.

Read the full file on GitHub · 143 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 143 lines · 58 tokens per session scan A baeac2db17ea

Subscribe to this mod's changes

fitness-functions is a skill published in the GitHub repository rshankras/claude-code-apple-skills (927 stars, last pushed 26d ago), licensed MIT. It adds 58 tokens to every session and 1,870 once invoked, about $0.0002 per session on Opus 5.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-11-05.

Related

fitness-functions compared with skills from other repositories

fitness-functions next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
fitness-functionsrshankras/claude-code-apple-skillsSkill92726d agoMITA58Claude Code
image-crop-rotateinstavm/coderunnerSkill903yesterdayApache-2.0A50Claude Code, Codex
pdf-text-replaceinstavm/coderunnerSkill903yesterdayApache-2.0A42Claude Code, Codex
aso-playbookGingiris-1031/gingiris-skillsSkill93yesterdayMITA48Claude Code, Codex
gingiris-aso-growthGingiris-1031/gingiris-skillsSkill93yesterdayMITA320Claude Code
flame-harness-evaluatortjdrhs90/flutter-flame-harnessSkill61todayMITA41Claude Code
flame-harness-admobtjdrhs90/flutter-flame-harnessSkill61todayMITA41Claude Code