# The AI Workflow

## The AI Workflow

**Skill level:** Beginner · **Time:** 5 minutes to set up

The same loop works for every change: **save a checkpoint, ask, review, check, then keep or undo.**

<Tabs>
  <TabItem label="AI editors and agents">

    For Cursor, Windsurf, Claude Code, GitHub Copilot in VS Code, Gemini CLI, Codex, and similar tools.

    <Steps>

    1. **Open the whole Covena project folder** in the tool (the folder with `package.json` and `AGENTS.md`), not a single file or the unzipped download around it. The tool needs that folder to find `AGENTS.md` and its own rules file.

    2. **Start the site** with `npm run dev` so you can watch the change happen at [http://localhost:4321/](http://localhost:4321/).

    3. **Save a checkpoint.** If you use git, commit. If not, copy the folder. See [Editing Safely](/covena/beginner/editing-safely/).

    4. **Ask for one change.** Name the file if you know it. Start your first request with "Read AGENTS.md first." Most tools load it on their own, and the sentence costs nothing in the others. For a bigger job, add "Follow the matching recipe in SKILLS.md." The [Prompt Library](/covena/ai-customization/prompt-library/) has ready-made requests.

    5. **Review what changed.** Every tool shows a list of edited files and the changes (the "diff"). Check them against the review checklist below before you accept.

    6. **Check the result** in the browser. `npm run dev` picks up a saved change to `config.toml` on its own. Restart it after you change languages, the site URL, or `trailingSlash`. Ask the assistant to run `npm run astro-check`, or run it yourself.

    7. **Keep it or undo it.** Commit if you're happy. If not, ask the tool to revert, or restore your checkpoint.

    </Steps>

  </TabItem>
  <TabItem label="Chat assistants">

    For ChatGPT, Claude, Gemini, or any assistant in a browser tab.

    <Steps>

    1. **Give it the rules once per conversation.** Open `AGENTS.md` in your editor, copy all of it, and paste it with: "These are the rules of the website theme I'm editing. Follow them in every answer."

    2. **Paste the file you want to change**, with its path. For example: "Here is `src/content/practice-areas/english/employment.md`:" and the whole file.

    3. **Ask for the change and the full file back**: "Return the complete file, ready to paste, and change nothing else."

    4. **Paste the answer over the file** in your editor and save.

    5. **Check the result** in the browser. If the terminal shows an error, copy the error and paste it back into the chat.

    </Steps>

    Chat assistants work best for text: rewriting a practice area page, an attorney profile, or an insights post, or translating one. A change that touches several files, such as a new attorney (an entry in each language folder plus links from practice areas), is much less copying in an AI editor.

  </TabItem>
</Tabs>

### Give The AI Good Context
The more precise the request, the better the result. Useful things to include:

- **The file.** "Edit `src/content/fees/english/-index.md`", not "edit the fees".
- **The page.** "The section under the hero on `/home-corporate/`."
- **Your firm.** One paragraph: what law you practise, for whom, where your offices are, and how you charge. Paste it into every copywriting request.
- **Your real facts.** Names, qualifications and admission years of your lawyers, office addresses, phone numbers, fees, your regulator and number. If you don't give them, tell the assistant to keep the sample values and list them for you to replace.
- **The block name.** Each homepage file lists its blocks in a comment at the top, such as `heroPortraitNavy` or `contactSplitForm`. Name the block to change a section on one page only.
- **What must not change.** "Keep every key, slug, and the number of items." Slugs such as `family-law` or `daniel-mercer` link files together: an attorney's `practiceAreas` and `office`, a result's `practice` and `attorneys`, and the menus all point at them.

### Review Checklist
Before you accept a change, check:

- [ ] Only the files you expected were edited.
- [ ] Text was changed in `src/content/`, `src/config/`, or `src/i18n/`, not typed into a component.
- [ ] Every language was updated: the `english`, `french`, and `arabic` folders, each `src/i18n/<lang>.json`, and each `src/config/menu.<lang>.json` (unless you removed a language).
- [ ] Internal links have no language prefix: `/fees/`, not `/fr/fees/`.
- [ ] Keys, slugs, and indentation in frontmatter, TOML, and JSON still look like the rest of the file.
- [ ] No new hex colours like `text-[#123456]` in components. Covena uses its tokens (`bg-navy`, `text-ink`, `bg-bronze`).
- [ ] No results, reviews, ratings, client names, awards, qualifications, or fees were made up. Where you didn't provide them, the assistant kept the sample items and told you which ones to replace.
- [ ] The results disclaimer still shows on `/results/` and on each result page.
- [ ] `npm run astro-check` reports no errors.
- [ ] The changed pages look right in the browser:
  - at about **375 px** wide (open the mobile menu too) and at **1280 px**
  - in **every language**: put `/fr/` or `/ar/` in front of the path. Arabic pages read right to left

`astro-check` checks the collections that have a schema, page blocks included. It doesn't catch a misspelled option in a section file, and a block with a wrong name is ignored without an error. Only the page shows those mistakes.

For a bigger change, `npm run verify` runs every check the theme has, including the build and a search for broken links and links that leave their language.

### When The AI Gets Stuck
- **There is an error in the terminal.** Copy the whole error, including the file name and line number, and paste it with: "Fix this error. Explain the cause in one sentence."
- **The change does nothing.** Ask: "Which file does this text come from on this page? Check the page file in src/pages/[...lang]/, the page's named block, and the section file." A page block wins over the section file (see [How Covena Works](/covena/getting-started/how-covena-works/)). If the change is in `config.toml` and the terminal printed no `Generated` line, restart `npm run dev`.
- **It changed the wrong language, or only English.** Ask it to repeat the change in the `french` and `arabic` folders, then check `/fr/` and `/ar/`.
- **It keeps going in circles.** Undo to your checkpoint, start a new conversation, and ask for a smaller step.

<Aside type="caution">
  Never paste passwords, API keys, or client data into an AI chat. Covena
  doesn't need any to be customized: the form endpoint and the Mailchimp URL
  are public values.
</Aside>