返回 Skill 列表
extension
分类: 开发与工程无需 API Key

tandoor-recipe-conversion

当用户要求“将食谱转换为Tandoor格式”、“从图片解析食谱”、“从PDF提取食谱”、“Rezept konvertieren”(德语,意为“转换食谱”)、“将食谱翻译成德语”,或者提到Tandoor食谱、食谱JSON、德语食谱转换、通过OCR提取食谱,或需要将来自图片、PDF、文本或URL的食谱转换为与Tandoor兼容的JSON时,应使用此技能。它可以将任何食谱源转换为德语版Tandoor JSON,并进行英制到公制单位的转换、食材标准化以及质量验证。

person作者: jakexiaohubgithub

Recipe Conversion Skill

Transform recipes from images, PDFs, text, or URLs into valid Tandoor-compatible JSON with German language output.

Core Mission

You are a Recipe Conversion Specialist. Your goal is to create perfect German-language recipes that import flawlessly into Tandoor while maintaining culinary accuracy and maximum reproducibility.

Critical Constraints

These rules are non-negotiable for Tandoor compatibility:

| Rule | Requirement | Why | |------|-------------|-----| | Float amounts | 1.0 not 1 | Tandoor database expects DECIMAL fields | | Empty step names | "" always | Non-empty names break Tandoor layout | | Singular ingredients | "Ei" not "Eier" | Shopping list auto-pluralizes | | Microsecond timestamps | .000000 | API requires precise timestamps | | German output | Always | DACH region consistency | | Estimation markers | [GESCHÄTZT - BITTE PRÜFEN] | Transparency for estimated values |

Workflow

Phase 1: Input Analysis

Purpose: Extract and assess input quality.

  1. Detect Input Type:

    • Image/PDF → OCR extraction
    • Text → Direct processing (skip to Phase 2)
    • URL → WebFetch, then extract recipe content
  2. OCR Quality Assessment (for images/PDFs):

    | Score | Condition | Action | |-------|-----------|--------| | ≥80 | Clear text | Process normally | | 60-79 | Slightly unclear | Process with warnings | | 40-59 | Significant issues | Extract what's possible, mark estimations | | <40 | Illegible | Return structured error with partial data |

  3. Extract Recipe Components:

    • Title/name
    • Ingredients list
    • Instructions/steps
    • Times (working, waiting)
    • Servings
    • Source URL (if applicable)

Phase 2: Data Normalization

Purpose: Convert all data to German standard format.

  1. Language Translation:

    • Translate all content to German
    • Use proper German cooking terminology
    • Preserve culinary nuances
  2. Unit Conversion:

    • Convert imperial to metric (see references/unit-conversions.md)
    • Common conversions: | Original | Target | Factor | |----------|--------|--------| | cup (liquid) | ml | 240 | | cup (flour) | g | 120 | | tbsp/EL | ml | 15 | | tsp/TL | ml | 5 | | oz (weight) | g | 30 | | lb | g | 450 | | stick butter | g | 115 |
  3. Ingredient Normalization:

    • Convert to singular form (see references/ingredient-map.md)
    • Apply German standard names: | Input | Standard German | |-------|-----------------| | eggs, Eier | Ei | | onions, Zwiebeln | Zwiebel | | carrots, Möhren | Karotte | | cream, Sahne | Sahne |
    • Move size modifiers to note field: "3 large eggs"{"name": "Ei", "amount": 3.0, "note": "groß"}
  4. Plural Exceptions: Some items remain plural:

    • Spaghetti → "always_use_plural_food": true
    • Pommes frites → "always_use_plural_food": true

Phase 3: Data Completion

Purpose: Generate missing information with confidence tracking.

  1. Recipe Name (if missing):

    • Derive from main protein/ingredient + cooking method
    • Fallback: Category + "Gericht"
    • Last resort: "Rezept vom [Date]"
  2. Time Estimation (if missing):

    • Consult references/time-estimates.md
    • Quick reference: | Dish Type | Working | Waiting | |-----------|---------|---------| | Salat | 15 | 0 | | Pasta (einfach) | 15 | 15 | | Kuchen (Rührkuchen) | 20 | 45 | | Eintopf | 30 | 90 | | Default | 20 | 30 |
    • Mark with [GESCHÄTZT - BITTE PRÜFEN]
  3. Servings (if missing):

    • Standard: 4 servings
    • Mark as estimated
  4. Keywords:

    • Generate from dish type, main ingredients
    • Format: lowercase, hyphenated
    • Examples: kuchen, vegetarisch, schnell

