Inspiration
How to Build a Generative Deep-Sea Field Guide for Fictional Bioluminescent Organisms Using Claude and Python
Unleash your inner speculative biologist. Use Claude 3.5 Sonnet and Python to procedurally generate a field guide of fictional deep-sea creatures, complete with Latin names, survival metrics, and custom SVG anatomy diagrams.
Updated 10/5/2026
There is an eerie, quiet alien world right here on Earth: the abyssal zone of our oceans. The creatures that inhabit these depths don't look like anything from our terrestrial experience. They are gelatinous, heavily armed with needle-like teeth, and lit from within by haunting bioluminescent patterns.
If you are a sci-fi worldbuilder, a game designer, or simply a creative coder looking for a brilliant weekend project, building a generative field guide for fictional deep-sea biology is an incredibly satisfying experiment.
Instead of manually drafting each creature, we can use /platforms/claude to procedurally generate entirely new species. But we aren't just generating flat text blocks. We are going to build a Python pipeline that uses Claude to output structured JSON containing custom-crafted SVG anatomy diagrams of these creatures, rendering a stunning, cohesive field guide in HTML or PDF.
Why Procedural Speculative Biology?
When we build fictional worlds, we often fall into the trap of repeating familiar tropes. An LLM, when properly constrained, can act as a brilliant mutation engine. By feeding it ecological parameters (depth, ambient temperature, pressure, food source) and asking it to synthesise biological solutions, it generates fascinatingly bizarre survival adaptations.
To make this system reliable, we need structured data. We want every creature to have: A scientific binomial name (e.g., Bathysphaera infernalis*). * A specific bioluminescent wave-spectrum profile (measured in nanometres). * An interactive dietary web relationship. * An anatomically accurate, procedurally generated vector (SVG) illustration.
To understand how to structure this kind of complex output from LLMs, take a quick detour through our glossary entry on structured data and Pydantic parsing.
Step 1: Designing the Pydantic Schema
First, we need to enforce a rigid schema on Claude’s output. This ensures our Python pipeline can safely parse the generated data and render our final field guide without throwing unexpected parsing errors.
`python
from pydantic import BaseModel, Field
from typing import List
class BioluminescentOrganism(BaseModel):
common_name: str = Field(..., description="Evocative English name of the creature.")
scientific_name: str = Field(..., description="Fictional Latin binomial taxonomy.")
depth_range: str = Field(..., description="The oceanic zone inhabited, e.g., '4000m - 6000m'.")
bioluminescent_frequency: int = Field(..., description="Dominant light wavelength in nanometres (e.g., 470 for blue).")
anatomy_svg: str = Field(..., description="A valid, clean, self-contained SVG illustration representing the creature's structural anatomy.")
survival_adaptations: List[str] = Field(..., description="3 unique physiological traits mapped to its deep-sea niche.")
researcher_note: str = Field(..., description="A first-person, atmospheric journal entry from a deep-sea submersible pilot.")
`
Step 2: Drafting the System Prompt for Claude
To get high-quality SVG vector illustrations from Claude, your prompting must be precise. If you simply ask for an "SVG of a fish," you will get a generic triangle with a tail. You need to direct Claude to use organic geometric primitives, paths, and glowing radial gradients to simulate bioluminescence against a dark background.
Here is the prompt structure to feed to the model (highly optimized for Claude 3.5 Sonnet):
`
You are an expert speculative astrobiologist and visual designer specializing in marine biology.
Generate a detailed entry for a newly discovered abyssal organism based on the provided depth zone.
You must provide a completely valid SVG code snippet inside the 'anatomy_svg' field. The SVG must:
1. Use a dark background appropriate for a field guide page (#0B0F19).
2. Represent the organism's anatomy using highly stylized geometric paths, translucent layered ellipses, and glowing radial gradients to mimic bioluminescence.
3. Be completely self-contained with its own <svg> wrapper, viewBox="0 0 400 400", and inline CSS styles for glowing effects.
4. Do not include markdown code fences inside the JSON string value.
`
If you find Claude's SVG rendering engine is occasionally outputting broken tags, check our Claude troubleshooting and articles directory for guides on enforcing valid JSON blocks when handling heavy string generation.
Step 3: The Python Synthesis Engine
Now, let's write a simple Python script using the official Anthropic SDK to call the API, parse the response, and write it to an elegant HTML dashboard.
`python
import os
from anthropic import Anthropic
from pydantic import ValidationError
# Import the Pydantic schema defined in Step 1
client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"))
def generate_organism(depth_zone: str):
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=4000,
temperature=0.85, # Slightly higher temperature allows for wilder evolutionary adaptations
system="System prompt from Step 2 here.",
messages=[
{"role": "user", "content": f"Generate an organism from the {depth_zone} zone."}
]
)
# We extract and parse the JSON output from Claude
# You can alternatively use OpenAI's Structured Outputs if you prefer that pipeline
# Learn more about comparing these platforms at our /platforms/openai hub
raw_json = response.content[0].text
try:
organism = BioluminescentOrganism.model_validate_json(raw_json)
return organism
except ValidationError as e:
print(f"Validation failed: {e}")
return None
`
Step 4: Compiling the Field Guide
To turn this into a physical-feeling artifact, write a lightweight script that runs the generator three or four times for different ocean trenches (e.g., the Mariana Trench, the Tonga Trench).
Compile the resulting JSON objects into a single HTML file with a deep charcoal background, grid alignment, and CSS transitions. When you open the file in your browser, you will see a beautifully rendered speculative taxonomy. Because Claude generated the SVGs directly, they will scale perfectly on any high-resolution screen without losing their crisp, bioluminescent edges.
You can inspect live examples of SVG UI components and generative art structures on the official W3C SVG specifications page or browse interactive CSS-glowing galleries to fine-tune your styling parameters.
Once your code is humming, you'll have an infinite engine of deep-sea horror and wonder right at your fingertips. Happy worldbuilding!
Keep going
Build something with the prompt generator, decode the jargon in the glossary, or compare the tools on our platform deep-dives.