agentleFS
juju-wjuju-w/safa-runtime/.agents/skills/develop-swift/SKILL.md

develop-swift

Skill1 starsChanged 3 months agoMITView on GitHub

Develop and review production Swift 6 code with strict concurrency, Swift Package Manager boundaries, typed APIs, and Swift Testing. Use for changes to .swift files, Package.swift, Swift modules, actors or Sendable code, Codable contracts, subprocess/runtime adapters, tests, refactors, and code-quality reviews in this repository.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

28 rules. About 0 are common, 19 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read AGENTS.md, ARCHITECTURE.md, and the relevant feature spec.

    line 15
  2. Distinctive:

    Read the complete type and its tests.

    line 17
  3. Distinctive:

    Check the working tree and preserve unrelated changes.

    line 18
  4. Distinctive:

    If the requested behavior conflicts with a trust boundary, stop that implementation path and explain the conflict.

    line 21
  5. Distinctive:

    Prefer a value type and pure function for validation, classification, canonicalization, and state transitions.

    line 26
  6. Distinctive:

    Put I/O behind a narrow protocol and inject the implementation, clock, or process runner.

    line 28
  7. Distinctive:

    Keep parsing, domain decisions, platform adapters, and presentation separate.

    line 29
  8. Distinctive:

    Use one primary type per file.

    line 30
  9. Distinctive:

    Add a target dependency only when the architecture permits that direction.

    line 31
  10. Very specific:

    Use explicit versioned request and response DTOs at CLI/XPC boundaries.

    line 32
  11. Very specific:

    Prefer direct, unsurprising names.

    line 36
  12. Very specific:

    Use @unchecked Sendable only for a small Foundation, Security, XPC, or process bridge whose synchronization is reviewable in the same file.

    line 44
  13. Very specific:

    Prefer structured concurrency.

    line 46
  14. Distinctive:

    Never block an actor executor with process waits, pipe reads, semaphores, or file I/O.

    line 49
  15. Distinctive:

    Ensure continuations resume exactly once on success, failure, cancellation, and invalidation.

    line 50
  16. Very specific:

    Put pure invariants and policy cases in Tests/Unit.

    line 56
  17. Very specific:

    Put stable CLI/XPC encoding and exit behavior in Tests/Contract.

    line 57
  18. Very specific:

    Put composition and adapter journeys in Tests/Integration.

    line 58
  19. Very specific:

    Put trust-boundary, tamper, secret-exposure, and fail-closed cases in Tests/Security.

    line 59
  20. Distinctive:

    Use synthetic resources only.

    line 60
  21. Distinctive:

    Test invalid inputs and cancellation, not only the happy path.

    line 62
  22. Distinctive:

    Prefer deterministic fakes over sleeps.

    line 63
  23. Distinctive:

    Prefer labeled initializers and small methods with one reason to change.

    line 67
  24. Distinctive:

    Keep public surface area minimal.

    line 68
  25. Distinctive:

    Use extensions only to group a real conformance or cohesive capability.

    line 69
  26. Distinctive:

    Keep comments focused on invariants, platform quirks, and security rationale.

    line 70
  27. Distinctive:

    Do not hide side effects behind computed properties or innocent names.

    line 72
  28. Distinctive:

    Run the narrow test while iterating, then the repository gates:

    line 78

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Develop Swift

Produce small, readable Swift changes that preserve SAFA's trust boundaries. Treat compilation as the first check, not the definition of correctness.

Establish context

Before editing:

  1. Read AGENTS.md, ARCHITECTURE.md, and the relevant feature spec.
  2. Inspect Package.swift and the touched target's dependency direction.
  3. Read the complete type and its tests; do not infer behavior from one call site.
  4. Check the working tree and preserve unrelated changes.
  5. State which module owns the behavior before adding a type or dependency.

If the requested behavior conflicts with a trust boundary, stop that implementation path and explain the conflict. Do not weaken an invariant to make a test or demo pass.

Design the change

  • Prefer a value type and pure function for validation, classification, canonicalization, and state transitions.
  • Put I/O behind a narrow protocol and inject the implementation, clock, or process runner.
  • Keep parsing, domain decisions, platform adapters, and presentation separate.
  • Use one primary type per file. Split a file near 300 lines unless its cohesion is explicit.
  • Add a target dependency only when the architecture permits that direction.
  • Use explicit versioned request and response DTOs at CLI/XPC boundaries. Define CodingKeys; do not expose persistence models or add dynamic [String: JSONValue] payloads.
  • Model expected failures with precise error types and stable boundary error codes. Avoid fatalError, force unwraps, try!, and catch-all success fallbacks.
  • Prefer direct, unsurprising names. Avoid Manager, Helper, Utils, and generic dictionaries when a domain name or type exists.

Apply Swift 6 concurrency rules

  • Preserve Swift 6 language mode and strict concurrency.
  • Make immutable value types Sendable when they cross tasks or actors.
  • Isolate shared mutable state in an actor or a visibly synchronized adapter.
  • Use @unchecked Sendable only for a small Foundation, Security, XPC, or process bridge whose synchronization is reviewable in the same file.
  • Prefer structured concurrency. Use Task.detached only when actor inheritance would be wrong and document ownership, cancellation, and lifetime.
  • Propagate cancellation and deadlines through subprocess and XPC boundaries.
  • Never block an actor executor with process waits, pipe reads, semaphores, or file I/O.
  • Ensure continuations resume exactly once on success, failure, cancellation, and invalidation.

Test before implementation

For security-sensitive behavior, add the failing test first.

  • Put pure invariants and policy cases in Tests/Unit.
  • Put stable CLI/XPC encoding and exit behavior in Tests/Contract.
  • Put composition and adapter journeys in Tests/Integration.
  • Put trust-boundary, tamper, secret-exposure, and fail-closed cases in Tests/Security.
  • Use synthetic resources only. Tests must not contact real infrastructure or read real Keychain items.
  • Test invalid inputs and cancellation, not only the happy path.
  • Prefer deterministic fakes over sleeps. When time is the subject, inject a clock where practical.

Keep APIs readable

  • Prefer labeled initializers and small methods with one reason to change.
  • Keep public surface area minimal; default to internal visibility.
  • Use extensions only to group a real conformance or cohesive capability.
  • Keep comments focused on invariants, platform quirks, and security rationale. Do not narrate the syntax.
  • Do not hide side effects behind computed properties or innocent names.
  • Make resource ownership explicit for file handles, pipes, tasks, XPC connections, and temporary files; close or invalidate them on every path.

Validate the slice

Run the narrow test while iterating, then the repository gates:

xcrun swift-format lint --recursive --strict Sources Tests Apps/SAFA/Targets Package.swift
swift test --parallel
swift build -c release
xcodebuild -quiet -project Apps/SAFA/SAFA.xcodeproj -scheme "SAFA Runtime" \
  -configuration Debug CODE_SIGNING_ALLOWED=NO build

Inspect the final diff for accidental public API, new dependencies, dynamic wire payloads, real infrastructure data, and unbounded output. Follow the repository PR workflow and never publish a tag, Release, signed artifact, or Skill package while the publication hold is active.

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.