Skip to main content

Cursor Plugin Overview

The @a16njs/plugin-cursor package implements agent customization awareness for Cursor.

Installation

This plugin is bundled with the a16n CLI. For programmatic use:

npm install @a16njs/plugin-cursor

Supported Files

Discovery

Emission

  • GlobalPrompt: Cursor Rule with alwaysApply: true
  • FileRule: Cursor Rule with globs: ...
  • SimpleAgentSkill: Cursor Skill
  • AgentSkillIO: Cursor Skill directory (SKILL.md and all ride-along files under scripts/, references/, assets/, etc.)
  • AgentIgnore: .cursorignore entry
  • ManualPrompt: Cursor Agent Skill (.cursor/skills/<name>/SKILL.md with disable-model-invocation: true; legacy Commands discovery supported but non-roundtrip)

Rule Classification Priority

When Cursor Rule frontmatter contains multiple keys, rules are classified by first match:

  1. alwaysApply: true → GlobalPrompt
  2. globs: present → FileRule
  3. description: present → SimpleAgentSkill
  4. No frontmatter → ManualPrompt (fallback)

Programmatic Usage

import cursorPlugin from '@a16njs/plugin-cursor';
import { A16nEngine } from '@a16njs/engine';

// Create engine with Cursor plugin
const engine = new A16nEngine([cursorPlugin]);

// Discover Cursor customizations
const result = await cursorPlugin.discover('./my-project');
console.log(`Found ${result.items.length} rules`);

for (const item of result.items) {
console.log(` ${item.type}: ${item.sourcePath}`);
}

// Emit to Cursor format
const items = [/* AgentCustomization items */];
const emitResult = await cursorPlugin.emit(items, './my-project');
console.log(`Wrote ${emitResult.written.length} files`);

Dry Run

// Calculate what would be written without writing
const emitResult = await cursorPlugin.emit(items, './my-project', {
dryRun: true,
});

for (const file of emitResult.written) {
console.log(`Would write: ${file.path}`);
}

API Reference

For complete plugin API details, see the Plugin Cursor API Reference.


See Also