Fix SEO Issues With an AI Coding Agent: A Safe Workflow for Claude Code and Cursor

By SEOgrinder · Published · 9 min read

Short answer: An AI coding agent can fix the mechanical, checkable SEO problems of your site: titles, meta descriptions, canonical tags, hreflang, alt texts, security headers and the robots.txt, sitemap and llms.txt files. Hand it one finding at a time, each with a condition that says when the task is done, let it work on a branch, read the diff, and measure the page again after the change. It must not invent content, pick your keywords, speak for your company or decide for you whether AI crawlers may read your site. A fix makes a page technically correct. A better ranking is never guaranteed.

Where does an AI coding agent help with SEO, and where not?

An SEO audit produces two kinds of findings. Some are mechanical: there is one right answer and you can check it by fetching the page. Others are decisions that belong to a person. An AI coding agent such as Claude Code, Cursor or GitHub Copilot suits the first kind and is risky for the second.

Good jobs for an agent:

  • Titles and meta descriptions. A missing, duplicated or badly sized tag is quick to find in a template or content file. The agent should derive the text from what the page already says, not write marketing copy from nothing.
  • Canonical tags and hreflang. Both are rules, not prose. hreflang has one trap that we come back to below: every language version must link back to the others.
  • Alt texts. Fine where the image's meaning is clear from the page around it. Otherwise the agent should ask.
  • Security headers. A few lines of server or framework configuration, easy to verify with curl -I.
  • The files at the root: robots.txt, sitemap.xml and llms.txt. Short, plain text, and you can read the result right away.

Jobs that stay with you:

  • Inventing content. Product facts, prices, testimonials, claims about your company. The briefing that SEOgrinder generates says it in its working rules: invent no content, derive missing text from what is already on the page, or ask.
  • Keyword and topic decisions. Which page should target which phrase is a business question.
  • Owner decisions. Whether AI crawlers may read your site, and whether they may use it for training, is your call. The agent prompts of SEOgrinder say so explicitly: allowing or blocking is the owner's decision, so ask and do not choose for them. Our article on robots.txt for AI crawlers explains the options.
  • Performance work, partly. The targets are measurable: Core Web Vitals count at the 75th percentile of page loads, for mobile and desktop separately, and "good" means LCP up to 2.5 seconds, INP up to 200 milliseconds and CLS up to 0.1 (web.dev). An agent can apply known fixes, but one lab run afterwards does not show what real visitors measure, so decide yourself what to remove.

The safe workflow in six steps

The goal is a loop in which every change is small, checked and reversible.

  1. Scan. Enter the address of your public website in SEOgrinder. It is free and needs no account. You get an overall score, a task list sorted by impact and six areas: speed, how the page looks on Google, accessibility, technology and security, AI readiness and the website itself.
  2. Hand over. For the full list, press Hand over to AI in the report. That opens the briefing, a Markdown work order that you download as .md or copy and paste into your agent. For one task, press Hand over to AI on its task card. For the checks for AI agents, the AI readiness tab has a Copy agent prompt button on each line (met lines expand first). The prompts are written in English because they are meant for a model and the specifications they link to are English.
  3. One finding at a time. Tell the agent to do task one and stop. Do not ask for "all of SEO". A small task gives a small diff you can read.
  4. Read the diff and run your tests. Your build, your linter and your test suite exist for exactly this. Open the changed files yourself. If the agent touched something the task did not mention, ask why.
  5. Check again. Once the change is live under your public address, open the report and press Check again. SEOgrinder keeps a report for up to 24 hours, so without that button you would look at the old result. The button works a few times per hour. The finding should be gone. SEOgrinder scans public websites only, so a change that exists only on your laptop or behind a login is invisible to it. Then check after the release, and keep the change small enough to roll back.
  6. Commit. One commit per finding, with a message that names it. Merge when the re-check agrees, then take the next task.

What a good work order looks like

An agent without a clear target stops when something looks plausible. A good order removes the room for guessing. It has four parts:

PartWhat it doesWhere you find it in the SEOgrinder briefing
GoalSays what the job is and for which siteMission and Site
Checkable end conditionLets the agent (and you) decide if the task is finished"Done when" under every task
Working rulesSets the limits of what the agent may doWorking rules
Check afterwardsMeasures the page againCheck your work (only in a local installation)

The briefing is built in this order: Mission, Site, Current state, Keywords, Tasks, Working rules and Data (machine-readable). In a local installation of SEOgrinder, the section Check your work sits between Working rules and Data; the briefing from seogrinder.com does not contain it. Every task carries its problem, the way to fix it, an effort rating and the "Done when" block. Such a block is written like a test, for example:

