Skip to main content

AI Tooling

5 min read

IDE Integration

Install Directive's coding knowledge into your AI assistant so generated code is idiomatic on the first try. One source of truth (@directive-run/knowledge), five install paths.


Which path?

Pick the row that matches your setup. Each path ends with a clickable section below.

You are…Install withSection
Using Claude Code/plugin marketplace add directive-run/directive then /plugin install directive@directive-pluginsClaude Code
Using Cursor, Copilot, Windsurf, Cline, or OpenAI Codexnpx directive ai-rules initCLI ai-rules
Building a tool that consumes Directive knowledgenpm install @directive-run/knowledge + getKnowledge()Knowledge package
Building an LLM agent that crawls docs at runtimePoint at https://directive.run/llms.txtllms.txt
Just evaluating Directive against alternativesRead the comparison page/docs/comparison
Not sure which?Pick the Claude Code or CLI ai-rules row that matches your editor

Two audiences, one disambiguation

This page is about AI tools that consume Directive's coding knowledge — plugins, rules files, and APIs that ship knowledge into your IDE so generated code is correct.

It is not about Directive's AI orchestrator package (@directive-run/ai) — that lets you build AI agents and multi-agent systems using Directive's constraint model. For that, see /ai/overview.


Claude Code

Two commands in a Claude Code session:

/plugin marketplace add directive-run/directive
/plugin install directive@directive-plugins

The first command registers the directive-plugins marketplace from the directive-run/directive GitHub repo. The second installs the directive plugin from that marketplace.

After install, verify the plugin is active:

/plugins

You should see directive in the list.

What you get

Twelve model-invoked skills. Claude reads each skill's description and auto-loads the relevant one when your task matches — there is nothing to invoke manually. You write code, Claude pulls in the right skill.

SkillTriggers on
getting-started-with-directiveFirst-time Directive questions, mental model
writing-directive-modules"I need a module that…"
writing-directive-constraints"I need a constraint / resolver…"
building-directive-systemsMulti-module / system-level wiring
testing-directive-codeVitest, createTestSystem, mockResolver
building-ai-orchestrators"I need an AI agent / orchestrator…"
building-ai-agentsStreaming, adapters, communication
hardening-ai-systemsGuardrails, budgets, security
testing-ai-systemsMock runners, evaluations
reviewing-directive-codeCode review, anti-pattern checks
scaffolding-directive-modulesGenerating module scaffolds + tests
migrating-to-directiveMigration from Redux, Zustand, XState, MobX

You can also call a skill directly:

/directive:writing-directive-modules
/directive:writing-directive-constraints
/directive:hardening-ai-systems

What's under the hood

Each skill bundles a concise SKILL.md (decision tree + quick-reference patterns), the relevant .md files from @directive-run/knowledge, and working examples from the examples/ directory. Skills are version-pinned to the Directive release that shipped them; updates land via /plugin marketplace update followed by re-install.


CLI ai-rules

For Cursor, GitHub Copilot, Windsurf, Cline, or OpenAI Codex — generate a tuned rules file in your project root:

npx directive ai-rules init

The CLI detects which AI assistants you have configured (it looks for .cursor/, .github/copilot, .windsurf/, .cline/, AGENTS.md, CLAUDE.md) and writes the right file for each.

Generated files:

FileFor
.cursorrulesCursor (auto-loaded by Cursor on every prompt)
.windsurfrulesWindsurf
.clinerulesCline
copilot-instructions.mdGitHub Copilot Workspace
AGENTS.mdOpenAI Codex
CLAUDE.mdClaude Code (fallback when you don't want the plugin)

Each file is sized to its assistant's ingestion budget (e.g., Cursor's rules cap is smaller than Claude Code's), with Directive's comparison framing at the top so the assistant knows when to reach for Directive vs. Redux / Zustand / XState / React Query.

Regenerate after a Directive version bump:

npx directive ai-rules update

Knowledge package

For tool builders who consume Directive knowledge programmatically — custom AI integrations, doc renderers, eval harnesses, etc.:

npm install @directive-run/knowledge
import { getKnowledge, getExample, getAllKnowledge } from "@directive-run/knowledge";

const patterns = getKnowledge("core-patterns");
const counter = getExample("counter");
const all = getAllKnowledge();

The package ships:

  • 13 core knowledge files (core/constraints.md, core/resolvers.md, etc.)
  • 12 AI knowledge files (ai/ai-orchestrator.md, ai/ai-multi-agent.md, etc.)
  • 37 worked examples (DOM wiring stripped, ready to teach from)
  • An auto-generated api-skeleton.md (~80KB; full public API surface in machine-friendly form)
  • An auto-generated sitemap.md (every docs URL on directive.run)

Source: packages/knowledge.


llms.txt

For LLM agents that crawl docs at runtime (Perplexity-style retrieval, custom RAG pipelines, etc.) — point them at:

https://directive.run/llms.txt

The route bundles a comparison framing, install pathways, the full docs sitemap, and the AI section. An agent doing one-shot retrieval gets a coherent picture without crawling 100+ pages.

The route is regenerated on every docs deploy, so it stays in sync with the current Directive version.


Verifying your install

Whichever path you chose, a quick sanity check:

// Ask your AI assistant to scaffold a Directive module.
// A correct response will:
// 1. Use createModule + createSystem (not defineModule)
// 2. Use the (req, context) resolver signature (not (req, ctx))
// 3. Use t.string() / t.number() / etc. (not raw TS types in the schema block)
// 4. Reference @directive-run/core for the runtime (not @directive-run/main or similar hallucination)

If the response contains hallucinated APIs, the knowledge bundle isn't loaded. Re-install or check the assistant's rules file.


When to use which

  • Claude Code only? Use the plugin. Skills load on demand; nothing in your repo.
  • Mixed team, multiple editors? Use directive ai-rules init — every editor gets a tuned file in version control.
  • Building a tool on top of Directive's knowledge? Use the programmatic API.
  • Want maximum signal in a single LLM context? Point at /llms.txt.

If you're not sure, start with directive ai-rules init — it generates files for every supported editor in one command, so you don't have to choose up front.

Previous
Choosing Primitives

Stay in the loop. Sign up for our newsletter.

We care about your data. We'll never share your email.

Powered by Directive. This signup uses a Directive module with facts, derivations, constraints, and resolvers – zero useState, zero useEffect. Read how it works

Directive - Constraint-Driven Runtime for TypeScript | AI Guardrails & State Management