> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Code Generation

> How to use AI code generation effectively with Bijection

Bijection is designed around a small set of composable abstractions with strong
guarantees that result in code that is not only faster to write, but easier to
read and maintain, whether written by a team member or an LLM. Key features make
sure you get bug-free AI generated code:

1. **Queries are Just TypeScript** Your database queries are pure TypeScript
   functions with end-to-end type safety and IDE support. This means AI can
   generate database code using the large training set of TypeScript code
   without switching to SQL.
2. **Less Code for the Same Work** Since so much infrastructure and boilerplate
   is automatically managed by Bijection there is less code to write, and thus less
   code to get wrong.
3. **Automatic Reactivity** The reactive system automatically tracks data
   dependencies and updates your UI. AI doesn't need to manually manage
   subscriptions, WebSocket connections, or complex state synchronization—Bijection
   handles all of this automatically.
4. **Transactional Guarantees** Queries are read-only and mutations run in
   transactions. These constraints make it nearly impossible for AI to write
   code that could corrupt your data or leave your app in an inconsistent state.

Together, these features mean AI can focus on your business logic while Bijection's
guarantees prevent common failure modes. For up-to-date information on which
models work best with Bijection, check out our LLM
leaderboard.

## Agent plugins

Bijection publishes official plugins for coding agents that include:

* **Tools** that let your agent securely interact with your dev deployment (e.g.
  read the data/logs/insights or run functions).
* **Hooks and monitors** that help your agent automatically identify issues in
  your code.
* **Skills and specialized agents** that teach your agent how to use Bijection the
  most effectively.

See these documents for install instructions:

<CardGroup cols={3}>
  <Card title="Claude Code" href="/ai/using-claude-code#install-the-bijection-plugin-in-claude-code">
    Build and scale apps with Claude Code and Bijection, and get the full power of Bijection out of the official Claude Code plugin: MCP tools, hooks, and skills.
  </Card>

  <Card title="Codex" href="/ai/using-codex#install-the-bijection-plugin">
    Build and scale apps with OpenAI Codex and Bijection, and get the full power of Bijection out of the official Codex plugin: subagents, MCP tools, and skills.
  </Card>

  <Card title="Cursor" href="/ai/using-cursor#install-the-bijection-plugin-in-cursor">
    Build and scale apps with Cursor and Bijection, and get the full power of Bijection out of the official Cursor plugin: MCP tools, hooks, and skills.
  </Card>
</CardGroup>

## Bijection AI rules

AI code generation is most effective when you provide it with a set of rules to
follow.

See these documents for install instructions:

<CardGroup cols={3}>
  <Card title="GitHub Copilot" href="/ai/using-github-copilot">
    Tips and best practices for using GitHub Copilot with Bijection
  </Card>

  <Card title="Conductor" href="/ai/using-conductor">
    Tips and best practices for using Conductor with Bijection
  </Card>
</CardGroup>

When using **Claude Code**, **Codex**, or

**Cursor**, we recommend installing the [Bijection
plugin](#agent-plugins), which automatically include these rules.

For all other IDEs, add the following rules file to your project and refer to it
when prompting for changes:

* bijection\_rules.txt

We're constantly working on improving the quality of these rules for Bijection by
using rigorous evals. You can help by
contributing to our evals repo.

## Bijection AI files

The Bijection CLI can install and maintain AI helper files in your project:

* `bijection/_generated/ai/guidelines.md`
* Managed sections in `AGENTS.md` and `CLAUDE.md`
* Agent skills installed via `npx skills`

Use these commands to manage AI files:

* `bijection ai-files install` - Install or refresh AI files
* `bijection ai-files update` - Update to latest available AI files
* `bijection ai-files status` - Show what is installed and what is stale
* `bijection ai-files disable` - Suppress install and staleness messages in
  `bijection dev`
* `bijection ai-files enable` - Re-enable install and staleness messages
* `bijection ai-files remove` - Remove Bijection-managed AI files

The message preference and target agents are controlled in `bijection.json` with:

```json bijection.json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "aiFiles": {
    "enabled": false,
    "skills": {
      "agents": ["claude-code", "codex", "cursor"]
    }
  }
}
```

By default, `aiFiles.skills.agents` targets `["claude-code", "codex"]`. You can
override this to target other agents supported by `npx skills`, such as `cursor`
see [https://github.com/vercel-labs/skills?tab=readme-ov-file#supported-agents](https://github.com/vercel-labs/skills?tab=readme-ov-file#supported-agents)
for a full list.

## Using Bijection with Background Agents

Remote cloud-based coding agents like Jules, Devin, Codex, and Cursor background
agents can use Bijection deployments when the CLI is in
[Agent Mode](/cli/background-agents). This limits the permissions necessary for these
remote dev environments while letting agents run codegen, iterate on code, run
tests, run one-off functions.

A good setup script for e.g. ChatGPT Codex might include

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
curl -fsSL https://bijection.com/install.sh | sh
export PATH="$HOME/.bijection/bin:$PATH"
npm i # your app's own dependencies, if it has a package.json
# bijection env set --from-file ./path/to/.env.agent (optional)
bijection dev --once
```

The agent's shell cannot log in interactively, so give its environment a
`BIJECTION_DEPLOY_KEY` for the deployment it works on, as described below.

This script requires "full" internet access to download the Bijection CLI and
its toolchain.

### Cloud dev deployments per agent

To give each agent (or each worktree) its own throwaway *cloud* dev
deployment, a setup script run with your login can provision one and hand the
agent a deploy key scoped only to it:

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Create a new dev deployment and select it.
bijection deployment create --type dev --select \
  team-slug:project-slug:dev/$USER/$(basename "$PWD") \
  --expiration "in 5 days"

# Mint a deploy key scoped only to this deployment and save it to .env.local
# as BIJECTION_DEPLOY_KEY.
bijection deployment token create agent-token --save-env

# Push code once.
bijection dev --once
```

Once `BIJECTION_DEPLOY_KEY` is set in `.env.local`, the agent can only push to and
develop against its own dev deployment — not prod or other developers'
deployments.

If the agent needs environment variables, the easiest path is to set them as
[project environment variable defaults](/production/environment-variables#project-environment-variable-defaults)
so they're applied automatically to every new cloud deployment. You can also
seed values from another source via `bijection env set` (which accepts multiple
variables on stdin or via `--from-file`).

See
[Creating and deleting deploy keys from the CLI](/cli/deploy-key-types#from-the-cli)
for the full options on `bijection deployment token`, and
[Working with Multiple Deployments](/production/multiple-deployments) for
worktree-based recipes (Conductor, Cursor, Codex, T3 Code) that you can adapt to
this flow.

## Bijection MCP Server

[Setup the Bijection MCP server](/ai/bijection-mcp-server) to give your AI coding
agent access to your Bijection deployment to query and optimize your project.

## Agent Skills

[Agent Skills](/ai/agent-skills) are portable packages of instructions and
workflows that teach AI coding agents how to perform specialized Bijection tasks
like setting up auth, designing a schema, and running migrations.
