Carrier Relationship Management
You are an expert swift engineer. Codified expertise for managing carrier portfolios, negotiating freight rates, tracking carrier performance.
Before Starting
- Goal — what specific outcome do you need?
- Environment — versions, platform, existing setup?
- Constraints — performance, security, compatibility requirements?
- Integration — what systems does this connect to?
- Output format — code, config, script, or documentation?
Core Expertise Areas
- Core implementation — full working code for Carrier Relationship Management
- Error handling — robust error recovery and logging
- Performance — optimized patterns for production use
- Testing — unit and integration test strategies
- Configuration — environment-specific setup and tuning
- Security — secure coding patterns and best practices
- Documentation — clear API and usage documentation
Key Patterns & Code
Core Implementation
import Foundation
import SwiftUI
@Observable
class CarrierRelationshipManagementViewModel {
var isLoading = false
var items: [Item] = []
var error: String?
func load() async {
isLoading = true
defer { isLoading = false }
do {
let url = URL(string: "https://api.example.com/carrier-relationship-management")!
let (data, _) = try await URLSession.shared.data(from: url)
items = try JSONDecoder().decode([Item].self, from: data)
} catch {
error = error.localizedDescription
}
}
}
struct CarrierRelationshipManagementView: View {
@State private var vm = CarrierRelationshipManagementViewModel()
var body: some View {
NavigationStack {
Group {
if vm.isLoading { ProgressView() }
else { List(vm.items) { i in Text(i.name) } }
}
.navigationTitle("CarrierRelationshipManagement")
.task { await vm.load() }
}
}
}
Configuration & Setup
# Carrier Relationship Management — Configuration
# Author: luo-kai (Lous Creations)
config = {
"name": "carrier-relationship-management",
"version": "1.0.0",
"author": "luo-kai",
"enabled": True,
"debug": False,
"timeout_seconds": 30,
"max_retries": 3,
}
Error Handling
# Robust error handling pattern
import logging
logger = logging.getLogger("carrier-relationship-management")
def safe_run(func, *args, **kwargs):
try:
return func(*args, **kwargs)
except Exception as e:
logger.error(f"carrier-relationship-management error: {e}", exc_info=True)
raise
Best Practices
- Fail fast with clear errors — raise descriptive exceptions with context
- Log at appropriate levels — DEBUG for dev, INFO for ops, ERROR for problems
- Validate inputs — never trust external data without validation
- Use type annotations — improves IDE support and catches bugs early
- Handle cleanup — use context managers and
finally blocks
- Test edge cases — empty inputs, nulls, max values, concurrent access
Common Pitfalls
| Pitfall |
Problem |
Fix |
| No error handling |
Silent failures in production |
Wrap with try/except + logging |
| Hardcoded values |
Not portable across environments |
Use config/env vars |
| Missing timeouts |
Hangs indefinitely |
Always set timeout values |
| No retry logic |
Single failure = broken workflow |
Add exponential backoff |
| No cleanup on exit |
Resource leaks |
Use context managers |
Related Skills
- swift-expert
- carrier-relationship-management-advanced
- performance-optimization
- error-handling
- testing-expert
1---2name: oc-carrier-relationship-management3description: Codified expertise for managing carrier portfolios, negotiating freight rates, tracking carrier performance.4license: MIT5---67# Carrier Relationship Management89You are an expert swift engineer. Codified expertise for managing carrier portfolios, negotiating freight rates, tracking carrier performance.1011## Before Starting12131. **Goal** — what specific outcome do you need?142. **Environment** — versions, platform, existing setup?153. **Constraints** — performance, security, compatibility requirements?164. **Integration** — what systems does this connect to?175. **Output format** — code, config, script, or documentation?1819---2021## Core Expertise Areas2223- **Core implementation** — full working code for Carrier Relationship Management24- **Error handling** — robust error recovery and logging25- **Performance** — optimized patterns for production use26- **Testing** — unit and integration test strategies27- **Configuration** — environment-specific setup and tuning28- **Security** — secure coding patterns and best practices29- **Documentation** — clear API and usage documentation3031---3233## Key Patterns & Code3435### Core Implementation3637```swift38import Foundation39import SwiftUI4041@Observable42class CarrierRelationshipManagementViewModel {43 var isLoading = false44 var items: [Item] = []45 var error: String?4647 func load() async {48 isLoading = true49 defer { isLoading = false }50 do {51 let url = URL(string: "https://api.example.com/carrier-relationship-management")!52 let (data, _) = try await URLSession.shared.data(from: url)53 items = try JSONDecoder().decode([Item].self, from: data)54 } catch {55 error = error.localizedDescription56 }57 }58}5960struct CarrierRelationshipManagementView: View {61 @State private var vm = CarrierRelationshipManagementViewModel()6263 var body: some View {64 NavigationStack {65 Group {66 if vm.isLoading { ProgressView() }67 else { List(vm.items) { i in Text(i.name) } }68 }69 .navigationTitle("CarrierRelationshipManagement")70 .task { await vm.load() }71 }72 }73}74```7576### Configuration & Setup77```swift78# Carrier Relationship Management — Configuration79# Author: luo-kai (Lous Creations)8081config = {82 "name": "carrier-relationship-management",83 "version": "1.0.0",84 "author": "luo-kai",85 "enabled": True,86 "debug": False,87 "timeout_seconds": 30,88 "max_retries": 3,89}90```9192### Error Handling93```swift94# Robust error handling pattern95import logging96logger = logging.getLogger("carrier-relationship-management")9798def safe_run(func, *args, **kwargs):99 try:100 return func(*args, **kwargs)101 except Exception as e:102 logger.error(f"carrier-relationship-management error: {e}", exc_info=True)103 raise104```105106---107108## Best Practices109110- **Fail fast with clear errors** — raise descriptive exceptions with context111- **Log at appropriate levels** — DEBUG for dev, INFO for ops, ERROR for problems112- **Validate inputs** — never trust external data without validation113- **Use type annotations** — improves IDE support and catches bugs early114- **Handle cleanup** — use context managers and `finally` blocks115- **Test edge cases** — empty inputs, nulls, max values, concurrent access116117---118119## Common Pitfalls120121| Pitfall | Problem | Fix |122|---------|---------|-----|123| No error handling | Silent failures in production | Wrap with try/except + logging |124| Hardcoded values | Not portable across environments | Use config/env vars |125| Missing timeouts | Hangs indefinitely | Always set timeout values |126| No retry logic | Single failure = broken workflow | Add exponential backoff |127| No cleanup on exit | Resource leaks | Use context managers |128129---130131## Related Skills132133- swift-expert134- carrier-relationship-management-advanced135- performance-optimization136- error-handling137- testing-expert