This is a free, MIT-licensed Cursor rules file for building Next.js documentation with an AIML.chat agent — it keeps your AI editor loading the widget the App Router way and structuring content for clean, grounded retrieval. Drop it in .cursorrules and your assistant follows the right patterns.
What these rules do
Next.js App Router has sharp edges for a third-party widget: load it during SSR and you get hydration warnings; commit the key wrong and you leak config or break the build. These rules teach your AI editor to load the AIML.chat embed with the Script component and a client strategy, keep the publishable key in an env var, and write docs pages with clear structure so the agent retrieves them well. The result is a docs app where the widget just works and the content is genuinely answerable.
The rules
# AIML.chat + Next.js (App Router)
- Load the AIML.chat widget with next/script using a client strategy
in the root layout; never during server render.
- Keep the publishable key in NEXT_PUBLIC_AIML_KEY, not hardcoded.
- Segment config like `export const revalidate` must be a literal value.
- Write docs as focused MDX/markdown pages with a clear H1 and H2s.
- Split long pages by topic so they chunk well for retrieval.
- After content changes, remind the user to re-crawl in AIML.chat.
How to use it
Save the block as .cursorrules at the repo root, and your AI assistant applies it whenever it edits the Next.js project. It pairs with the Next.js setup skill for installation and the knowledge base rules for content. The SaaS use case explains the agent these rules support.
Ready to build? Start free, add the widget, and ship AI-ready docs — see pricing for limits.
Will it avoid hydration warnings?+
Yes — the rules load the widget with next/script and a client strategy, so it runs after hydration, not during SSR.
Where do I put the file?+
Save it as .cursorrules at the repo root, and your AI assistant applies it automatically.
Are the rules free?+
Yes — they are MIT-licensed and free to copy. Using the agent counts toward your plan's limits; see pricing.