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.
In this repository18 other files it gives its agents.
- codebase-designSkill
- principle-type-system-disciplineSkill
- swift-64-concurrencySkill
- swift-adversarial-pr-reviewSkill
- swift-api-design-guidelinesSkill
- swift-concurrencySkill
- swift-evaluate-paritySkill
- swift-functional-architectureSkill
- swift-hexagonal-spmSkill
- swift-hook-xpcSkill
- swift-pr-orchestrationSkill
- swift-protocol-boundariesSkill
- swift-pr-reviewSkill
- swift-systems-safetySkill
- swift-testing-proSkill
- swift-thermo-nuclear-reviewSkill
- swift-type-system-architectureSkill
- swift-value-semanticsSkill
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
- Distinctive: line 8
Keep decisions deterministic and effects at the boundary.
- Distinctive: line 15
Keep the core free of global state, hidden task scheduling, logging side effects, and environment reads.
- Distinctive: line 16
Test the transition table and properties first.
- Distinctive: line 17
Keep mutation where it makes ownership, performance, or state transitions clearer.
- Distinctive: line 19
Read references/core-boundary-guide.md when choosing boundaries or designing test seams.
- Distinctive: line 26
Do not introduce a protocol for every dependency.
- Distinctive: line 27
Do not hide policy in a callback, global singleton, actor, or logging side effect.
≈ “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.
Files
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
- Separate inputs, decision logic, state transitions, and effects. Identify the smallest pure function or value reducer that can express the requirement.
- Model outcomes as domain types: enums with associated values, typed values, and explicit error/indeterminate cases rather than sentinel strings or flags.
- Make dependencies explicit at the shell. Pass clocks, randomness, filesystem, network, and process capabilities through narrow interfaces or values.
- Keep the core free of global state, hidden task scheduling, logging side effects, and environment reads.
- Test the transition table and properties first; test adapters with focused integration checks.
- 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.
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
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.

