# Recipe Manager — Agent Instructions **Purpose:** How agents should approach development on this project **Last Updated:** 2026-03-23 --- ## Core Principles ### 1. Orientation First Every time you wake up (new session): 1. Read `PROJECT.md` — What are we building? 2. Read `ARCHITECTURE.md` — How are we building it? 3. Read `ROADMAP.md` — What's next? 4. Read `git log --oneline -10` — What happened recently? 5. Check `TODO.md` (if exists) — Any pending tasks? **Never start coding without context.** --- ## Development Loop ### The Agent Workflow (Single Iteration) ``` ┌─────────────────────────────────────────────────┐ │ 1. ORIENT Read context files, git log │ └────────────┬────────────────────────────────────┘ │ ┌────────────┴────────────────────────────────────┐ │ 2. PLAN Pick ONE task from roadmap │ │ Break into <1hr subtasks if needed │ └────────────┬────────────────────────────────────┘ │ ┌────────────┴────────────────────────────────────┐ │ 3. IMPLEMENT Write code + tests │ │ Follow architecture patterns │ └────────────┬────────────────────────────────────┘ │ ┌────────────┴────────────────────────────────────┐ │ 4. VERIFY Run tests, lint, manual check │ │ Does it meet acceptance criteria? │ └────────────┬────────────────────────────────────┘ │ ┌────────────┴────────────────────────────────────┐ │ 5. COMMIT Conventional commit message │ │ Update docs (README, ADR, etc.) │ └────────────┬────────────────────────────────────┘ │ ┌────────────┴────────────────────────────────────┐ │ 6. REPORT Summarize what you did + what's │ │ next (or escalate if blocked) │ └─────────────────────────────────────────────────┘ ``` **One loop = one commit.** Don't try to do everything at once. --- ## Task Selection Rules ### What to Work On 1. **Check ROADMAP.md** for the current milestone 2. **Pick the next uncompleted feature** in that milestone 3. **If all features done,** move to testing/documentation 4. **If milestone complete,** report to Paul for approval before moving to next ### How to Break Down Tasks **Good task (1-4 hours):** - "Implement recipe list API endpoint with pagination" - "Add tag filtering to search UI" - "Write E2E test for cook mode" **Bad task (too big):** - "Build entire recipe import system" - "Finish frontend" **If task feels big (>4 hours),** break it into subtasks and commit each one. --- ## Code Quality Standards ### TypeScript - ✅ Strict mode enabled - ✅ No `any` types (use `unknown` if needed) - ✅ All public APIs have JSDoc comments - ✅ Interfaces for all data models ### Testing - ✅ Unit test new business logic (services, utilities) - ✅ Integration test API endpoints - ✅ E2E test critical user flows (cook mode, search) - ✅ Aim for >80% coverage on core logic ### Commits - ✅ Conventional Commits format: `type(scope): description` - `feat:` new feature - `fix:` bug fix - `docs:` documentation only - `test:` test additions/changes - `refactor:` code restructure (no behavior change) - `chore:` tooling, dependencies - ✅ Descriptive messages (not "fix stuff" or "wip") - ✅ Commit working code only (tests pass) ### Documentation - ✅ Update README when setup changes - ✅ Add ADR (Architecture Decision Record) in `docs/` for significant choices - Format: `ADR-001-why-sqlite.md`, `ADR-002-recipe-scraping-strategy.md` - ✅ Update API docs when endpoints change - ✅ Keep TODO.md current (add new tasks, remove completed) --- ## Common Patterns ### API Endpoint Template ```typescript // src/routes/recipes.ts import { Router } from 'express'; import { z } from 'zod'; import { RecipeService } from '../services/RecipeService'; const router = Router(); const recipeService = new RecipeService(); // Validation schema const createRecipeSchema = z.object({ title: z.string().min(1), ingredients: z.array(z.string()), instructions: z.array(z.string()), // ... }); router.post('/recipes', async (req, res) => { try { const data = createRecipeSchema.parse(req.body); const recipe = await recipeService.create(data); res.json({ success: true, data: recipe }); } catch (error) { if (error instanceof z.ZodError) { res.status(400).json({ success: false, error: error.errors }); } else { res.status(500).json({ success: false, error: 'Internal error' }); } } }); export default router; ``` ### React Component Template ```typescript // src/components/RecipeCard.tsx import { Recipe } from '../types/recipe'; interface RecipeCardProps { recipe: Recipe; onEdit: (id: number) => void; onDelete: (id: number) => void; } export function RecipeCard({ recipe, onEdit, onDelete }: RecipeCardProps) { return (
{recipe.description}
{/* ... */}