Agent skill · software engineering · thebushidocollective

Objective-C Protocols and Categories

Use when objective-C protocols for defining interfaces and categories for extending classes, including formal protocols, optional methods, class extensions, and patterns for modular, reusable code design.

Why this skill is useful

Provides specific patterns and examples for using Objective-C protocols and categories that enhance modular and reusable code design, which the AI may not generate reliably on its own.

What it needs

About 8k tokens when loaded. Last updated 2026-07-19. 187 stars on the source repository.

What this skill does

Objective-C Protocols and Categories Introduction Protocols and categories are fundamental Objective-C features for defining interfaces and extending behavior. Protocols declare method contracts that classes can adopt, enabling polymorphism and delegation patterns. Categories extend existing classes with new methods without subclassing or source access. Protocols serve similar purposes to Java interfaces or Swift protocols, enabling multiple inheritance of behavior through composition. Categories are unique to Objective-C, allowing developers to organize code, add functionality to system classes, and split large implementations across multiple files. This skill covers formal protocols, optional methods, protocol composition, categories, class extensions, and best practices for modular Objective-C design. Formal Protocols Formal protocols declare method and property requirements that adopting classes must implement, establishing contracts for polymorphic behavior. Protocols enable polymorphic code that works with any object implementing the required methods, regardless of class hierarchy. Optional Protocol Methods Optional protocol methods allow adopters to implement only relevant methods, with runtime checking for implementation before calling. Always check for optional method implementation with respondsToSelector: before calling to prevent crashes from unimplemented methods. Categories for Class Extension Categories add methods to existing classes without subclassing, enabling code organization and extension of system classes. Categories cannot add instance variables but can add methods and use associated objects for property-like behavior. Class Extensions Class extensions are anonymous categories declared in implementation files that can add private methods and properties invisible to clients. Class extensions hide implementation details and provide a clean separation between public API and private implementation. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills thebushidocollective/objc-protocols-categories

View the source on GitHub

Browse the @skills marketplace