christopherkarani/agent-skills/swift-ownership

Claude Code and agent skill by christopherkarani/agent-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when Swift code owns a unique resource, has `~Copyable`/`borrowing`/`consuming` diagnostics, or needs an ownership-aware API. Do not invoke for ordinary value-type refactors with no lifetime or transfer invariant.

Install

npx vskill@latest install christopherkarani/agent-skills/swift-ownership

SKILL.md

Swift ownership

Make the ownership invariant explicit before choosing syntax. The goal is a statically checkable lifecycle, not maximum use of ownership keywords.

Procedure

  1. Name the resource and its invariant: who owns it, when it becomes usable, what ends its lifetime, and whether duplication is meaningful.
  2. Classify the value: freely copyable value, shared identity, or uniquely owned resource. Do not use a class merely to avoid a compiler diagnostic.
  3. Choose the smallest model that proves the invariant. Use ~Copyable for unique resources; keep ordinary domain values copyable.
  4. Design operations from their semantics: borrowing observes without taking ownership, consuming takes the value, inout mutates exclusive access. For copyable values, default conventions are often sufficient.
  5. Compile the smallest example that exercises the lifetime. Treat diagnostics as design feedback; do not add consume, copy, or @unchecked just to silence them.
  6. Test success, failure, early return, thrown error, and repeated finalization paths.

Non-negotiable distinctions

  • consuming gives the callee ownership. A copyable argument may still be preserved by a copy; a noncopyable argument is unavailable after consumption.
  • borrowing does not extend a value beyond the borrow and cannot be used to manufacture an independent result without an explicit copy where legal.
  • ~Copyable is a capability constraint, not a performance decoration. A type that contains a noncopyable member must model its containing lifetime accordingly.
  • A deinit is a last-resort cleanup safety net, not permission to make cleanup order implicit when explicit finish/close semantics matter.
  • Generic parameters are copyable by default. Add ~Copyable only when the generic algorithm preserves unique ownership and its API can express the transfer.

For detailed rules and diagnostic patterns, read references/ownership-guide.md. Cite the relevant proposal in design notes when the choice is subtle.

Completion contract

Report the ownership invariant, why the representation fits it, every transfer/borrow boundary, and compiler/test evidence. If a resource cannot be proven to close exactly once, say so explicitly.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/christopherkarani/agent-skills/swift-ownership/badge)](https://verified-skill.com/skills/christopherkarani/agent-skills/swift-ownership)

Something wrong with this skill or its page? Tell us.