Put the site's source in a Git repository, install Claude Code, open it in that repository, give it one narrow instruction, review the diff, run the site locally, then deploy through your host's Git integration. A revert undoes it if something is wrong. The rest of this guide gives the concrete steps, with an example.
This is the repository route, the first of three covered in our broader guide, how ChatGPT, Claude, Codex or Cursor can edit an existing website. That post compares the routes. This one walks through the repository route with Claude Code as the example tool.
What do I need before I start?
You need a Git repository containing the site's actual source. That means the files that build the site: plain HTML/CSS/JS, or a static-site generator's source (Markdown content plus templates, for something like Eleventy, Hugo, or Astro). A folder of rendered HTML saved from "View Source" in a browser does not count. If your site lives inside a hosted builder with no code export, this route does not apply yet. See our export capability matrix for what you can get out of a given builder first. If your generator needs a build step, install Node.js (or whatever the generator needs) so you can run that build locally.
How do I install Claude Code and open my project?
Run the install command from Claude Code's quickstart, then start a session in your repository. For macOS, Linux, and WSL the command is curl -fsSL https://claude.ai/install.sh | bash (Windows has its own PowerShell and CMD variants) (Claude Code Docs, "Quickstart"). Confirm it worked with claude --version. Then:
cd /path/to/your/site
claude
You are prompted to log in on first use with a Claude subscription or Console account (same source). Claude Code "reads your project files as needed," so you do not have to paste in the codebase yourself (same source).
How do I give it a scoped instruction?
Name the exact file or page, the exact change, and what must stay untouched. A vague "make the homepage better" invites a wider diff than you wanted. For example: "On index.html only, change the hero heading from 'Welcome' to 'Book a consultation today'. Do not change any other file, the navigation, or the footer. Show me the diff before you do anything else."
Example (hypothetical): A consultant runs a static site built with Eleventy, source in a GitHub repository, deployed via Netlify. She opens Claude Code in that repository and types: "On src/pricing.md, replace the paragraph under the 'Hourly Rate' heading with this text: [pasted text]. Don't touch the layout template or any other content file. Run npm run build afterward and tell me if it fails." Claude Code locates the file, makes the edit, and reports the build result. She still reviews the diff and the rendered page before anything ships. This is illustrative only, not a test we ran.
How do I review the change before anything ships?
Know which permission mode you are in, read git diff, then run the build and open the result. The mode decides whether you are asked before each edit. Claude Code's quickstart says auto mode is the built-in starting mode for interactive terminal sessions on Pro, Max and Team plans: "a classifier reviews actions instead of you, and Claude edits most files and runs most commands without asking you." On other plans, Manual mode is the starting mode, and it asks before file edits (Claude Code Docs, "Quickstart"). Press Shift+Tab to switch modes for the session. For a first edit on a live site, Manual mode is the calmer choice (Claude Code Docs, "Configure permissions").
In any mode, Git is your real checkpoint, because nothing reaches the live site until you commit and push. Before committing, run git diff and read which lines changed, not just which files.
Then run the project's own build or test command yourself (npm run build, hugo, or whatever your generator uses) and open the result at a real screen width. A change that looks like one line in a template can affect every page that uses it.
How do I deploy through my host's Git integration?
Commit the change, push it, and let your host's Git integration build and publish it. Do not hand-copy files to a server. Netlify is one concrete example of a Git-connected host: pushing to your repository triggers a new deploy, and Netlify holds every change until it is fully ready. In its words, "No changes go live on your site's public URL before all changes have been uploaded. Once all the changes are ready, the new version of the site immediately goes live on the CDN" (Netlify Docs, "Deploy overview"). A merge to your configured production branch triggers a production deploy, and other branches can be configured for their own preview URLs (same source). GitHub's protected-branch settings can require a review and passing checks before that merge happens at all, which is the checkpoint you want between "Claude Code proposed a diff" and "the diff is live" (GitHub Docs, "About protected branches").
How do I roll back if something's wrong?
Use git revert for a wrong change, or your host's instant rollback for a wrong version being live. For a code-level mistake, revert the commit with git revert, which creates a new commit undoing the change, and push that. Your host's Git integration then deploys the reverted state the normal way.
For a deploy that is simply the wrong version to have live right now, some hosts offer an instant switch instead of a rebuild. Netlify's documentation describes "Publish Deploy" as a button that "doesn't trigger a new deploy but instead publishes a previous atomic deploy that is still available to you. Rollbacks are instantaneous" (Netlify Docs, "Manage deploys"). The same page warns that "if your Netlify site is connected to a Git repository and has auto publishing turned on, any new Git-triggered production deploys will overwrite the previously rolled back version" (same source), so it is a stopgap, not a substitute for fixing the repository. Either way, record which commit was live before you started, so "back to before" has a concrete answer.
What are the real limitations here?
- This is the repository route only. If your site is a hosted builder with a closed editor and no code export (Wix, Squarespace, Framer, and similar), there is no repository for Claude Code to open. See can ChatGPT, Claude, Codex or Cursor edit an existing website? for the browser-agent and API routes that apply there.
- A rendered HTML dump is not a working source. A copy of the final HTML output (from "Save Page As" or a crawler) is missing the templates, build process, and often the working links between pages. Rebuilding from that is a bigger job than editing a generator's source.
- Your plan may start you in auto mode. On Pro, Max and Team plans Claude Code edits most files without asking unless you switch to Manual mode, so the
git diffreview before committing cannot be skipped. - A deploy is a separate, later step from a saved file. Nothing here auto-publishes. The Git push and the host's own build make a change live, which is also where the review checkpoint belongs.
- Give it limited access. Point Claude Code at the one repository the task needs rather than a broader directory holding unrelated projects or credentials. See how to give an AI agent access to your website for the general access-scoping version of this advice across platforms.
How do I verify the result?
- Check which permission mode the session is in, and read
git diffbefore committing. - Run the project's own build/test command locally and confirm it passes.
- Open the changed page at desktop and mobile widths before pushing.
- Push to a branch first if your host and repository support preview deploys, and check that preview before merging to production.
- After the production deploy, open the live page, not just the local preview, and confirm the change is there.
- Record the commit hash that was live before the change, in case you need
git revert.