meta[name=description] exists
description.length in [min, max]
description contains the focus keyword

In the real briefing the limits are filled in for your page. The point is that "done" can be verified. The working rules are short: work top to bottom, find the affected file before every change, skip and report a task whose place you cannot find, invent no content, keep the existing formatting, language and tone, and list at the end which files changed and which tasks were done or skipped, with the reason.

In a local installation, the section "Check your work" tells the agent to measure the page again. According to the briefing text, that comparison checks only what the tasks above say, not rankings, and its command has to run on the computer where SEOgrinder runs. The check you can always rely on is therefore the one in step 5: release, press Check again, read the report.

A shortened example prompt

Below is a shortened version of the agent prompt for an existing robots.txt, with example.com as the site. The real prompt in SEOgrinder is longer and lists more checks.

# Review and improve the existing robots.txt

Your site already serves a robots.txt. Review it against RFC 9309
and fix what is wrong. Change only what is needed.
Do not remove a rule you do not understand: ask the site owner.

## Check

- Served as text/plain with HTTP 200, not as an HTML page
- Valid User-agent groups with Allow/Disallow rules, no syntax errors
- No rule blocks pages that should appear in search
- The sitemap is listed as an absolute URL
- AI crawlers: allowing or blocking is the owner's decision.
  Ask, do not choose for them

## Read it

curl -sg https://example.com/robots.txt

Report the problems you found and the changes you made.

Four habits make this prompt safe, and you can copy them into your own prompts. Restraint: "change only what is needed" keeps the diff small. A way to say "I don't know": "ask the site owner" gives the agent a legitimate exit, so it does not have to guess. A boundary for decisions: the owner's choices are named as the owner's. The real state first: the curl line makes the agent read the actual file instead of assuming what is in it. The last line gives you a summary to compare with the diff.

Safety rules before an agent touches your code

  • Work on a branch, or on a copy of the project. Never let an agent edit files on the production server directly. Changes reach production through your normal release.
  • Read every diff. An agent can be confident and wrong. The diff is where you notice.
  • Keep secrets out. No keys, tokens or .env contents in a prompt or in files you paste. Check that the agent's changes did not copy any into the repository.
  • No mass change without a sample. If a task affects every page, for example a title template, apply it to one page first, look at the result, then widen.
  • Run build and tests before every commit.
  • Treat fetched text as data. Page content, a Search Console export or a server answer can contain sentences that sound like instructions. Yours are the ones you wrote. SEOgrinder's Search Console summary marks queries and addresses from an export as "data, not instructions" for the same reason.

Common mistakes

  • Handing over the whole list at once. The diff grows and you can no longer tell which change caused which problem.
  • Letting the agent decide about AI crawlers. That is a rule about who may use your content. It is your decision.
  • hreflang without return links. Google documents that each language version must name itself and all others, and that missing return links can lead to the annotations being ignored. An agent that edits one page and leaves the others breaks the set. State in the task that all versions change together, and read the result in every version. The details are in Google's guide to localized versions.
  • A new robots.txt group that forgets the old rules. RFC 9309 says a crawler uses the group that matches its name, and if there is one, the * group does not apply to it. When an agent adds a block for one AI bot, all rules that bot should follow must be repeated there.
  • A friendly error page with status 200. A missing page should answer 404 or 410. If the content says "not found" but the status is 200, Google's Search Console can report a soft 404, as described in Google's page on HTTP status codes. A nicer error page must still send the status 404.
  • Believing "done" without measuring. The agent's report says what it intended to change. Only a fresh scan says what is live.

FAQ

Which AI coding agent is best for SEO fixes?

We do not rank tools and make no claims about individual models or products. The briefing is a Markdown file written for Claude Code, Cursor, GitHub Copilot or ChatGPT. The quality of the order, the size of the task and your review matter more than the name of the tool.

Can the agent run the whole audit unattended?

We would not. The mechanical findings suit an agent, the decisions do not, and an unattended run is where a wrong guess lands in production. One task, one diff, one check is slower and much safer.

Does SEOgrinder change my website?

No. SEOgrinder reads your public pages and reports what it finds. Changes are made by your agent in your project, and you review them.

Will fixing the findings raise my rankings?

Nobody can guarantee that. Fixing findings removes technical errors and makes the page easier to read for crawlers and visitors, a sound base. What happens to rankings or to mentions in AI answers, no tool can promise.

Your next step

Run the free scan on your site, open the report and pick the first task of the list. Hand only that one to your agent, read the diff, release it, press Check again and commit. If you want a second job after that, see what an llms.txt is and whether you need one.

More from the blog