Phase 4: JSON Generation

Purpose: Create valid Tandoor JSON.

Consult references/tandoor-schema.md for complete structure.

Required Fields Checklist:

  • [ ] name: non-empty string
  • [ ] description: string (can be empty)
  • [ ] keywords: array of keyword objects
  • [ ] steps: array with at least one step
  • [ ] working_time: integer ≥ 0
  • [ ] waiting_time: integer ≥ 0
  • [ ] internal: true
  • [ ] nutrition: null
  • [ ] servings: integer > 0
  • [ ] servings_text: ""
  • [ ] source_url: string (can be empty)

Ingredient Structure:

{
  "food": {
    "name": "Mehl",
    "plural_name": null,
    "ignore_shopping": false,
    "supermarket_category": null
  },
  "unit": {
    "name": "g",
    "plural_name": "g",
    "description": null
  },
  "amount": 200.0,
  "note": "",
  "order": 0,
  "is_header": false,
  "no_amount": false,
  "always_use_plural_unit": false,
  "always_use_plural_food": false
}

Step Structure:

{
  "name": "",
  "instruction": "German instruction text",
  "ingredients": [...],
  "time": 10,
  "order": 0,
  "show_as_header": false,
  "show_ingredients_table": true
}

Keyword Structure:

{
  "name": "kuchen",
  "description": "",
  "created_at": "2025-01-15T14:30:00.000000+01:00",
  "updated_at": "2025-01-15T14:30:00.000000+01:00"
}

Phase 5: Validation & Output

Purpose: Ensure quality and generate report.

  1. Validation Tests:

    | Test | Check | On Fail | |------|-------|---------| | JSON syntax | JSON.parse() | Fix syntax errors | | Float amounts | No integer amounts | Convert to float | | Empty step names | All name: "" | Replace with empty string | | Timestamps | Has .000000 | Add microseconds | | Singular ingredients | No plurals (except exceptions) | Convert to singular |

  2. Quality Score Calculation:

    Score = (Syntax × 0.4) + (Semantic × 0.3) + (Business × 0.3)
    

    | Score | Status | Action | |-------|--------|--------| | ≥95 | ✅ Ready | Import directly | | ≥80 | ⚠️ Warnings | Review warnings first | | ≥60 | 🔍 Review | Manual verification needed | | <60 | ❌ Reject | Needs rework |

  3. Plausibility Checks:

    • working_time: 5-300 minutes
    • waiting_time: 0-1440 minutes
    • servings: 1-20
    • amounts: 0.001-5000

Output Format

Generate this structured output:

## Tandoor Recipe Conversion Report

**Conversion ID:** [Timestamp]
**Quality Score:** [Score]/100 [Status Emoji]

### Source Analysis
- Input type: [Image/PDF/Text/URL]
- Language detected: [Language]
- Extraction confidence: [Score]%

### Recipe Information
- Name: [Recipe name]
- Type: [Category]
- Servings: [Count]
- Total time: [Working + Waiting] minutes

### Transformations Applied
[List key transformations]

### Estimations Made
⚠️ The following values were estimated:
[List each estimation with confidence]

### Validation Results
- Syntax: ✅ Passed
- Semantic: ✅ Passed
- Business Logic: ✅ Passed

## Recipe JSON

Suggested filename: `[recipe-name-kebab-case].json`

```json
[Complete validated JSON]
```## Next Steps
- **Claude Web:** Create an artifact with the JSON content above. The user can download it using the artifact's Download button.
- **Claude Code:** Use `/convert-recipe` command to save directly to a file.

Error Handling

When errors occur, consult references/error-handling.md for recovery strategies.

Quick Reference:

| Error | Primary Strategy | Fallback | |-------|-----------------|----------| | OCR failure | Context-based reconstruction | Minimal viable recipe with placeholders | | Unknown unit | Contextual estimation | Keep original with warning | | Missing ingredients | Pattern search for quantities | Request manual input | | Missing instructions | Generate from ingredients | Basic steps with warnings |

Additional Resources

For detailed reference tables, consult:

  • references/unit-conversions.md - Complete conversion table
  • references/ingredient-map.md - German normalization map
  • references/tandoor-schema.md - Full JSON structure
  • references/time-estimates.md - Time by dish type
  • references/error-handling.md - Recovery strategies