Editing Custom Code with AI
Ask an AI agent like Claude to update your custom CSS, JavaScript, and HTML.
Your custom CSS, JavaScript, and HTML can be updated through the ReadMe API, so an AI agent connected to ReadMe's MCP server can make changes for you. Tell it what you want, review the change, and approve it.
These are production changesCustom code is a project setting, so it isn't versioned or synced to Git. There's no branch or review step. Every save goes live on your docs right away, for every reader. Back up your current code before you change anything, or ask your agent to do it.
Paste this instruction into your agent before your first change:
Before you change anything, save a backup of my current custom CSS, JS, and HTML to a local file and tell me where it is.What You Can Change
| Setting | Field in appearance.custom_code | Plan |
|---|---|---|
| Custom CSS | css | Pro, Enterprise |
| Custom JavaScript | js | Enterprise |
HTML in <head> | html.header | Pro, Enterprise |
HTML before </body> | html.page_footer | Pro, Enterprise |
| HTML in the footer on every page | html.home_footer | Enterprise |
If your plan doesn't include a setting, the save still succeeds but nothing changes. Your agent reads the setting back afterward to catch this.
Set Up Your Agent
- Connect your agent to ReadMe's MCP server and install the ReadMe skills. Follow Get Connected for the setup prompt.
- Ask the agent which project it's connected to before you change anything.
Make a Change
Ask your agent something like:
- "Make the header background
#1d4ed8. Keep the CSS that's already there." - "Add
<meta name="example-site-verification" content="abc123">to the head of every page." - "Show me my custom CSS and JavaScript and explain what each part does. Don't change anything."
What happens behind the scenes:
- Confirms the project by reading your current settings.
- Shows the current and proposed code and waits for your approval.
- Saves only the fields you approved.
- Reads the settings back to confirm the change saved.
Check the change on your docs when it's done.
Use the API Directly
Agents use the Update project endpoint, and you can call it yourself. Back up your current code first, then send only the fields you're changing. Each field you send replaces its current value.
The backup command uses jq to save only your custom code. The full response also includes your other project settings, including secrets.
curl https://api.readme.com/v2/projects/me \
--header "Authorization: Bearer <API_KEY>" \
| jq '.data.appearance.custom_code' > custom-code-backup.jsoncurl -X PATCH https://api.readme.com/v2/projects/me \
--header "Authorization: Bearer <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"appearance": {
"custom_code": {
"css": ".rm-Header { background: #1d4ed8; }"
}
}
}'Updated 4 hours ago