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
- Cursor Rules:
.cursor/rules/**/*.mdcalwaysApply: true: GlobalPromptglobs: ...: FileRuledescription: "...": SimpleAgentSkill
- Cursor Skills:
.cursor/skills/**/*.md- Simple Skills
disable-model-invocation: true: ManualPrompt- others: SimpleAgentSkill
- Complex Skills (more than one file): Skipped
- Simple Skills
- Cursor Commands:
.cursor/commands/**/*.md- Simple Commands: ManualPrompt
- Complex Commands (placeholders, $ARGUMENTS, $1, etc.): Skipped
- Cursor Ignore:
.cursorignore
Emission
- GlobalPrompt: Cursor Rule with
alwaysApply: true - FileRule: Cursor Rule with
globs: ... - SimpleAgentSkill: Cursor Skill
- AgentIgnore:
.cursorignoreentry - ManualPrompt: Cursor Command
Rule Classification Priority
When Cursor Rule frontmatter contains multiple keys, rules are classified by first match:
alwaysApply: true→ GlobalPromptglobs:present → FileRuledescription:present → AgentSkill- 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
- Plugin Cursor API Reference - Complete API documentation
- Plugin: Claude - Claude Code format plugin
- Understanding Conversions - Conversion details
- Models - Type definitions