Module 5 — Production-Ready Habits
Goal: code that belongs in a real, published plugin.
Chapter 16 ended with an honest admission: the multi-turn demo you just built isn’t something you’d actually ship. That’s true of a lot of this book so far, every example has been built to teach one concept clearly, not to survive contact with a real site, real users, or a real budget. This module is where that starts to change.
What’s in this module
- Don’t Build UI Blindly, Feature Detection. Checking whether a site’s connected provider actually supports what you’re about to ask for, before you render a button for it.
- What Actually Happened?, Full Result Objects. Everything beyond just the text: how many tokens a call used, which provider and model actually answered.
- Politely Requesting a Model, Model Preferences. The properly-taught version of something this book has already previewed more than once, asking for a specific model without hard-requiring it.
- Exposing AI to the Frontend, Safely. There’s no way to call the AI Client directly from JavaScript, so this chapter builds a small REST endpoint of your own, the pattern every block-editor and frontend chapter after this one reuses.
- Who Gets to Use AI?, Access Control. Blocking or limiting who can trigger a prompt at all, useful the moment more than one person can touch your site.
Why these five belong together
None of these five chapters teaches a new way to prompt an AI model. Every one is about the layer of care around that prompt instead: knowing before you ask whether the answer will even work, knowing more about what actually happened after it does, asking politely rather than assuming, exposing the feature safely instead of wiring JavaScript straight to PHP, and deciding who’s even allowed to use it in the first place.
This is the module where a working demo turns into something you’d actually be comfortable shipping.
On to Chapter 17.