# Term setup for teachers

> A space per class with the students in it, and a term plan written by Mida from a saved skill.

Source: https://mockflow.com/developers/examples/api/class-setup

A teacher, or a school's IT team, sets up the same things at the start of every term: a place for each class, the students added, and a term plan. This example does it for every class in one run. A saved skill gives Mida the school's planning format, so every class's plan has the same shape: outcomes, a heading per week with activities and a check for understanding, then an assessment idea.

[**Download the code**](/developers/assets/examples/mockflow-class-setup.zip) (Node.js 18 or later, no packages)

## What it creates

- A **Term plan** skill in the workspace, made on the first run and reused after that.
- A space for each class, such as "Year 9 Geography, Spring 2027", with co-teachers as admins and students as editors.
- In each space, a **Term plan** board written by Mida with the skill, and an empty **Class wall** board for the students' work.

## How it works

1. [Create the skill](/developers/reference/skills/create-skill) once with `POST /skills`: a name, an `outputType`, and the `systemPrompt` Mida follows. Its id is kept in `state.json`.
2. For each class, [create a space](/developers/reference/spaces/create-space) and [add the people](/developers/reference/spaces/add-space-member) with their roles.
3. [Create the board](/developers/reference/boards/create-board) and [apply the skill](/developers/reference/skills/apply-skill) with `POST /boards/{boardId}/skills/{skillId}/apply` and a short prompt: the class, the topic and the number of weeks.
4. Wait for the [job](/developers/reference/jobs/get-job), then move on to the next class.

## Run the example

Create an API key in the [developer console](/developers/console/) with the scopes `user:read`, `boards:write`, `members:write` and `ai:generate`, then:

```bash
cp .env.example .env        # paste your key into .env
node setup-term.js classes.json
```

Put real classes and emails in `classes.json` first: everyone listed gets an invitation email.

## The key code

```javascript
const skill = await mf.post('/skills', {
  name: 'Term plan',
  outputType: 'markdown',
  category: 'planning',
  systemPrompt: 'Write a term plan for a school class. Start with three to five learning outcomes. ...',
});

const board = await mf.post('/boards', { title: 'Term plan', spaceId: space.id });
const job = await mf.post(`/boards/${board.id}/skills/${skill.id}/apply`, {
  prompt: `${cls.name}. Topic: ${cls.topic}. ${cls.weeks} weeks.`,
});
await mf.waitForJob(job);
```

## Adapt it

- **Training teams:** a space per cohort, with a course plan written from the same skill.
- **Clubs and coaching:** a season plan per team.
- **Universities:** a module space per seminar group, with a reading plan.

## What you need

An API key with `user:read`, `boards:write`, `members:write` and `ai:generate`. Plus or Max: skills, generation and extra spaces are not available on Basic. Each plan uses AI credits.
