# Configure Factory Rules

Configure board-owned lifecycle, policy, phase-semantics, and tool-result rules, plus...

- Repository: https://github.com/mastra-ai/mastra (29259 stars)
- Category: Engineering
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add mastra-ai/mastra --skill configure-factory-rules -g -a claude-code -y`
Codex: `npx skills add mastra-ai/mastra --skill configure-factory-rules -g -a codex -y`
Cursor: `npx skills add mastra-ai/mastra --skill configure-factory-rules -g -a cursor -y`
Gemini CLI: `npx skills add mastra-ai/mastra --skill configure-factory-rules -g -a gemini-cli -y`

## Description

Configure board-owned lifecycle, policy, phase-semantics, and tool-result rules, plus integration event rules

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Configure Factory Rules

Help the user change Factory policy in the typed deployment configuration. Factory rules are trusted server code. Never place deployment policy in this skill, repository instructions, browser code, or a parallel actions system.

## Find the configuration

1. Search for `new MastraFactory`, its `boards` and `includeDefaultBoards` options, `defineBoard`, `configVersion`, and the installed `GithubIntegration`, `PlatformGithubIntegration`, `LinearIntegration`, or `PlatformLinearIntegration` constructors and their `rules` options.
2. Read the existing rule configuration and its tests before editing.
3. Import rule helpers and types from the same local Factory module used by the deployment.
4. For custom-board handlers or phase semantics (`kind`, `role`), edit the installed `defineBoard()` definition. For tool-result rules, add `tools: { <toolName>: { onResult } }` to the installed `defineBoard()` definition of the board whose seat produces the result. For GitHub or Linear rules, configure the installed integration constructor directly.

Do not guess a file path. Factory deployments can assemble `MastraFactory` from different entry points.

## Preserve the public shape

Installed board definitions exclusively own lifecycle handlers: use `phases.<phase>.onEnter.<source>` and `phases.<phase>.onExit.<source>` in `defineBoard()`. Sources are `issue`, `pullRequest`, `linearIssue`, and `manual`. Work and Review install automatically with preferred defaults. Custom boards are installed through `boards`; `includeDefaultBoards: false` supports custom-only installations.

The rest: https://github.com/mastra-ai/mastra/blob/HEAD/mastracode/factory/factory-skills/configure-factory-rules/SKILL.md
