mcpbeat Sign in

Configure Factory Rules Agent Skill

Configure typed Mastra Factory rules and exact-leaf overrides in deployment code

881 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
26898
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/mastra-ai/mastra --skill configure-factory-rules

What it tells the agent to use

found in the instruction text
Write writes files

The instruction itself

7 sections, as written by the author

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

  • Search for new MastraFactory, defaultFactoryRules, and the rules property.
  • Read the existing rule configuration and its tests before editing.
  • Import rule helpers and types from the same local Factory module used by the deployment.
  • If the deployment doesn't configure rules, start with defaultFactoryRules({ version, overrides }) and pass the result to MastraFactory.

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

Preserve the public shape

Use one rules tree:

  • work.<stage>.<source>.onEnter or onExit
  • review.<stage>.<source>.onEnter or onExit
  • tools.<toolName>.onResult
  • github.<event>.onEvent

Do not create an actions config or execute authoritative policy in React. Each handler returns one typed FactoryRuleDecision or undefined.

Work and Review cards move independently. Never mirror their stages or mark Work Done only because a pull request merged.

Apply exact-leaf overrides

An override replaces the exact handler leaf. It does not compose with the built-in handler at that leaf. Sibling leaves remain unchanged.

Before replacing a built-in leaf:

  • Read the built-in handler in src/web/factory/rules/defaults.ts.
  • Decide whether the replacement must preserve part of that behavior explicitly.
  • Use only fields exposed by the typed context. Do not reach into Factory storage or raw webhook payloads.
  • Return undefined to allow the ingress with no decision, or return a typed rejection or bounded structured decision.
  • Give every effect decision a stable idempotencyKey derived from immutable ingress identity.

Version changes

Set an explicit, deployment-owned version. Change it whenever rule behavior changes. The version identifies persisted evaluations and audit records; it must not be used as event identity or added to ingress deduplication keys.

Safety rules

  • Keep handler work within the five-second evaluation budget.
  • Treat rule callbacks as trusted deployment code, not repository-provided code.
  • Keep rejection reasons short and safe to persist and display.
  • Never expose credentials, storage handles, worktree paths, or raw webhook payloads to handlers.
  • Trust GitHub actors only after server-side permission resolution. Only write and admin are trusted; failures are untrusted.
  • Request follow-up transitions through FactoryRuleDecision. Never mutate stage storage directly.
  • Defer skill, message, notification, and linked-item effects. Never execute them inside evaluation.
  • Keep causal transitions bounded and include a stable idempotency key.

Verify the change

  • Add or update focused tests for the replaced leaf and its unaffected siblings.
  • Test undefined, accepted, and rejected paths when they apply.
  • Run the narrow Factory rule tests and package typecheck.
  • Run the Web build to confirm the skill and deployment output are packaged.
  • Summarize the leaf replaced, behavior retained or removed, version change, and commands run.

Do not weaken tests or bypass the transition service to make a policy work.

Other skills for the same job

different authors, same section of the catalogue
Modal
by christophacham
×3

Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.

17k tokens
Github Workflow Automation
by ComeOnOliver
×3

Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management

9k tokens
Gcloud
by Dicklesworthstone
×2

Google Cloud Platform CLI - manage GCP resources including Compute Engine, Cloud Run, GKE, Cloud Functions, Storage, BigQuery, and more.

2k tokens
Backend Architect
by ComeOnOliver
×2

Expert backend architect specializing in scalable API design, microservices architecture, and distributed systems. Masters REST/GraphQL/gRPC APIs, event-driven architectures, service mesh patterns, and modern backend frameworks. Handles service boundary definition, inter-service communication, resilience patterns, and observability. Use PROACTIVELY when creating new backend services or APIs.

7k tokens
Modal
by ComeOnOliver
×2

Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.

37k tokens
Aspire
by github
vendor ×1

Aspire skill covering the Aspire CLI, AppHost orchestration, service discovery, integrations, MCP server, VS Code extension, Dev Containers, GitHub Codespaces, templates, dashboard, and deployment. Use when the user asks to create, run, debug, configure, deploy, or troubleshoot an Aspire distributed application.

21k tokens
Bigquery Pipeline Audit
by github
vendor ×1

Audits Python + BigQuery pipelines for cost safety, idempotency, and production readiness. Returns a structured report with exact patch locations.

1k tokens
Msstore CLI
by github
vendor ×1

Microsoft Store Developer CLI (msstore) for publishing Windows applications to the Microsoft Store. Use when asked to configure Store credentials, list Store apps, check submission status, publish submissions, manage package flights, set up CI/CD for Store publishing, or integrate with Partner Center. Supports Windows App SDK/WinUI, UWP, .NET MAUI, Flutter, Electron, React Native, and PWA applications.

4k tokens

How to use it

Copy the folder

Take mastra-ai/configure-factory-rules from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.