farmfe-guide
farm-fe/farm/skills/farmfe-guide/SKILL.md
Comprehensive Farm build-tool reference for AI agents. Use when writing or reviewing farm.config.ts, adding/configuring plugins, troubleshooting builds, implementing SSR or library mode, using the JavaScript API, writing Farm JS/Rust plugins, or authoring custom plugins from scratch. Covers all config options, official plugins, CLI commands, key features, and plugin authoring sourced from website/docs.
Skill5.6k starsChanged 5 months ago
What's in it
- Farm Build Tool — Agent Guide
- Reference Index
- Quick Orientation
- Create a Project
- Minimal Config
- Key Rules
- Dev/Prod Defaults
---
name: farmfe-guide
description: >
Comprehensive Farm build-tool reference for AI agents. Use when writing or reviewing farm.config.ts,
adding/configuring plugins, troubleshooting builds, implementing SSR or library mode, using the
JavaScript API, writing Farm JS/Rust plugins, or authoring custom plugins from scratch. Covers all
config options, official plugins, CLI commands, key features, and plugin authoring sourced from
website/docs.
license: MIT
compatibility: Farm ≥ 1.x. Node 16.18.0+. Uses pnpm as package manager.
metadata:
author: farm
version: "1.2"
references:
- skills/farmfe-guide/references/config.md
- skills/farmfe-guide/references/cli.md
- skills/farmfe-guide/references/plugins.md
- skills/farmfe-guide/references/features.md
- skills/farmfe-guide/references/javascript-api.md
- skills/farmfe-guide/references/js-plugin-api.md
- skills/farmfe-guide/references/writing-plugins.md
- skills/farmfe-guide/references/recipes.md
---
# Farm Build Tool — Agent Guide
Farm is an extremely fast Vite-compatible web build tool written in Rust.
Official site: https://farmfe.org | Package: `@farmfe/core` | Repo: `farm-fe/farm`
---
## Reference Index
Detailed documentation is split into focused reference files under `references/`:
| File | Contents |
|------|----------|
| [`references/config.md`](references/config.md) | Config file setup, shared options, all `compilation.*` options, all `server.*` options |
| [`references/cli.md`](references/cli.md) | CLI commands (`start`, `build`, `watch`, `preview`, `clean`) and all flags |
| [`references/plugins.md`](references/plugins.md) | Using plugins (Rust, JS, Vite/Rollup, SWC, Runtime) + official plugins table |
| [`references/features.md`](references/features.md) | Quick start, CSS, TypeScript/JSX, env vars, assets, library mode, SSR, HMR, lazy compilation, persistent cache |
| [`references/javascript-api.md`](references/javascript-api.md) | `@farmfe/core` JS API — `start/build/watch/preview/clean`, `Compiler`, `Server`, `loadEnv` |
| [`references/js-plugin-api.md`](references/js-plugin-api.md) | Writing JS plugins — all hooks, `filters` structure, code examples |
| [`references/writing-plugins.md`](references/writing-plugins.md) | **Authoring custom plugins** — scaffolding, JS plugin structure, Rust plugin structure, hooks, publishing |
| [`references/recipes.md`](references/recipes.md) | Common patterns, framework quick-configs (React/Vue/Svelte/Electron), troubleshooting |
---
## Quick Orientation
### Create a Project
```bash
pnpm create farm@latest
# or with a template:
pnpm create farm my-app --template react
```
Templates: `vanilla`, `react`, `vue3`, `vue2`, `svelte`, `solid`, `preact`, `lit`, `nestjs`, `tauri`, `electron`.
### Minimal Config
```ts title="farm.config.ts"
import { defineConfig } from '@farmfe/core';
export default defineConfig({
plugins: ['@farmfe/plugin-react'], // Rust plugin by package name
compilation: {
input: { index: './index.html' },
output: { targetEnv: 'browser-es2017' },
},
server: { port: 9000 },
});
```
### Key Rules
- Config file: `farm.config.ts|js|mjs` — do **not** use `__dirname`/`__filename`; use `import.meta.url`.
- Rust plugins → `plugins: ['package-name']` or `['package-name', optionsObject]`.
- Vite/Rollup plugins → `vitePlugins: [plugin()]`, **not** `plugins`.
- JS plugin hooks **must** declare `filters` (regex arrays) for performance.
- `resolve.symlinks: true` is required when using pnpm.
- `targetEnv: 'library'` enables library mode with `format: ['esm', 'cjs']` array support.
### Dev/Prod Defaults
| Option | Development | Production |
|--------|:-----------:|:----------:|
| `lazyCompilation` | ✅ enabled | ❌ disabled |
| `persistentCache` | ✅ enabled | ✅ enabled |
| `minify` | ❌ disabled | ✅ enabled |
| `treeShaking` | ❌ disabled | ✅ enabled |
| `presetEnv` | ❌ disabled | ✅ enabled |
| `css.transformToScript` | ✅ enabled | ❌ disabled |
More agent context in farm-fe/farm
53 other files this repository gives its agents.
AGENTS.md
CLAUDE.md
Skill
- a5c-ai-docusaurus.agents/skills/a5c-ai-docusaurus/SKILL.md
- agent-browser.agents/skills/agent-browser/SKILL.md
- brainstorming.agents/skills/brainstorming/SKILL.md
- building-farm-from-source.agents/skills/building-farm-from-source/SKILL.md
- creating-changesets.agents/skills/creating-changesets/SKILL.md
- dispatching-parallel-agents.agents/skills/dispatching-parallel-agents/SKILL.md
- executing-plans.agents/skills/executing-plans/SKILL.md
- farm-ready-gate.agents/skills/farm-ready-gate/SKILL.md
- find-skills.agents/skills/find-skills/SKILL.md
- finishing-a-development-branch.agents/skills/finishing-a-development-branch/SKILL.md
- git-commit-push.agents/skills/git-commit-push/SKILL.md
- rebase-commit-push-pr.agents/skills/rebase-commit-push-pr/SKILL.md
- receiving-code-review.agents/skills/receiving-code-review/SKILL.md
- requesting-code-review.agents/skills/requesting-code-review/SKILL.md
- rust-best-practices.agents/skills/rust-best-practices/SKILL.md
- rust-engineer.agents/skills/rust-engineer/SKILL.md
- self-improving-agent.agents/skills/self-improving-agent/SKILL.md
- subagent-driven-development.agents/skills/subagent-driven-development/SKILL.md
- systematic-debugging.agents/skills/systematic-debugging/SKILL.md
- test-driven-development.agents/skills/test-driven-development/SKILL.md
- using-git-worktrees.agents/skills/using-git-worktrees/SKILL.md
- using-superpowers.agents/skills/using-superpowers/SKILL.md
- verification-before-completion.agents/skills/verification-before-completion/SKILL.md
- writing-plans.agents/skills/writing-plans/SKILL.md
- writing-skills.agents/skills/writing-skills/SKILL.md
- a5c-ai-docusaurus.claude/skills/a5c-ai-docusaurus/SKILL.md
- agent-browser.claude/skills/agent-browser/SKILL.md
- brainstorming.claude/skills/brainstorming/SKILL.md
- creating-changesets.claude/skills/creating-changesets/SKILL.md
- dispatching-parallel-agents.claude/skills/dispatching-parallel-agents/SKILL.md
- executing-plans.claude/skills/executing-plans/SKILL.md
- farm-ready-gate.claude/skills/farm-ready-gate/SKILL.md
- find-skills.claude/skills/find-skills/SKILL.md
- finishing-a-development-branch.claude/skills/finishing-a-development-branch/SKILL.md
- gh-cli.claude/skills/gh-cli/SKILL.md
- git-commit-push.claude/skills/git-commit-push/SKILL.md
- rebase-commit-push-pr.claude/skills/rebase-commit-push-pr/SKILL.md
- receiving-code-review.claude/skills/receiving-code-review/SKILL.md
- requesting-code-review.claude/skills/requesting-code-review/SKILL.md
- rust-best-practices.claude/skills/rust-best-practices/SKILL.md
- rust-engineer.claude/skills/rust-engineer/SKILL.md
- self-improving-agent.claude/skills/self-improving-agent/SKILL.md
- subagent-driven-development.claude/skills/subagent-driven-development/SKILL.md
- systematic-debugging.claude/skills/systematic-debugging/SKILL.md
- test-driven-development.claude/skills/test-driven-development/SKILL.md
- using-git-worktrees.claude/skills/using-git-worktrees/SKILL.md
- using-superpowers.claude/skills/using-superpowers/SKILL.md
- verification-before-completion.claude/skills/verification-before-completion/SKILL.md
- writing-plans.claude/skills/writing-plans/SKILL.md
- writing-skills.claude/skills/writing-skills/SKILL.md
- e2e-example-acceptance.github/skills/e2e-example-acceptance/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

