Fritsche Lab · University of Michigan

Use AI to build research code you can explain.

A practical guide for biostatisticians, bioinformaticians, and data scientists. Turn a research question into a clear plan, a reviewable change, and a result someone else can reproduce.

Practical GenAI Coding Guide · R examples · Reusable prompts
Plan the analysisMake methods and success criteria explicit.
Check the evidenceInspect the diff and test expected behavior.
Make it reusableRecord the environment, decisions, and commands.

Choose your starting point

Learn the workflow. Put it to work.

Learn

The eight-step guide

Follow an EHR data example from planning and prompting to review, iteration, and documentation.

Explore the chapters

Practice

One small, testable task

Work with synthetic records, define the expected result, and review an agent's first change.

Start the exercise

Apply

Working with coding agents

Scope a task, manage context, delegate independent work, and keep evidence of what was checked.

Open the playbook

The eight-step workflow

Each step produces something you can inspect. Return to the plan or implementation when a check reveals a problem.

Step What you should have before moving on
1. Plan and context A research question, data schema, and acceptance criteria.
2. Research methods and tools Sources and explicit analysis rules.
3. Prompt the assistant A scoped task with inputs, outputs, and checks.
4. Review the code A diff you understand and questions resolved.
5. Refine and add features A focused change with a clear reason.
6. Test and iterate Evidence that expected behavior holds, including edge cases.
7. Standardize Consistent code with preserved behavior.
8. Document and share Instructions and provenance that let a colleague rerun the work.

Supporting materials

About this guide

Created and maintained by Lars G. Fritsche and the Fritsche Lab at the University of Michigan. The guide shares the lab’s emphasis on independent evaluation, reusable methods, and team science.

The September 2026 update notes describe the new material and the sources checked for this revision.

How to cite

Fritsche, Lars G. Practical GenAI Coding Guide: A practical 8-step process for integrating GenAI tools into coding and research workflows. Fritsche Lab, University of Michigan. https://fritschelab.org/practical-genai-coding-guide/. Accessed YYYY-MM-DD.

Citation metadata is available in CITATION.cff.