Tickd.ai
← The Tickd Guide

Inspiration

How to Build a Procedural Lost-Recipe Generator for Fictional Civilisations Using Claude and Python

Ditch the boring fantasy mead. Learn how to use Python and Claude to build an anthropological recipe engine that generates culturally grounded, bizarre culinary dishes for fictional worldbuilding.

Updated 10/5/2026

Beyond "Roast Boar": Why Fictional Food Matters

If you have ever read a fantasy novel or played a role-playing game, you have likely run into the classic culinary clichés. Characters walk into a tavern and inevitably order "roast boar and a flaggon of ale." It is functional, but it is culturally hollow. Food is one of the most expressive aspects of human (or non-human) culture. It tells us about a society's geography, their technological level, their class structures, their religious taboos, and how they preserve resources.

Instead of manually inventing culinary history for your world-building projects, you can build an automated, procedural culinary archaeology engine.

By combining a lightweight Python script with Claude, we can build an engine that doesn't just invent random ingredients, but dynamically constructs a cohesive cultural ecosystem first, then derives a logical, fascinating, and sometimes stomach-turning recipe from it.

The Architecture of Culinary Anthropology

To make this engine authentic, we cannot simply ask an LLM to "write a weird recipe." If we do, we will get generic results like "Dragon Wing Soup with stardust."

Instead, we will use Python to procedurally generate a set of environmental and cultural constraints—using a series of randomised variables—and pass those constraints to the model. This forces the LLM to work within a logical, simulated world. We will use a structured JSON schema to ensure the output remains perfectly formatted for use in a game, database, or digital wiki.

To understand more about handling structured data outputs with generative models, you can read our deep-dive in the glossary.

Here is how our procedural pipeline works:

  1. The Biome Generator: Randomly selects the geography (e.g., arid salt flats, subterranean caverns, bioluminescent mangrove swamps).
  2. The Tech Level: Determines how the society cooks (e.g., geothermal venting, solar concentration, fermentation pits, crude open embers).
  3. The Cultural Taboo: Randomly assigns a societal rule (e.g., eating anything with an odd number of eyes is sacrilege; fire-cooked food is only for the dying; salt is more valuable than gold).
  4. The LLM Synthesiser: Claude takes these three randomised parameters and synthesises a historically consistent recipe, complete with cultural context, ingredients, preparation steps, and a warning for modern human stomachs.

The Python Engine

Below is a complete, working Python script using the Anthropic API to generate these lost culinary marvels. Make sure you have your API key set up in your environment variables before running it.

`python import os import random import json from anthropic import Anthropic

Initialize the Anthropic client client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"))

Procedural matrices BIOMES = [ "Bioluminescent Mangrove Swamp (humid, hyper-saline, fungal abundance)", "Subterranean Basalt Fissures (dry, geothermal, sulfur-rich, insect-heavy)", "High-Altitude Glacial Spires (sub-zero, oxygen-deprived, lichen and migratory birds)", "Alkaline Dust Basins (arid, mineral-crusted, reptile-dominated, water-scarce)" ]

TECH_LEVELS = [ "Neolithic / Preservative (salting, burying, smoking, solar drying)", "Geothermal Harnessing (using tectonic vents, steam chambers, hot mud boiling)", "Symbiotic Fermentation (utilising active, living bacterial cultures and fungal rot)", "Solar Reflection (using polished obsidian mirrors to bake or sear high-heat dishes)" ]

CULTURAL_TABOOS = [ "The consumption of any animal blood is strictly forbidden; all meat must be ash-cured.", "Intoxicants are reserved solely for priests; everyday food must actively suppress emotion.", "Cooking with open flames is seen as an act of war; all heat must be indirect or subterranean.", "Root vegetables are sacred representations of ancestors; eating them is a capital offence." ]

def generate_constraints() -> dict: return { "biome": random.choice(BIOMES), "tech": random.choice(TECH_LEVELS), "taboo": random.choice(CULTURAL_TABOOS) }

def query_culinary_engine(constraints: dict) -> str: system_prompt = ( "You are an expert speculative anthropologist and culinary historian. Your task is to generate " "a highly realistic, culturally grounded recipe from a fictional lost civilization based on " "the physical and cultural constraints provided to you." ) user_prompt = f""" Generate a recipe based on these strict societal constraints: - Biome: {constraints['biome']} - Cooking Technology: {constraints['tech']} - Cultural Taboo: {constraints['taboo']} Respond ONLY with a valid JSON object containing the following keys: - "dish_name": The translated English name of the dish, and its original native name (phonetic). - "cultural_context": A 3-sentence explanation of who eats this dish, when, and its social significance. - "ingredients": An array of objects, each containing "name", "quantity", and "source". - "preparation_steps": An ordered list of steps to prepare the dish using only the specified technology. - "taste_profile": A brief sensory description of the finished dish for a modern human. """ message = client.messages.create( model="claude-3-5-sonnet-20241022", max_tokens=1500, temperature=0.7, system=system_prompt, messages=[ {"role": "user", "content": user_prompt} ] ) return message.content[0].text

if __name__ == "__main__": # Generate random cultural constraints world_constraints = generate_constraints() print("--- Simulated World State ---") print(json.dumps(world_constraints, indent=2)) print("\nSynthesising lost recipe...\n") # Query the Claude engine try: recipe_json_string = query_culinary_engine(world_constraints) recipe_data = json.loads(recipe_json_string) print("--- Generated Culinary Artifact ---") print(json.dumps(recipe_data, indent=2)) except Exception as e: print(f"An error occurred: {e}") print("If you are facing rate-limiting or API issues, consult https://claude-support.com for help.") `

Analysing a Sample Output

When we run this script, the procedural randomness forces Claude to think laterally. If the script rolls up a Subterranean Basalt Fissure with Symbiotic Fermentation and a taboo against open flames, you won't get a standard fantasy stew.

Instead, you might get "The Silt-Mother’s Glandular Paste": Cultural Context*: A ceremonial paste eaten exclusively by mining guilds before entering deep, unmapped rifts to stave off lung-rot. Ingredients*: Fermented blind-crustacean roe, crushed alkaline sulfur crystals, and yeast scraped from subterranean thermal vents. Preparation*: The roe is sealed inside basalt jars, lowered into active geothermal vents for three weeks to curdle, and then ground into a paste using non-reactive volcanic glass mortars to respect the flame taboo.

This is world-building that feels alive. It has weight, texture, and immediate sensory impact. You can feed this output directly into your writing projects, use it to populate the menus of taverns in your tabletop campaigns, or use it as a prompt for OpenAI's image generators to see what these bizarre dishes actually look like on a plate.

By building generative systems with rigid, randomised boundaries, we prevent AI from defaulting to average human expectations. We force it to dig deeper into the speculative sand, yielding creative results that feel genuinely alien.

claudepythoninspirationworldbuildingprocedural

Keep going

Build something with the prompt generator, decode the jargon in the glossary, or compare the tools on our platform deep-dives.