swift-clean-errors

Installation
SKILL.md

Swift Clean Errors

Audit and fix error handling in Swift code per Clean Code (Robert Martin), adapted to Swift's error system.

Arguments

The user provided: $ARGUMENTS

If a file path is given — read it. If no arguments — ask the user to paste the code or specify a file.

Checklist to Apply

1. Use throws Instead of Returning Optional or Bool

  • Functions that can fail due to an external condition should throw, not return nil
  • nil return hides the reason for failure; a thrown Error explains it
// BAD
func parseJSON(from data: Data) -> User? { ... }
Installs
29
GitHub Stars
26
First Seen
Apr 27, 2026
swift-clean-errors — levabond/ios-clean-code-skills