Coding & automation

Fix only the button: scope a Claude Code change with Karpathy guidelines

Specify the repair and preserved files, then inspect a real one-line edit and independent click, keyboard and mobile checks.

Claude Code
AI-generated editorial illustration, not an actual product screenshot.
On this page
THE QUICK TAKE
  • State the change and preservation boundaries in the same request.
  • Separate an assistant’s completion report from file and browser evidence.
  • A one-line result fits this small defect;it is not a universal line-count target.

Claude edited one line in a fictional webpage. The editorial team separately checked browser behavior.

Files for this exercise

AIHotple example files and prompts. Try the exercise before substituting real work data.

The visible button did not open anything

The fictional Help button controlled a hidden panel. Its click handler always assigned true to panel.hidden, so every click left the panel hidden and aria-expanded false. The requested behavior was precise:first click opens, second click closes.

Inspect the original before editing

Extract the ZIP into a fresh practice folder. Run node preview.mjs there;Node.js and a modern browser are required, no npm dependencies. The before URL serves the original defect, and after serves the actual reference repair. Change the copied server’s port if5598is occupied.

Do not paste the reference repair over the original before trying the exercise. First reproduce what fails.

From the extracted folder
node preview.mjs
# Original: http://127.0.0.1:5598/before/
# Actual reference repair: http://127.0.0.1:5598/after/

Load the guideline in the folder you will repair

The download-source.ps1 script retrieves the pinned guideline into before/docs/ai and checks SHA256. Inspect it and before/CLAUDE.md, then start Claude Code from before. Stop rather than overwrite an existing guideline.

These are fictional project rules. Do not replace real service instructions with the example. The import is only one part of the setup;the explicit request and resulting changes still need inspection.

Import the guideline safely →

Define the defect, preserved files and expected behavior

Our actual Korean request named the three files, allowed only the necessary app.mjs change and preserved HTML, CSS, copy, design and instructions. It also stated the open/close and aria-expanded expectations.

Adapt names and boundaries to your own project. “Only app.mjs” is appropriate to this exercise, not a universal rule for every defect. The ZIP includes the exact request and response.

Actual Korean request
가상 로컬 웹페이지 실습입니다. index.html, styles.css, app.mjs를 읽어 도움말 보기 버튼이 설명을 열고 닫지 못하는 원인을 확인하세요. app.mjs의 잘못된 동작만 최소한으로 수정하세요. 버튼을 처음 누르면 help가 보이고 aria-expanded=true, 다시 누르면 숨겨지고 false여야 합니다. index.html, styles.css, 기존 문구·디자인·프로젝트 지침은 변경하지 마세요. 새 파일·패키지·네트워크·명령 실행·하위 에이전트·메모리는 사용하지 마세요. 실제 브라우저 검증은 편집부가 별도 수행하므로 실행했다고 말하지 말고, 바뀐 줄과 아직 확인하지 않은 것을 한국어로 알려주세요.

One line changed;the ARIA update stayed

Claude read the three files and replaced one assignment. The existing aria-expanded line remained. It computes the expanded value after the panel state changes.

We compared file bytes to confirm that HTML, CSS and instructions were preserved. A larger fix may legitimately require more than one line.

Actual edit and preserved following line
- panel.hidden = true;
+ panel.hidden = !panel.hidden;
  button.setAttribute('aria-expanded', String(!panel.hidden));

Check the result outside the assistant’s answer

Claude explicitly said it had not run a browser. The editorial team then checked both versions independently.

ActionObserved
Original clickStill hidden;aria-expanded=false
First repaired clickVisible;aria-expanded=true
Second repaired clickHidden;aria-expanded=false
Enter / Space on buttonOpened / closed
390px viewportOpened;no horizontal overflow

Actual mobile result

This screenshot shows our fictional page running the actual Claude-edited code. It is separate from the conceptual cover illustration.

Actual390pxbrowser showing the help panel after the repair
Fictional AIHotple page;actual edited code, independently checked in a browser

Inspect changed files in your own project

For a Git project, use git diff --stat and git diff -- path to inspect scope and lines. Our exercise folder was not a Git repository;we checked bytes and the actual edit record instead.

If a defect remains, describe the input and expected versus observed behavior. Before rolling back unrelated changes, separate your own work from the assistant’s edits. This example does not isolate the causal contribution of the guideline.

For readers using Git;not our fixture verification
git diff --stat
git diff -- app.mjs

Sources & verification

We used Windows, Claude Code 2.1.301 and claude-sonnet-5-5 with an imported Karpathy guideline. The model made three Read calls and one Edit call;only app.mjs changed. HTML, CSS and project instructions remained byte-identical. The model did not use command, network or agent tools. Separately, we checked the pre-fix failure, two clicks, Enter, Space and390px layout in a browser. No guideline-free control, large-codebase trial, error-rate or time-saving comparison was performed. English prose translates the Korean exercise.

  1. Karpathy · surgical changes and examples
  2. Karpathy · skill source
  3. Anthropic · project instructions

Sources checked: 2026.10.19

Keep this guide for your next project.Report a correction