iOS Naming Conventions Checker
Validate Swift code naming against Payoo Merchant project standards for clarity and consistency.
When to Activate
- "check naming", "naming conventions", "code readability"
- "abbreviations", "variable names", "rename"
- Reviewing code quality or consistency
- Onboarding new developers
Naming Rules Summary
Types (Classes, Structs, Enums, Protocols)
- PascalCase:
PaymentViewModel, TransactionRepository
- Descriptive: Purpose immediately clear
- Proper suffixes: ViewModel, ViewController, UseCase, Repository
Variables & Properties
- camelCase:
paymentAmount, isProcessing
- Meaningful: No abbreviations (except URL, ID, VC, UC)
- Booleans: Prefix
is, has, should, can
- Collections: Plural names (
transactions, stores)
Functions & Methods
- camelCase with verb prefix
- Actions:
loadTransactions(), processPayment()
- Queries:
getTransaction(), hasPermission()
IBOutlets
- Type suffix:
amountTextField, confirmButton, tableView
Review Process
Step 1: Scan Code
Read files and identify all declarations:
- Class/struct/enum/protocol declarations
- Variable and property declarations
- Function declarations
- IBOutlet declarations
Step 2: Check Against Rules
For each identifier, verify:
Classes/Types:
- ✅ PascalCase
- ✅ Descriptive (not generic like "Manager")
- ✅ No abbreviations (except standard ones)
- ✅ Proper suffix (ViewModel, UseCase, etc.)
Variables:
- ✅ camelCase
- ✅ Meaningful names
- ✅ Boolean prefixes (is/has/should/can)
- ✅ Plural for collections
- ✅ No single letters (except loop indices)
Functions:
- ✅ Verb-based names
- ✅ Clear action or query intent
- ✅ No generic names (doSomething, handle)
IBOutlets:
Step 3: Generate Report
# Naming Conventions Review
## Summary
- 🔴 Critical (meaningless): X
- 🟠 High (abbreviations): X
- 🟡 Medium (missing prefixes): X
- 🟢 Low (style): X
## Issues by Type
### Classes/Structs/Enums
**File**: `path/to/file.swift:line`
Current: `PayVC`
Should be: `PaymentViewController`
Reason: [Explanation]
### Variables/Properties
[List with specific fixes]
### Functions
[List with specific fixes]
### IBOutlets
[List with specific fixes]
## Batch Rename Suggestions
Found `amt` in 5 locations → Rename all to `paymentAmount`
## Good Examples Found ✅
[Acknowledge well-named elements]
Common Violations
❌ Abbreviations
class PayVC { } → PaymentViewController
let amt: Double → paymentAmount
func procPmt() { } → processPayment()
❌ Single Letters
let x = transaction → currentTransaction
let a = amount → paymentAmount
❌ Generic/Meaningless
class Manager { } → PaymentManager
func doSomething() { } → processRefundRequest()
func handle() { } → handlePaymentError()
❌ Missing Prefixes
let loading: Bool → isLoading: Bool
let valid: Bool → isValid: Bool
❌ Missing Type Suffix
@IBOutlet weak var amount: UITextField! → amountTextField
@IBOutlet weak var btn: UIButton! → confirmButton
Search Patterns
Use Grep to find:
- Abbreviations:
(let|var)\s+[a-z]{1,3}\s*[=:]
- IBOutlets:
@IBOutlet.*weak var
- Booleans:
(let|var)\s+[a-z]+.*:\s*Bool
Output Guidelines
For each violation:
- File path and line number
- Current name
- Recommended name
- Reason for change
- Impact on code clarity
Prioritize:
- Critical: Meaningless names (hurts maintainability)
- High: Abbreviations (reduces clarity)
- Medium: Missing prefixes/suffixes
- Low: Style inconsistencies
Quick Fixes
- Expand Abbreviation: Use Xcode refactor tool
- Add Boolean Prefix: Rename with is/has/should/can
- Add Type Suffix: Update IBOutlet names
Common Abbreviations to Fix
| ❌ Bad |
✅ Good |
| amt |
paymentAmount |
| trx, tx |
transaction |
| btn |
button |
| lbl |
label |
| vc |
viewController |
| uc |
useCase |
| repo |
repository |
Reference
Detailed Examples: See examples.md for extensive naming patterns and scenarios.
1---2name: ios-naming-conventions3description: Check Swift naming conventions for iOS code. Validates class names, variables, functions, and IBOutlets against project standards. Use when reviewing code readability, checking abbreviations, or enforcing naming consistency in Swift files.4---5
6# iOS Naming Conventions Checker
7
8Validate Swift code naming against Payoo Merchant project standards for clarity and consistency.
9
10## When to Activate
11
12- "check naming", "naming conventions", "code readability"
13- "abbreviations", "variable names", "rename"
14- Reviewing code quality or consistency
15- Onboarding new developers
16
17## Naming Rules Summary
18
19### Types (Classes, Structs, Enums, Protocols)
20- **PascalCase**: `PaymentViewModel`, `TransactionRepository`
21- **Descriptive**: Purpose immediately clear
22- **Proper suffixes**: ViewModel, ViewController, UseCase, Repository
23
24### Variables & Properties
25- **camelCase**: `paymentAmount`, `isProcessing`
26- **Meaningful**: No abbreviations (except URL, ID, VC, UC)
27- **Booleans**: Prefix `is`, `has`, `should`, `can`
28- **Collections**: Plural names (`transactions`, `stores`)
29
30### Functions & Methods
31- **camelCase** with verb prefix
32- **Actions**: `loadTransactions()`, `processPayment()`
33- **Queries**: `getTransaction()`, `hasPermission()`
34
35### IBOutlets
36- **Type suffix**: `amountTextField`, `confirmButton`, `tableView`
37
38## Review Process
39
40### Step 1: Scan Code
41
42Read files and identify all declarations:
43- Class/struct/enum/protocol declarations
44- Variable and property declarations
45- Function declarations
46- IBOutlet declarations
47
48### Step 2: Check Against Rules
49
50For each identifier, verify:
51
52**Classes/Types**:
53- ✅ PascalCase
54- ✅ Descriptive (not generic like "Manager")
55- ✅ No abbreviations (except standard ones)
56- ✅ Proper suffix (ViewModel, UseCase, etc.)
57
58**Variables**:
59- ✅ camelCase
60- ✅ Meaningful names
61- ✅ Boolean prefixes (is/has/should/can)
62- ✅ Plural for collections
63- ✅ No single letters (except loop indices)
64
65**Functions**:
66- ✅ Verb-based names
67- ✅ Clear action or query intent
68- ✅ No generic names (doSomething, handle)
69
70**IBOutlets**:
71- ✅ Type suffix included
72
73### Step 3: Generate Report
74
75```markdown
76# Naming Conventions Review
77
78## Summary
79- 🔴 Critical (meaningless): X
80- 🟠 High (abbreviations): X
81- 🟡 Medium (missing prefixes): X
82- 🟢 Low (style): X
83
84## Issues by Type
85
86### Classes/Structs/Enums
87**File**: `path/to/file.swift:line`
88Current: `PayVC`
89Should be: `PaymentViewController`
90Reason: [Explanation]
91
92### Variables/Properties
93[List with specific fixes]
94
95### Functions
96[List with specific fixes]
97
98### IBOutlets
99[List with specific fixes]
100
101## Batch Rename Suggestions
102Found `amt` in 5 locations → Rename all to `paymentAmount`
103
104## Good Examples Found ✅
105[Acknowledge well-named elements]
106```
107
108## Common Violations
109
110### ❌ Abbreviations
111```swift
112class PayVC { } → PaymentViewController
113let amt: Double → paymentAmount
114func procPmt() { } → processPayment()
115```
116
117### ❌ Single Letters
118```swift
119let x = transaction → currentTransaction
120let a = amount → paymentAmount
121```
122
123### ❌ Generic/Meaningless
124```swift
125class Manager { } → PaymentManager
126func doSomething() { } → processRefundRequest()
127func handle() { } → handlePaymentError()
128```
129
130### ❌ Missing Prefixes
131```swift
132let loading: Bool → isLoading: Bool
133let valid: Bool → isValid: Bool
134```
135
136### ❌ Missing Type Suffix
137```swift
138@IBOutlet weak var amount: UITextField! → amountTextField
139@IBOutlet weak var btn: UIButton! → confirmButton
140```
141
142## Search Patterns
143
144Use Grep to find:
145- **Abbreviations**: `(let|var)\s+[a-z]{1,3}\s*[=:]`
146- **IBOutlets**: `@IBOutlet.*weak var`
147- **Booleans**: `(let|var)\s+[a-z]+.*:\s*Bool`
148
149## Output Guidelines
150
151**For each violation**:
1521. File path and line number
1532. Current name
1543. Recommended name
1554. Reason for change
1565. Impact on code clarity
157
158**Prioritize**:
159- Critical: Meaningless names (hurts maintainability)
160- High: Abbreviations (reduces clarity)
161- Medium: Missing prefixes/suffixes
162- Low: Style inconsistencies
163
164## Quick Fixes
165
1661. **Expand Abbreviation**: Use Xcode refactor tool
1672. **Add Boolean Prefix**: Rename with is/has/should/can
1683. **Add Type Suffix**: Update IBOutlet names
169
170## Common Abbreviations to Fix
171
172| ❌ Bad | ✅ Good |
173|--------|---------|
174| amt | paymentAmount |
175| trx, tx | transaction |
176| btn | button |
177| lbl | label |
178| vc | viewController |
179| uc | useCase |
180| repo | repository |
181
182## Reference
183
184**Detailed Examples**: See `examples.md` for extensive naming patterns and scenarios.