Skip to content

kvn8888/OpenFoodJournal / .claude/skills/openfoodjournal

openfoodjournal

Verified

Living project knowledge for OpenFoodJournal — an iOS 26 food journaling app with AI-powered nutrition scanning. Consult this skill FIRST when starting any work on this project. Contains architecture decisions, data models, service contracts, current state, known issues, and conventions. Update this skill whenever requirements, architecture, or project state changes so it stays accurate across sessions.

FileKindSize
SKILL.mdskill md29.8 KB
references/models.mdmarkdown2.5 KB
references/services.mdmarkdown2.7 KB
references/views.mdmarkdown3.5 KB

references/models.md

View on GitHub
# Data Models Reference

## DailyLog (`OpenFoodJournal/Models/DailyLog.swift`)

```swift
@Model final class DailyLog {
    @Attribute(.unique) var date: Date  // normalized to midnight
    var id: UUID
    var notes: String?
    @Relationship(deleteRule: .cascade, inverse: \NutritionEntry.dailyLog)
    var entries: [NutritionEntry]
    
    // Computed (not persisted)
    var totalCalories: Double
    var totalProtein: Double
    var totalCarbs: Double
    var totalFat: Double
    func entries(for mealType: MealType) -> [NutritionEntry]  // filtered & sorted by timestamp
}
```

## NutritionEntry (`OpenFoodJournal/Models/NutritionEntry.swift`)

```swift
@Model final class NutritionEntry {
    var id: UUID
    var timestamp: Date
    var name: String
    var mealType: MealType
    var scanMode: ScanMode
    var confidence: Double?
    @Attribute(.externalStorage) var sourceImage: Data?
    
    // Core macros (always required)
    var calories, protein, carbs, fat: Double
    
    // Extended macros (optional, mainly from label scans)
    var fiber, sugar, sodium, cholesterol, saturatedFat, transFat: Double?
    var servingSize: String?
    var servingsPerContainer: Double?
    
    var dailyLog: DailyLog?  // inverse
    var confidencePercent: Int?  // computed: confidence * 100
}
```

## UserGoals (`OpenFoodJournal/Models/UserGoals.swift`)

```swift
@Observable @MainActor final class UserGoals {
    @ObservationIgnored @AppStorage("goals.calories") var dailyCalories: Double = 2000
    @ObservationIgnored @AppStorage("goals.protein") var dailyProtein: Double = 150
    @ObservationIgnored @AppStorage("goals.carbs") var dailyCarbs: Double = 200
    @ObservationIgnored @AppStorage("goals.fat") var dailyFat: Double = 65
}
```

## Enums (`OpenFoodJournal/Models/Enums.swift`)

| Enum | Cases | Protocols |
|------|-------|-----------|
| `MealType` | `.breakfast`, `.lunch`, `.dinner`, `.snack` | `String, Codable, CaseIterable, Identifiable` |
| `ScanMode` | `.label`, `.foodPhoto`, `.manual` | `String, Codable, CaseIterable` |

`MealType.systemImage` returns SF Symbol names: sunrise, sun.max, moon.stars, leaf.
`ScanMode.isEstimate` returns `true` only for `.foodPhoto`.

## MockData (`OpenFoodJournal/Models/MockData.swift`)

- `ModelContainer.preview` — in-memory container with seeded data
- `NutritionEntry.samples` — 5 sample entries across meal types
- `NutritionEntry.preview` — first sample
- `DailyLog.preview` — single day with all samples
- `DailyLog.weekSamples` — 7 days with randomized calorie multipliers
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 323kUpdated Claude CodeCodexVerifiedInstall