MainSDK
Search⌘K
How-to

Work with a coding agent

Give Claude Code or another agent the docs, the types, the next action and the fixes for your project, with every write waiting for you.

Planned for 0.4

Status Status is where the work is: Planned (in a milestone, not started), Building (tickets in progress), Preview (usable, may change), then the stability it ships at.

Stability The promise an interface ships with.

  • Stable Follows semantic versioning; breaking changes need a new major, 12 months of overlap and a codemod.
  • Beta Usable in production; may change before it becomes stable.
  • Experimental May change or go away; needs an explicit opt-in in main.yaml.
Stability levels
Updated 2026-10-28

You will give an agent the tools to finish a MainSDK task without guessing. It takes about 10 minutes.

You need

1. Read the docs offline

bash
npx mainsdk help check
npx mainsdk docs --list
npx mainsdk docs mcp

mainsdk help <command> prints usage and examples for a command. mainsdk docs reads the docs bundled with the version you installed, and mainsdk docs mcp serves them to an agent over MCP.

2. Make undeclared names fail

bash
npx mainsdk types

It writes .mainsdk/types/main.d.ts from main.yaml, so a call to something the project never declared fails to type-check.

3. Ask for the next action

bash
npx mainsdk next --json

It prints one action: fix, edit, test, declare, ask a person or done. It exits 1 while there is something to do.

4. Apply a fix

bash
npx mainsdk fix MAIN-NET-0002 --dry-run
npx mainsdk fix --all

--dry-run prints the diff and writes nothing. A fix that widens a grant waits for a person and --allow-widen (MAIN-DEV-0001).

5. Connect the agent

bash
npx mainsdk mcp

The server runs over stdio. Write tools are off until you pass --allow-write; without it the agent gets MAIN-DEV-0003.

Check that it works

  • mainsdk next ends with done after the agent's changes, and mainsdk check passes.

Next

Was this page helpful?

↑↓ moveEnter openEsc close

Not decided yet