agentleFS
christopherkaranichristopherkarani/rv/.claude/skills/swift-functional-core/SKILL.md

swift-functional-core

Skill8 starsChanged 5 days agoApache-2.0View on GitHub

Use when a Swift feature contains policy, evaluation, parsing, validation, state transitions, or deterministic business logic that can be separated from I/O. Do not force this skill onto inherently imperative resource or UI code.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep decisions deterministic and effects at the boundary.

    line 8
  2. Distinctive:

    Keep the core free of global state, hidden task scheduling, logging side effects, and environment reads.

    line 15
  3. Distinctive:

    Test the transition table and properties first.

    line 16
  4. Distinctive:

    Keep mutation where it makes ownership, performance, or state transitions clearer.

    line 17
  5. Distinctive:

    Read references/core-boundary-guide.md when choosing boundaries or designing test seams.

    line 19
  6. Distinctive:

    Do not introduce a protocol for every dependency.

    line 26
  7. Distinctive:

    Do not hide policy in a callback, global singleton, actor, or logging side effect.

    line 27

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Swift functional core

Keep decisions deterministic and effects at the boundary. Functional design here means explicit data flow and testable invariants, not a ban on mutation or objects.

Procedure

  1. Separate inputs, decision logic, state transitions, and effects. Identify the smallest pure function or value reducer that can express the requirement.
  2. Model outcomes as domain types: enums with associated values, typed values, and explicit error/indeterminate cases rather than sentinel strings or flags.
  3. Make dependencies explicit at the shell. Pass clocks, randomness, filesystem, network, and process capabilities through narrow interfaces or values.
  4. Keep the core free of global state, hidden task scheduling, logging side effects, and environment reads.
  5. Test the transition table and properties first; test adapters with focused integration checks.
  6. Keep mutation where it makes ownership, performance, or state transitions clearer. Do not copy large data merely to appear functional.

Read references/core-boundary-guide.md when choosing boundaries or designing test seams.

On Swift 6.4, store async outcomes with await Result { try await … } (SE-0530) when the core must treat success/failure as a value. Keep effects at the shell.

Guardrails

  • A pure function may return a command/effect description instead of performing the effect.
  • Do not introduce a protocol for every dependency; a closure or concrete value is often clearer.
  • Do not hide policy in a callback, global singleton, actor, or logging side effect.
  • Exhaustive state modeling is more valuable than a large abstraction hierarchy.

Completion contract

Show the pure input/output contract, the effect boundary, transition coverage, and deterministic test evidence.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.