---
title: "Work with a coding agent"
description: "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."
section: "guides"
status: "Planned for 0.4"
spec: "agent-experience"
canonical: "https://mainsdk.dev/docs/guides/work-with-a-coding-agent"
updated: "2026-10-28"
---

# 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.

Status: Planned for 0.4 · Canonical: https://mainsdk.dev/docs/guides/work-with-a-coding-agent · 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

- A MainSDK project (see [start a project](https://mainsdk.dev/docs/guides/start-a-project)).
- A coding agent that speaks MCP.

## 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

- [Operate your app with a coding agent](https://mainsdk.dev/docs/guides/operate-your-app-with-an-agent)
- [CLI reference](https://mainsdk.dev/docs/reference/cli)
