Translates markdown rules into AI agent-specific formats using a provider pattern. With production-ready CLI support for extensive customization and custom provider integration. Created and maintained by the fine folks at wild.
This package is not published to NPM. Install directly from the GitHub repository:
# Using HTTPS
npm install git+https://github.com/madebywild/agent-rules.git#main
# For global installation
npm install -g git+https://github.com/madebywild/agent-rules.git#mainπ See INSTALLATION.md for comprehensive installation guide including:
- CI/CD integration examples (GitHub Actions, Docker, Jenkins)
- Troubleshooting common issues
- Install: Run the installation command above
- Verify:
npx agent-rules --version
# Clone and install for local development
git clone https://github.com/madebywild/agent-rules.git
npm install# After installation, use as CLI tool
npx agent-rules --help
npx agent-rules --list-providers
npx agent-rules --dry-run --verbose
# Initialize in a new project (interactive)
npx agent-rules --init
# For local development
npm run translate_rulesThe enhanced CLI provides production-ready functionality with custom provider support:
# Use built-in providers only
npx agent-rules
# Add custom provider
npx agent-rules --provider ./my-provider.js
# Mix custom and built-in providers
npx agent-rules --provider ./my-provider.js --providers cursor,cline
# Advanced usage
npx agent-rules \
--provider ./my-provider.js \
--input ./custom-rules \
--filter "*.md" \
--dry-run \
--verbose
# Interactive initialization
npx agent-rules --initπ See CLI_GUIDE.md for comprehensive CLI documentation and examples.
Add agent-rules to your package.json scripts for easy, repeatable runs:
{
"scripts": {
"rules": "agent-rules",
"rules:dry": "agent-rules --dry-run --verbose",
"rules:cursor": "agent-rules --providers cursor",
"rules:custom": "agent-rules --provider ./tools/my-provider.js --no-builtin",
"rules:ci": "agent-rules --quiet"
}
}Then run with:
npm run rules # generate all built-in outputs
npm run rules:dry # preview without writing files
npm run rules:cursor # only the Cursor provider
npm run rules:custom # only your custom providerNotes:
- If installed as a dependency (via the Installation section),
agent-rulesis available to scripts fromnode_modules/.bin. - Adjust
--input,--filter, or--configto match your project (defaults:--input agent-rules,--filter "*.md").
This processes all .md files in agent-rules/ and generates:
.cursor/rules/*.mdc(Cursor AI rules).clinerules/*.md(Cline rules).windsurf/rules/*.md(Windsurf rules)CLAUDE.md(Combined reference).github/copilot-instructions.md(GitHub Copilot repository instructions)AGENTS.md(OpenAI AGENTS.md format - open standard for AI agent instructions)replit.md(Replit AI instructions)- Custom formats via your own providers
Create markdown files in agent-rules/ with YAML front-matter:
---
description: Your rule description
alwaysApply: true
cursor:
retrieval-strategy: always
---
# Your Rule Content
Rule documentation goes here...// my-provider.js
import path from "node:path";
import fs from "node:fs/promises";
/**
* Custom provider for your specific format
* @implements {import("agent-rules/src/types.js").RuleProvider}
*/
export class MyProvider {
/**
* @readonly
* @type {string}
*/
id = "my-format";
/**
* @returns {Promise<void>}
*/
async init() {
/* setup output directory */
}
/**
* @param {import("agent-rules/src/types.js").RuleFileInput} file
* @returns {Promise<void>}
*/
async handle({ filename, frontMatter, content }) {
/* transform rule */
}
/**
* @returns {Promise<void>}
*/
async finish() {
/* cleanup/finalize */
}
}# Validate your provider before using it
npx agent-rules --validate ./my-provider.js
# Test with dry run
npx agent-rules --provider ./my-provider.js --dry-runFor permanent built-in providers, implement the RuleProvider interface in src/providers/:
// src/providers/new-agent.js
export class NewAgentProvider {
id = "new-agent";
async init() {
/* setup */
}
async handle({ filename, frontMatter, content }) {
/* transform */
}
async finish() {
/* finalize */
}
}Add to the built-in providers in src/provider-loader.js.
β
Production-Ready CLI: Extensive command-line options for real-world usage
β
Custom Providers: Load your own providers via --provider option
β
Provider Validation: Validate custom providers before use
β
Flexible Filtering: Process specific files with glob patterns
β
Configuration Files: JSON-based configuration for complex setups
β
Type Safety: Full JSDoc type annotations for IDE support
β
Zero Compilation: Pure JavaScript, runs directly with Node.js
agent-rules/ # Source of truth (edit these)
βββ frontend_style.md
βββ meta-rule-authoring.md
βββ prototype-structure.md
src/
βββ providers/ # Built-in AI agent translators
βββ types.js # Provider interface definitions
βββ cli.js # CLI argument parsing
βββ provider-loader.js # Dynamic provider loading
βββ index.js # Main orchestrator
# Generated outputs (don't edit directly)
.cursor/rules/ # Cursor AI format
.clinerules/ # Cline format
.windsurf/rules/ # Windsurf format
CLAUDE.md # Combined format
.github/copilot-instructions.md # GitHub Copilot format
AGENTS.md # OpenAI format
replit.md # Replit format
- INSTALLATION.md - Comprehensive installation guide
- CLI_GUIDE.md - Comprehensive CLI usage guide
- JSDOC_GUIDE.md - JSDoc patterns and maintenance guide
Important: Wild (the company behind this project) is not liable for any outputs generated by AI agents using this tool. Users are solely responsible for managing, reviewing, and owning all prompts, rules, and generated content. By using this software, you acknowledge that:
- You are responsible for the content and behavior defined in your agent rules
- You must review and validate all AI-generated outputs before use
- The tool is provided "as is" without warranties of any kind
- Wild assumes no liability for any damages or issues arising from the use of this software
Please use responsibly and ensure all generated content complies with applicable laws, regulations, and your organization's policies.