objective-c
Skill15 starsChanged 9 months agoMITView on GitHub
Google's official Objective-C style guide. Covers naming conventions, formatting, memory management, properties, protocols, categories, and Objective-C best practices.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- G1Joshi/Agent-Skillstheir own version, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- G1Joshi/Agent-Skills★ 15same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository17 other files it gives its agents.
- angularjsSkill
- common-lispSkill
- cppSkill
- csharpSkill
- goSkill
- html-cssSkill
- javascriptSkill
- javaSkill
- jsonSkill
- markdownSkill
- pythonSkill
- rSkill
- shellSkill
- google-styleguides-skillsSkill
- swiftSkill
- typescriptSkill
- vim-scriptSkill
The file
Files
Google Objective-C Style Guide
Official Google Objective-C coding standards for consistent iOS/macOS code.
Golden Rules
- Use ARC — Automatic Reference Counting (no manual retain/release)
- Descriptive naming — clarity over brevity; method names read like sentences
- Prefix class names — avoid namespace collisions (2-3 letter prefix)
- Use properties — prefer
@propertyover direct instance variables - Nullability annotations — mark
nullable/nonnullon APIs - Use modern Objective-C — literals, subscripting, generics
- Follow Apple conventions — consistency with Cocoa frameworks
Quick Reference
Naming Conventions
| Element | Convention | Example |
| Classes | PrefixUpperCamelCase | GTMUserService |
| Protocols | PrefixUpperCamelCase | GTMUserServiceDelegate |
| Methods | lowerCamelCase | - (void)getUserById:(NSInteger)userId |
| Properties | lowerCamelCase | userCount, firstName |
| Local variables | lowerCamelCase | localUser |
| Constants | kPrefixUpperCamelCase | kGTMMaxRetries |
| Enums | PrefixUpperCamelCase | GTMDirection |
| Enum values | PrefixUpperCamelCase | GTMDirectionNorth |
Class Interface
// ✓ CORRECT - class interface with nullability and generics
@interface GTMUserService : NSObject
@property(nonatomic, readonly) NSInteger userCount;
@property(nonatomic, copy, nullable) NSString *currentUserName;
- (nullable GTMUser *)userWithId:(NSInteger)userId;
- (void)fetchUsersWithCompletion:(void (^)(NSArray<GTMUser *> *_Nullable users,
NSError *_Nullable error))completion;
@endProperties
// ✓ CORRECT - property declarations
@property(nonatomic, strong) NSMutableArray<GTMUser *> *users;
@property(nonatomic, copy) NSString *title;
@property(nonatomic, assign) BOOL isLoading;
@property(nonatomic, weak) id<GTMUserDelegate> delegate;
@property(nonatomic, readonly) NSInteger count;
// Attribute order: nonatomic/atomic, memory (strong/weak/copy/assign),
// then access (readonly/readwrite)Methods
// ✓ CORRECT - descriptive method names (reads like a sentence)
- (nullable GTMUser *)userWithFirstName:(NSString *)firstName
lastName:(NSString *)lastName;
// ✓ CORRECT - instance method
- (void)setUser:(GTMUser *)user forKey:(NSString *)key;
// ✓ CORRECT - class method (factory)
+ (instancetype)serviceWithBaseURL:(NSURL *)baseURL;
// ✗ INCORRECT - too abbreviated
- (GTMUser *)usr:(NSString *)fn ln:(NSString *)ln;Modern Objective-C Literals
// ✓ CORRECT - use modern literals
NSArray *colors = @[@"red", @"green", @"blue"];
NSDictionary *config = @{@"host": @"localhost", @"port": @8080};
NSNumber *count = @42;
NSNumber *enabled = @YES;
// ✓ CORRECT - subscripting
NSString *first = colors[0];
NSString *host = config[@"host"];
// ✗ INCORRECT - old style
NSArray *colors = [NSArray arrayWithObjects:@"red", @"green", nil];Protocols and Delegates
// ✓ CORRECT - optional and required protocol methods
@protocol GTMUserServiceDelegate <NSObject>
@required
- (void)userService:(GTMUserService *)service
didLoadUser:(GTMUser *)user;
@optional
- (void)userService:(GTMUserService *)service
didFailWithError:(NSError *)error;
@endMemory Management with ARC
// ✓ CORRECT - ARC handles retain/release
@implementation GTMUserService {
NSMutableArray<GTMUser *> *_users; // strong by default
}
- (instancetype)init {
self = [super init];
if (self) {
_users = [[NSMutableArray alloc] init];
}
return self;
}
@end
// ✓ CORRECT - weak references to avoid cycles
__weak typeof(self) weakSelf = self;
[self fetchData:^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) return;
[strongSelf processResults];
}];Nullability Annotations
// ✓ CORRECT - annotate all APIs
NS_ASSUME_NONNULL_BEGIN
@interface GTMUser : NSObject
@property(nonatomic, copy) NSString *name;
@property(nonatomic, copy, nullable) NSString *email;
- (nullable GTMUser *)userWithId:(NSInteger)userId;
@end
NS_ASSUME_NONNULL_ENDCommon Mistakes
| Mistake | Correct Approach |
| Short/abbreviated names | Use descriptive, sentence-like names |
| No class prefix | Use 2-3 letter prefix to avoid collisions |
| Direct ivar access | Use @property and synthesized accessors |
| Missing nullability annotations | Use NS_ASSUME_NONNULL_BEGIN/END |
| Manual retain/release | Use ARC |
| Old collection syntax | Use modern literals @[], @{} |
| Strong delegate references | Use weak for delegates |
When to Use This Guide
- Writing new Objective-C code
- Maintaining legacy Objective-C iOS/macOS apps
- Code reviews
- Onboarding new team members
Install
npx skills add testdino-hq/google-styleguides-skills/objective-cFull Guide
See objective-c.md for complete details, examples, and edge cases.
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
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.

