Install any skill in seconds. Free to start, no credit card required.
Get Started Free →rshankras/code-size
Enforce complexity and size limits on Swift code with SwiftLint threshold rules — cyclomatic complexity, function/type/file length, parameter count — adopted via a violations baseline so existing code never blocks.
Passed 21 of 23 test cases with the skill, and 13 of 23 without it.
and 10 more in the full report
8 fixed13 passed either way2 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 8 test cases the skill fixed. Same model, same prompt, with and without the skill.
What version of SwiftLint introduced native support for `--write-baseline` and `--baseline` flags?
| Checked | Without skill | With skill |
|---|---|---|
| Cite SwiftLint 0.55 as the minimum version for native baseline support. | Missed | Passed |
The instructions your model reads when the skill loads.
Complexity is the strongest single predictor of defect density, and code written by agents balloons fastest — an agent under pressure adds one more branch to an existing function far more readily than it extracts a new one. These five SwiftLint threshold rules are the deterministic cap: they keep functions small enough that tests can actually cover their branches, and they keep agents from wrangling with their own tangles.
Use this skill when:
testing/fitness-functions/)The fragment at rules/swiftlint.yml configures five built-in SwiftLint rules (all enabled by default in SwiftLint — this fragment sets the thresholds):
| Rule | Warning | Error | What it caps |
|---|---|---|---|
cyclomatic_complexity | 10 | 20 | Independent paths through one function |
function_body_length | 50 | 100 | Lines per function body |
type_body_length | 300 | 500 | Lines per type body |
file_length | 500 | 1000 | Lines per file |
function_parameter_count | 5 | 8 | Parameters per function |
Merge the fragment into the project's .swiftlint.yml (alongside any opt_in_rules/custom_rules fragments already adopted).
Turning these rules on in an existing codebase must not trigger a refactoring spree — bulk rewrites to satisfy a linter are how working code gets broken. Freeze today's violations and gate only new ones:
# One-time: record existing violations (SwiftLint 0.55+)
swiftlint lint --write-baseline .swiftlint-baseline.json
# The gate from then on — fails only on NEW violations
swiftlint lint --strict --baseline .swiftlint-baseline.json
Commit .swiftlint-baseline.json. Shrink it opportunistically: when touching a baselined function for other reasons, fix its violation and regenerate the baseline in the same commit.
test cases passed, vs 13 / 23 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.