Mouse Colony Breeding Planner
What you'll learn
~25 min- Build a standalone mouse colony breeding planner with a single AI prompt
- Visualize breeding timelines, weaning schedules, and Mendelian genotype predictions
- Troubleshoot common issues with date calculations, Chart.js timeline rendering, and genotype ratios
- Customize the planner with cage density alerts, genotyping checklists, or pedigree tracking
What youβre building
If you manage a mouse colony, you know the drill: spreadsheets with mating dates, sticky notes on cage cards, mental math for weaning deadlines, and crossed fingers about genotype ratios. One missed weaning date and you have overcrowded cages. One forgotten pairing and your timeline slips by a month.
You are going to build a visual breeding planner that replaces all of that in the next 20 minutes.
Colony management is one of the most time-consuming parts of working with animal models. A tool that visualizes your entire breeding pipeline β births, weanings, expected genotypes β saves hours per week and prevents costly mistakes like missed weanings or redundant crosses. This is the kind of tool you demo to your facility manager and say, βI built this in 20 minutes.β
By the end of this lesson you will have a standalone mouse colony breeding planner that runs entirely in the browser. It loads embedded sample breeding data, calculates expected birth and weaning dates, predicts Mendelian genotype ratios for each cross type, and displays a timeline view using Chart.js. You will build it by giving a single prompt to an LLM CLI tool.
Input records β calculate derived dates β predict outcomes β visualize on a timeline. This pattern works for project management, manufacturing schedules, crop rotation planning β any domain where you track events with predictable intervals.
πDomain Primer: Key mouse colony terms you'll see in this lesson
New to mouse colony management? Here are the key terms you will encounter:
- Sire / Dam β The male (sire) and female (dam) mouse in a breeding pair. These terms come from animal husbandry and are standard in vivarium record-keeping.
- Heterozygous (het) β Carrying one copy of a mutant allele and one wild-type copy. Written as +/- or gene/+. Het mice often look normal but carry the mutation.
- Homozygous (hom) β Carrying two copies of the same allele β either both mutant (hom mutant, -/-) or both wild-type (hom WT, +/+).
- Wild-type (WT) β The normal, unmodified genotype (+/+). WT mice serve as controls and breeding stock.
- Mendelian ratios β The expected proportions of genotypes in offspring based on parental genotypes. A het x het cross produces 25% hom mutant, 50% het, 25% WT (a 1:2:1 ratio). A het x WT cross produces 50% het, 50% WT (a 1:1 ratio). These ratios assume autosomal inheritance. X-linked alleles (e.g., X-linked Cre drivers) produce different ratios for male and female offspring.
- Gestation period β The time from mating to birth. In mice, this is approximately 19-21 days (we use 21 as the standard estimate).
- Weaning age β The age at which pups are separated from the dam and housed independently. Standard weaning is 21 days post-birth.
- Genotyping β Testing pups (usually via tail or ear biopsy) to determine their genotype. Typically done around weaning age.
- F1 / F2 generation β F1 is the first generation of offspring from a cross. F2 is the second generation (offspring of F1 x F1 crosses).
- Cage card β The physical label on each cage recording strain, genotypes, dates, and IDs.
You do not need to be an expert in genetics β the AI tool handles the ratio math. You just need to know what information to track.
Who this is for
- GEAM facility staff and animal models technicians who manage breeding colonies for gene editing experiments and need to plan weanings and genotyping weeks ahead.
- Graduate students maintaining their own small colonies for thesis research who want to stop relying on memory and sticky notes.
- PIs and lab managers who need a quick visual overview of the colony pipeline for lab meetings, IACUC protocols, or grant progress reports.
Genome editing and animal models facilities manage dozens of active breeding colonies across multiple mouse strains. Colony managers juggle hundreds of cage cards. A visual planner that shows the next two months of expected births and weanings β with genotype predictions β transforms colony management from reactive firefighting into proactive planning.
The showcase
Here is what the finished planner looks like once you open the HTML file in a browser:
- Summary cards at the top: total active cages, active strains, expected pups this month, upcoming weanings in the next 7 days, cages awaiting genotyping.
- Add Breeding Pair form where you enter cage ID, strain, sire/dam IDs, genotypes, mating date, cross type, and expected litter size.
- Breeding pair table with all active pairs showing strain, calculated expected birth date (mating date + 21 days), weaning date (birth + 21 days), and Mendelian genotype predictions displayed as expected pup counts.
- Timeline view (Chart.js horizontal bar chart in Gantt style) showing each cage as a row, with colored bars for gestation period (mating β birth) and nursing period (birth β weaning).
- Genotype predictions panel showing a pie/doughnut chart of expected offspring genotype distribution for the selected cross type.
Everything runs client-side. No data leaves the browser. You can email the file to a colleague and it works immediately.
The prompt
Open your terminal Terminal The app where you type commands. Mac: Cmd+Space, type "Terminal". Windows: open WSL (Ubuntu) from the Start menu.
Full lesson →
, navigate to a project folder project folder A directory on your computer where the tool lives. Create one with "mkdir my-project && cd my-project".
Full lesson →
, start your AI CLI tool AI CLI tool Claude Code, Gemini CLI, or Codex CLI β a command-line AI that reads files, writes code, and runs commands.
Full lesson →
(e.g., by typing claude), and paste this prompt:
Build a single self-contained HTML file called colony-planner.html that serves asa mouse colony breeding planner. Requirements:
1. EMBEDDED SAMPLE DATA Preload the following breeding pair data as a JavaScript array of objects: [ { cage: "C001", strain: "C57BL/6J", sire: "M101", sireGeno: "het", dam: "F201", damGeno: "het", matingDate: "2026-03-01", crossType: "het x het", expectedLitterSize: 8 }, { cage: "C002", strain: "129S1", sire: "M102", sireGeno: "het", dam: "F202", damGeno: "WT", matingDate: "2026-03-05", crossType: "het x WT", expectedLitterSize: 7 }, { cage: "C003", strain: "BALB/c", sire: "M103", sireGeno: "hom", dam: "F203", damGeno: "het", matingDate: "2026-03-08", crossType: "hom x het", expectedLitterSize: 9 }, { cage: "C004", strain: "C57BL/6J", sire: "M104", sireGeno: "het", dam: "F204", damGeno: "het", matingDate: "2026-03-10", crossType: "het x het", expectedLitterSize: 6 }, { cage: "C005", strain: "FVB/N", sire: "M105", sireGeno: "WT", dam: "F205", damGeno: "het", matingDate: "2026-03-12", crossType: "WT x het", expectedLitterSize: 8 }, { cage: "C006", strain: "CD-1", sire: "M106", sireGeno: "het", dam: "F206", damGeno: "het", matingDate: "2026-03-15", crossType: "het x het", expectedLitterSize: 7 }, { cage: "C007", strain: "NSG", sire: "M107", sireGeno: "hom", dam: "F207", damGeno: "WT", matingDate: "2026-03-18", crossType: "hom x WT", expectedLitterSize: 8 }, { cage: "C008", strain: "129S1", sire: "M108", sireGeno: "het", dam: "F208", damGeno: "hom", matingDate: "2026-03-20", crossType: "het x hom", expectedLitterSize: 6 }, { cage: "C009", strain: "C57BL/6J", sire: "M109", sireGeno: "het", dam: "F209", damGeno: "het", matingDate: "2026-02-20", crossType: "het x het", expectedLitterSize: 9 }, { cage: "C010", strain: "BALB/c", sire: "M110", sireGeno: "WT", dam: "F210", damGeno: "WT", matingDate: "2026-02-25", crossType: "WT x WT", expectedLitterSize: 7 } ]
2. DATE CALCULATIONS - Expected birth date = mating date + 21 days (mouse gestation) - Weaning date = birth date + 21 days (standard weaning age) - Genotyping due = weaning date (genotyping happens at weaning) - Color-code dates: red if overdue (past today), amber if within 3 days, green if future
3. MENDELIAN GENOTYPE PREDICTIONS For each cross type, calculate expected pup counts from the litter size: - het x het: 25% hom mutant (-/-), 50% het (+/-), 25% WT (+/+) - het x WT (or WT x het): 50% het (+/-), 50% WT (+/+) - hom x het (or het x hom): 50% hom mutant (-/-), 50% het (+/-) - hom x WT: 100% het (+/-) - WT x WT: 100% WT (+/+) Display predictions as a small table per cage row and a doughnut chart
4. SUMMARY CARDS (top of page, update dynamically) - Total active cages - Active strains (count of unique strain names) - Expected pups this month (sum of expected litter sizes for births this month) - Upcoming weanings in next 7 days (count) - Cages awaiting genotyping (birth occurred but weaning date not yet passed)
5. TIMELINE VIEW - Chart.js horizontal bar chart in a Gantt-style layout - Each cage is a row on the Y-axis - Two stacked bars per cage: gestation period (blue) and nursing period (green) - Today marker as a vertical red dashed line - X-axis shows dates spanning the full range of data
6. ADD BREEDING PAIR FORM - Inputs: Cage ID, Strain (text field, required), Sire ID, Sire Genotype (dropdown: het/hom/WT), Dam ID, Dam Genotype (dropdown), Mating Date, Expected Litter Size - Cross type auto-determined from sire/dam genotypes - Adding a pair updates all views immediately
7. DESIGN - Dark theme: background #0f172a, cards #1e293b, text #e2e8f0, accent #10b981 - Clean sans-serif font (Inter from Google Fonts CDN) - Responsive layout, summary cards in a row, table and timeline below - Color legend for timeline bars and genotype labels
8. TECHNICAL - Pure HTML/CSS/JS in one file, no build step - Chart.js loaded from CDN (https://cdn.jsdelivr.net/npm/chart.js) - chartjs-plugin-annotation from CDN for the today-line - All date math using native JavaScript Date objectsThat entire block is the prompt. Paste it as-is. The embedded sample data gives the LLM concrete examples of every cross type, so it correctly implements all the Mendelian ratio logic on the first try. The specificity about date calculations and color-coding prevents the most common follow-up fixes.
The mating dates in the sample data (February-March 2026) are examples. If you are using this lesson after those dates have passed, change the dates in the prompt to reflect your current month so the timeline and color-coded date alerts are meaningful.
What you get
After the LLM finishes (typically 60-90 seconds), you will have a single file: colony-planner.html. Open it in any browser.
Expected output structure
colony-planner.html (~500-700 lines)You should see:
- Five summary cards across the top showing cage count (10), active strains, expected pups, upcoming weanings, and genotyping status.
- A breeding pair table with all 10 entries. Cages C009 and C010 (mated in February) should show birth dates that have already passed, with weaning dates color-coded based on proximity to today.
- Mendelian predictions for each cage β for example, cage C001 (het x het, litter size 8) should show 2 hom mutant, 4 het, 2 WT.
- A timeline chart with 10 horizontal rows, blue bars for gestation and green bars for nursing, and a red dashed line at todayβs date.
- An add-pair form at the top or in a sidebar. Adding a new pair should instantly update the table, timeline, and summary cards.
If something is off
| Problem | Follow-up prompt |
|---|---|
| Timeline bars not showing | The Chart.js horizontal bar chart is empty. Make sure you're using a "bar" chart with indexAxis: "y" and the data values are date ranges converted to timestamps. Each bar needs a start and end value using the floating bar format [start, end]. |
| Mendelian ratios wrong for hom x het | The genotype predictions for hom x het cross show 25/50/25 but should be 50% hom mutant and 50% het (no WT offspring). Fix the Mendelian ratio lookup table. |
| Today line missing | The vertical "today" line is not appearing on the timeline. Make sure chartjs-plugin-annotation is loaded and the annotation is configured as a vertical line with type: "line", scaleID: "x", value: Date.now(). |
| Date calculations off by one | The birth dates are showing 20 days after mating instead of 21. Double-check that the date addition adds exactly 21 days using setDate(getDate() + 21). |
When Things Go Wrong
Use the Symptom β Evidence β Request pattern: describe what you see, paste the error, then ask for a fix.
How it works (the 2-minute explanation)
You do not need to understand every line of the generated code, but here is the mental model:
- Date arithmetic is straightforward: take the mating date, add 21 days for birth, add another 21 for weaning. JavaScriptβs
Dateobject handles month boundaries automatically (March 25 + 21 days correctly becomes April 15). - Mendelian predictions are a lookup table: each cross type maps to a set of ratios that get multiplied by litter size. The math is simple multiplication, but encoding the correct ratios for each cross type is the tricky part.
- The Gantt timeline uses Chart.js floating bars β each bar has a
[start, end]value instead of a single height. WithindexAxis: 'y', the bars go horizontal, and each cage gets its own row. - The annotation plugin draws the βtodayβ line as a vertical marker, giving you an instant visual reference for what is overdue, in progress, and upcoming.
IACUC protocols require accurate animal counts and justification for breeding. A visual planner that shows expected births, genotype yields, and weaning dates makes protocol amendments faster and more accurate. It also helps during lab meetings β instead of reading cage card numbers off a spreadsheet, you can show the timeline and immediately identify bottlenecks (e.g., three litters weaning in the same week, creating a genotyping backlog).
Customize it
The base planner is useful as-is, but here are single-prompt extensions that make it more powerful:
Add cage density alerts
Add a cage density tracking feature. Each cage has a maximum capacity of 5 adultmice. After weaning, pups need to be split into new cages. Calculate how many newcages will be needed based on expected litter sizes and display a warning bannerwhen upcoming weanings will require more cages than are currently available. Add an"available empty cages" input field with a default of 10.Add genotyping checklist
Add a "Genotyping Queue" section below the timeline. For each litter that hasreached weaning age, show a checklist with one row per expected pup. Includecolumns for: pup number, expected genotype (from Mendelian prediction), ear tagnumber (auto-generated), sample collected (checkbox), result (dropdown: hom/het/WT),and a "matches prediction" indicator. Add a button to export the checklist as aCSV for the genotyping lab.Add pedigree tracking
Add a simple pedigree view. When I click on a cage, show a family tree diagramusing nested HTML divs (no external library needed). Display the sire and dam atthe top, their genotypes, and the expected offspring distribution below. If anyoffspring from a previous litter are now breeders themselves, link them so I cantrace lineage across generations. Color-code by genotype: green for WT, yellowfor het, red for hom mutant.Notice the pattern: you start with a working tool, then add features one prompt at a time. Each prompt builds on what already exists. The planner evolves from a simple date calculator to a full colony management system β one feature at a time, always with a working tool at each step.
Try it yourself
- Open your CLI tool in an empty folder.
- Paste the main prompt from above.
- Open the generated
colony-planner.htmlin your browser. - Add a new breeding pair using the form and verify the timeline updates.
- Pick one customization from the list above and add it.
If this tool saves you even one missed weaning date, it has already paid for itself. Save the file, put it on a shared drive, and share it with your team.
Key takeaways
- One prompt, one tool: a detailed, specific prompt with embedded sample data produces a working colony planner in under 2 minutes.
- Single-file HTML tools bypass all installation barriers β they run on any lab computer with a browser, which matters in vivarium offices where you cannot install software.
- Mendelian ratio logic is simple math, but encoding it correctly matters β specifying every cross type in the prompt prevents the LLM from guessing wrong ratios.
- Gantt-style timelines in Chart.js use floating bars β this is a reusable pattern for any project with date ranges (experiments, grant timelines, equipment bookings).
- Date arithmetic has edge cases (timezone parsing, month boundaries) β building these into your prompt prevents debugging later.
You set up a het x het cross with an expected litter size of 8 pups. According to Mendelian inheritance, how many of those pups do you expect to be heterozygous (+/-)?
Why is it important to track weaning dates in a mouse colony?
Your colony planner shows that 3 litters are all due for weaning in the same week. What is the most useful action this information enables?
Whatβs next
In the next lesson, you will build a Cryopreservation & IVF Calculator β a tool that tracks sperm cryopreservation viability rates, calculates media dilution volumes, and helps plan IVF recovery sessions. Same pattern: one prompt, one HTML file, immediate utility for the GEAM facility.