Documentation

Cursor / AI Agents

How to use Cursor, Claude, and other AI agents with Motoko Base — AGENTS.md, skills, and architecture-aware prompting.

Open inChatGPT (opens in a new tab)Claude (opens in a new tab)Cursor (opens in a new tab)How to use Cursor, Claude, and other AI agents with Motoko Base — AGENTS.md, skills, and architecture-aware prompting.

Motoko Base is built for AI-assisted development. Agents get explicit instructions on where code goes, what patterns to follow, and how to plan changes through OpenSpec — so output matches a real SaaS starter, not a generic Next.js tutorial.

Works with Cursor, Claude Code, and other agents that read project instructions and skills.

Project instructions

Two files define how agents should behave:

FileRole
AGENTS.mdArchitecture placement, patterns to follow/avoid, demo vs core, check commands
openspec/config.yamlProduct philosophy, stack, UI rules, per-artifact rules for OpenSpec

CLAUDE.md points to AGENTS.md for Claude Code. Cursor loads AGENTS.md via workspace rules.

Before any feature work, agents should know:

  • Code goes in src/features/<name>/, not scattered in src/app/
  • Database and auth stay server-side
  • Mutations use Server Actions + Zod + userId ownership
  • Optional integrations soft-fail when env is unset

Skills and slash commands

Motoko Base includes OpenSpec skills the agent loads automatically:

.agents/skills/openspec-propose/
.agents/skills/openspec-apply-change/
.agents/skills/openspec-archive-change/
.agents/skills/openspec-explore/
.agents/skills/openspec-update-change/
.agents/skills/openspec-sync-specs/

In Cursor, matching slash commands live in .cursor/commands/:

CommandUse when
/opsx-exploreExploring ideas — no code
/opsx-proposeStarting a new change
/opsx-updateRevising the plan
/opsx-applyImplementing tasks
/opsx-archiveFinishing a change

Domain skills (Drizzle, Supabase Postgres) live in .agents/skills/ for schema and query work.

Cursor docs: Cursor documentation

How to give good tasks

Frame requests so the agent stays within Motoko architecture:

Do

/opsx-propose Add a notes demo under src/features/notes/
Reuse the links feature pattern: queries.ts, actions.ts, schemas.ts,
ownership via session userId, thin route in src/app/dashboard/notes/
/opsx-apply
Follow AGENTS.md — server-first, Zod at boundary, no new UI libraries
Add a nav item for Notes in src/features/dashboard/config/nav.ts

Avoid

Build a notes app with Redux and a separate API server
Put all logic in src/app/dashboard/notes/page.tsx
Skip auth checks for now, we'll add them later

Useful references to cite

PatternPoint the agent here
CRUD demo featuresrc/features/links/
File uploadssrc/features/storage/
Settings + sessionssrc/features/dashboard/components/settings/
Billing integrationsrc/lib/billing/ + src/features/dashboard/actions/billing.ts
New database tableAdding a New Table
AuthBetter Auth

Say whether work is core infrastructure, a reusable pattern, or a removable demo — agents use that in OpenSpec proposals.

Cursor vs Claude Code

ToolHow Motoko Base hooks in
CursorAGENTS.md rules + /opsx-* commands + .cursor/skills/
Claude CodeCLAUDE.md → AGENTS.md + same OpenSpec CLI/skills
Other agentsRead AGENTS.md, openspec/config.yaml, run openspec CLI manually

Install OpenSpec CLI globally: installation guide

Checks agents should run

AGENTS.md requires these before finishing:

pnpm lint
pnpm typecheck
pnpm test
pnpm build

Ask the agent to run them after /opsx-apply or any substantial edit.

Small fixes without OpenSpec

Typos, copy changes, and one-line bugs do not need a full change proposal. Use normal chat:

Fix the typo on the billing page headline

Use OpenSpec when the change touches multiple files, adds behavior, or needs reviewable requirements.


AI Development Workflow — Full workflow from idea to archive.

OpenSpec — Proposals, tasks, apply, and archive.

Project structure — Where code lives.