inject-rule
v1.0.0
Published
CLI tool to inject Cursor .mdc rule files from a private GitHub repo into your project
Downloads
15
Readme
inject-rule
A CLI tool that injects pre-configured Cursor .mdc rule files into any backend project — with an interactive questionnaire that pre-fills the rule context so the Cursor agent skips straight to implementation.
╔═════════════════════════════════════════════╗
║ ║
║ ◈ inject-rule v1.0.0 ║
║ Cursor rule injector ║
║ ║
║ ✦ George Padmore Yeboah ║
║ ║
╚═════════════════════════════════════════════╝What it does
- Presents an interactive questionnaire about your project setup
- Fetches the matching
.mdcrule file from the rules repository - Pre-fills the rule's Step 0 context block with your answers so the Cursor agent has full context from the start
- Writes the file to
.cursor/rules/<rule>.mdcin your current working directory
Installation
npm install -g inject-ruleRequires Node.js 18 or later.
Usage
Interactive rule picker (recommended)
Run without arguments to browse and select one or more rules:
inject-ruleYou will be shown a multi-select list of all available rules. Select any combination and the CLI walks you through the relevant questions for each.
Inject a specific rule directly
inject-rule rbacList all available rules
inject-rule list
# shorthand:
inject-rule lHelp
inject-rule --help
inject-rule rbac --helpAvailable rules
| Rule | Description |
|------|-------------|
| rbac | Role-Based Access Control — sets up roles, permissions, guards, and seeding |
rbac question flow
When you run inject-rule rbac (or select rbac from the picker), you will be asked:
| # | Question | Options |
|---|----------|---------|
| 1 | Backend framework | NestJS, Elixir/Phoenix, Ruby Sinatra, Laravel |
| 2 | Database | PostgreSQL, MySQL |
| 3 | ID / primary-key type | bigserial/bigint, serial/int, UUID v4 |
| 4 | Users table already exists? | Yes / No |
| 4a | (if Yes) PK column name and type | Free text, e.g. id bigint |
| 5 | Authentication strategy | JWT, Session, Other |
| 6 | Migration strategy | SQL file only, Framework migration tool |
| 7 | Route protection scope | All routes, Roles and permissions routes only |
| 8 | Permissions to seed | Comma-separated, optional |
After answering, a summary is displayed for review. You can confirm to proceed or restart the questionnaire.
What gets written
The file .cursor/rules/rbac.mdc is created in your project with a pre-filled context block at the top:
## Step 0 — Context already provided
> The following context was collected via `inject-rule rbac` — skip straight to implementation.
- **Framework**: NestJS
- **Database**: PostgreSQL
- **ID type**: UUID v4
- **Users table exists**: Yes
- **PK column**: `id UUID`
- **Auth type**: JWT
- **Migration strategy**: SQL file only
- **Route protection**: All routes
- **Permissions to seed**: read:posts, write:posts, admin:usersOpen the file in Cursor and the agent will read this context and skip straight to writing code.
No configuration required
inject-rule works out of the box — no tokens, no environment variables, no account needed. Just install and run.
Author
George Padmore Yeboah
License
MIT
