christopherkarani/agent-skills/swift-ownership
Claude Code and agent skill by christopherkarani/agent-skills
- community
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-ownershipSKILL.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
- Name the resource and its invariant: who owns it, when it becomes usable, what ends its lifetime, and whether duplication is meaningful.
- Classify the value: freely copyable value, shared identity, or uniquely owned resource. Do not use a class merely to avoid a compiler diagnostic.
- Choose the smallest model that proves the invariant. Use
~Copyablefor unique resources; keep ordinary domain values copyable. - Design operations from their semantics:
borrowingobserves without taking ownership,consumingtakes the value,inoutmutates exclusive access. For copyable values, default conventions are often sufficient. - Compile the smallest example that exercises the lifetime. Treat diagnostics as design feedback; do not add
consume,copy, or@uncheckedjust to silence them. - Test success, failure, early return, thrown error, and repeated finalization paths.
Non-negotiable distinctions
consuminggives the callee ownership. A copyable argument may still be preserved by a copy; a noncopyable argument is unavailable after consumption.borrowingdoes not extend a value beyond the borrow and cannot be used to manufacture an independent result without an explicit copy where legal.~Copyableis a capability constraint, not a performance decoration. A type that contains a noncopyable member must model its containing lifetime accordingly.- A
deinitis a last-resort cleanup safety net, not permission to make cleanup order implicit when explicitfinish/closesemantics matter. - Generic parameters are copyable by default. Add
~Copyableonly 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
- SKILL.md in the repositoryCheckingswift-6.3/swift-ownership/SKILL.md
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
[](https://verified-skill.com/skills/christopherkarani/agent-skills/swift-ownership)