How AI coding tools work
5 minCoding tools write a component that looks finished in seconds. Learn why they get your keyboard, your phone and your tokens wrong, and the three checks that catch it before you accept the code.
Lesson video
Tastebud · 5:07 · Captions on screen
A coding tool writes the most likely code, so check keyboard, phone and tokens before you accept it.
- Why. It learned from public code, so common patterns come out right. Your Tab order, your smallest phone and your token names aren't in that code unless you show them.
- Real example. Switch Claude Code to Manual mode with Shift+Tab and ask for a Pay button. It shows each edit and waits for your yes, so run the three checks there. (Claude Code, Nov 2026)
- When to break it. A throwaway prototype you'll click once on your own laptop can skip the phone and token checks. Keep the keyboard check for anything another person will use.
- Common mistake. Accepting a component because it looks right. A div with onClick looks exactly like a button, but Tab skips it and a screen reader announces plain text.
Our take. Never accept a generated component because the preview looks right. Press Tab through it, squeeze it to 360 px and search it for hex codes, because those three checks find what a laptop preview hides.
Tools are sure on common patterns and guess at yours
A coding tool predicts code from patterns in public projects. A click handler or rounded corners appear everywhere in that code, so they usually come out right. Your token names, your Tab order and your smallest phone appear nowhere in it.
The more a detail belongs to your project, the more the tool guesses
- A click handler. onClick on a button is in almost every React project, so the tool rarely gets it wrong.
- Rounded corners and padding. Common CSS that usually comes out right, though the numbers are the tool's guess and not your spacing scale.
- Keyboard behaviour. Clickable divs are common in public code, so the tool can repeat one. Tab and Enter need a real button.
- Your smallest phone. The tool can't see your users' phones. A fixed 390 px width fits the one screen it assumed.
- Your token names. --color-brand exists only in your files, so the tool writes a hex code unless it reads them first.
Fix the button with the three checks
Each of the three checks catches one failure in the generated Pay button, and each failure has a one-line fix in plain HTML and CSS. The picture pairs what the tool wrote with what passes.
- <div class="pay">: Tab skips it and Enter does nothing
- width: 390px: runs off the edge of a 360 px phone
- background: #5b21b6: keeps the old purple when the brand changes
- <button class="pay">: Tab reaches it, Enter presses it
- width: 100%, with a max-width if it needs one
- background: var(--color-brand), read from the token file
Try it
Find the three failures in a generated Pay button
This PayButton is an example of the failures coding tools make, written for this lesson. Tap each line that would fail on a keyboard, on a phone or against your tokens.
Tap anything on the screen that looks wrong.
An example written for this lesson. No tool produced this exact file.
Fix the Pay button
Fix the three failures in the HTML and CSS. Then click into the preview and press Tab: focus can land on the button only once it is a real button.
Tab adds two spaces. Press Esc, then Tab, to leave the editor.
- Keyboard: .pay is a real <button> (not yet)
- Tokens: the background uses var(--color-brand) (not yet)
- Phone: the width flexes (width: 100% or a max-width) (not yet)
What to notice: The 390 px div already runs past the preview's right edge, since the preview is narrower than a phone. Fix the width and it fits. Then press Tab: the dark focus ring appears only once .pay is a button, and Enter shows the status line.
Quick check
Claude Code hands you a Pay button that looks perfect in the browser. Which check would catch a <div onClick> posing as a button?
Watch next
Watch it for What a real button gives you for free, like Tab focus and Enter and Space, that a clickable div makes you rebuild by hand.
Watch it for How accessibility checks run while an AI agent writes components, so failures surface before a person reviews them.
Connects to: 1.3 First steps with Claude Code · 7.1 Design tokens · 8.2 Keyboard and focus · 15.5 Testing and TestFlight
Sources · checked Nov 2026
- GitHub Docs: Application card, GitHub Copilot inline suggestionsCopilot generates code probabilistically from the surrounding context, can write code that appears valid but isn't correct, and its suggestions need review and testing
- Claude Code docs: OverviewClaude Code reads your codebase, edits files and runs commands
- Claude Code docs: Configure permissionsManual mode (config value default) stops and asks before file edits, and the prompt shows what Claude is about to do
- Claude Code docs: Permission modesIn a terminal, Claude Code v2.1.283 and later starts in auto mode; Shift+Tab switches to Manual, shown as 'manual mode on', where Claude Code asks before most edits
- MDN: HTML, a good basis for accessibilityA div used as a button loses native keyboard access; a real button is reached with Tab and pressed with Space, Return or Enter
- Cursor Docs: Codebase indexingCursor's agent searches your project and sends the files it opens to the model as context
- npm: reactReact 19.3.1 is the current release (14 Oct 2026)