Build with AI
AI editors and coding agents often guess wrong about sitelo — they reach for React, Next, or Astro patterns that don’t apply. This guide shows how to point them at current sitelo docs and keep generated code on-model.
llms.txt
sitelo publishes a machine-readable summary of the framework at sitelo.js.org/llms.txt. Many agents can fetch a URL; ask yours to read that file (and the human docs) before writing sitelo code.
- https://sitelo.js.org/llms.txt — compact API and conventions
- https://sitelo.js.org/docs — full guides
- GitHub README — mental model and feature overview
- https://ht.js.org —
javascript-to-htmldocs (recommended for writing HTML in JS)
Unlike a docs MCP server, llms.txt needs no install — paste the URL into the chat, add it to project rules, or let the agent fetch it.
Project rules
If your tool supports persistent instructions (AGENTS.md, Cursor rules, Copilot instructions, …), add a short sitelo rule so every session starts with the right mental model. The basic example includes an AGENTS.md you can copy:
# sitelo
This project uses [sitelo](https://sitelo.js.org) — a Vite-powered static site generator.
## Rules
- Pages are modules under `src/` with extensions like `.ht.js` / `.ht.ts` / `.ht.jsx` that **export a default function (or string) returning HTML**.
- Do **not** introduce React, Next.js, Astro, or a component/hydration framework unless the user explicitly asks.
- Routing is file-based: `about.ht.js` → `/about`, `[slug].ht.js` → dynamic (use `generateStaticParams` for `sitelo build`).
- Load data with `export async function data(ctx)`. Use `fetchWithCache` from `sitelo` for cached HTTP.
- Only JS/CSS referenced from HTML is bundled into `dist/`. Keep server-only code unreferenced so it never ships.
- Config lives in `sitelo.config.js`. Put Vite options under `vite`.
- Commands: `sitelo` (dev), `sitelo build`, `sitelo preview`.
- For current APIs, read https://sitelo.js.org/llms.txt and https://sitelo.js.org/docs — do not invent APIs from other frameworks.
- Prefer [javascript-to-html](https://ht.js.org) (`ht.js`) for markup: tag functions that return HTML strings. Docs: https://ht.js.org
Cursor
Create .cursor/rules/sitelo.mdc in your project (or paste the same text into Cursor’s project rules UI):
---
description: sitelo static site conventions
alwaysApply: true
---
# sitelo
Pages are `.ht.js` (etc.) modules that return HTML strings — not React/Next/Astro components.
Prefer javascript-to-html (https://ht.js.org) for markup. Use file-based routing, `data()`, and `sitelo build`.
Prefer https://sitelo.js.org/llms.txt for sitelo APIs.
Tips for AI-assisted sitelo work
- Start from a template — ask the agent to scaffold from examples/basic or examples/wordpress instead of inventing a framework.
- Prefer javascript-to-html (
ht.js) for markup — tag functions that return HTML strings, without a templating engine or React. Point agents at ht.js.org so they don’t invent JSX component trees. - Pages are functions that return HTML —
export default () => `<html>…</html>`or compose withjavascript-to-html. JSX is fine when it compiles to strings; a React runtime is not required. - Use sitelo’s CLI —
sitelo/sitelo build— notvitedirectly, unless you know you need a custom Vite config. - Verify APIs against llms.txt — especially
generateStaticParams,fetchWithCache, and experimental server islands. - Zero JS by default — only link a
<script>when the page needs client code; unreferenced modules stay server-only. - Review and run — always
sitelo build(or the dev server) after the agent edits pages; treat generated markup as a draft.