Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.frontic.com/llms.txt

Use this file to discover all available pages before exploring further.

The Frontic CLI is how you work against your Frontic project from the command line. Two main jobs: generate the typed Client SDK for your frontend code, and sync your Context Base (skills + rules) into your repository so your editor’s AI agent can read them. This page covers the editor-workflow use of the CLI — how and when to use each command. For the complete per-command reference (all flags, all options), see the Frontic CLI reference.

Install and log in

npm install -g @frontic/cli
frontic login
frontic project
frontic login opens a browser to authenticate. frontic project shows you a picker to select which Frontic project you’re working against. Both commands persist their state in a .frontic-local/ directory at your project root. The frontic tab assumes a one-time global install; the other tabs use each package manager’s one-off runner so no install is needed.

Work with your project API

The frontic generate command pulls the current state of your project’s API — every block, listing, and page — and writes a typed JavaScript client into a .frontic/ directory in your project:
frontic generate
# CLI prompts for the environment to target (develop / preview / public)
# Or pass --env to skip the prompt:
frontic generate --env develop
Output: .frontic/generated-client.js, .frontic/generated-types.d.ts, and a few supporting files. Import the client in your frontend code — every block, listing, and page in your project becomes a typed method:
import client from './.frontic/generated-client';

const { data: product } = await client.block('ProductCard', 'my-product-key');
const { items } = await client.listing('ProductListing', { categoryId: 'shoes' });
See the Client SDK reference for the full method surface (blocks, listings, pages, search) and the Nuxt module reference for the composable API. The generated client reflects your project’s current state at the moment you ran frontic generate. If the stack changes — new block, renamed field, adjusted listing filter — regenerate with the same command and commit the updated files. They’re the contract between your frontend code and your Frontic project at that specific revision.
If you’re working against a preview release, run frontic generate --env preview to target the active preview. The CLI embeds its version token in the generated files, so the preview deploy built from your PR talks to the preview snapshot, not public. Without the --env flag, the CLI prompts you to pick an environment.

Sync your Context Base

Your Context Base lives in Frontic — Skills and Rules you’ve defined for your project. To make them available to your editor’s AI agent (Claude Code, Cursor), the CLI can sync them into your repository as files the agent reads on every session.
frontic context init
One shot: pulls Skills and Rules from your Frontic project’s Context Base and writes them into your repo.

What gets written where

Default layout for Claude Code:
.claude/
  CLAUDE.md              # Project Rules — monolithic, always applied
  rules/
    <rule-name>.md       # one file per Context Rule, optionally scoped by applyTo
  skills/
    <skill-name>/
      SKILL.md           # skill content
      <attached-files>   # any files attached to the skill
For Cursor, pass --agent cursor:
frontic context init --agent cursor
.cursor/
  rules/
    project-rules.md     # project-wide rules
    <rule-name>.md       # one file per rule
  skills/
    <skill-name>/
      SKILL.md
      <attached-files>
The Context Base content is the same — only the paths differ to match each editor’s conventions.

Running it safely

By default, frontic context init skips files that haven’t changed. Running it repeatedly is safe — it only writes what’s new or updated. If you want to force-overwrite everything, use --force:
frontic context init --force
Use --force when you’ve edited local files by hand and want to reset them back to the canonical versions from Frontic.

Syncing Skills or Rules independently

Two subcommands let you sync one collection at a time instead of running the full init:
frontic context skills       # skills only
frontic context rules        # rules only
Same --agent and --output options apply. Useful when you know only one side of the Context Base has changed and you don’t need a full sync.

Checking in the synced files

The synced files are the authoritative copy for your editor. Check them into git so everyone on the team gets the same Context Base when they clone the repo — and so your CI and other developers can see what rules the agents are reading. The files are safe to commit: they’re generated from Frontic but they’re intentionally stable, and re-running frontic context init without --force won’t touch unchanged files.

Other commands

The CLI also provides:
  • frontic mcp init --client <client> — wire up the Frontic MCP servers in your editor’s config in one command (Cursor, Claude Code, Windsurf, VS Code, Codex). See MCP Tools.
  • frontic info — show the current org/project/user you’re authenticated as
  • frontic login / frontic logout — session management; login --token <token> for non-interactive login in CI/CD
  • frontic project — switch between projects
Full per-command details with all flags are in the Frontic CLI reference.

Project Context

What the CLI is syncing, conceptually.

Frontic CLI reference

Complete per-command reference with all flags and options.

MCP Tools

Connect Claude Code or Cursor to Frontic for agent-driven project work.