Skip to content
Prompt

cli — Cursor Rules

by herodevs

AI Summary

Cursor Rules for enforcing code quality, security, and architectural standards in CLI projects built with oclif, providing automated checks for secrets, command structure, testing, and dependency management.

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to add the "cli — Cursor Rules" prompt rules to my project.
Repository: https://github.com/herodevs/cli

Please read the repo to find the rules/prompt file, then:
1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type)
2. If there's an existing rules file, merge the new rules in rather than overwriting
3. Confirm what was added

Description

Cursor Rules for cli

Testing requirements

rule "service-tests" { # Ensure each service has corresponding unit tests matches = ["src/service/*/.svc.ts"] requires_files = ["test/service/{name}.test.ts"] message = "Each service must have a corresponding unit test file" } rule "test-naming" { # Enforce consistent test file naming matches = ["test/*/.test.ts"] not_contains = [".test.svc.ts"] message = "Test files should be named {name}.test.ts, not {name}.test.svc.ts" }

Security-related rules

rule "no-secrets-in-source" { # Prevent accidental commit of secrets/credentials matches = ["*/.{ts,js,json}"] pattern = "(?i)(password|secret|token|key).=.['\"][^\s]{8,}['\"]" message = "Potential secret detected in source code. Use environment variables instead." }

CLI Architecture patterns

rule "command-structure" { # Enforce consistent command structure matches = ["src/commands/*/.ts"] contains = ["export default class", "static description", "async run()"] message = "Commands must export a default class with static description and async run() method" } rule "error-handling" { # Ensure proper error handling in commands matches = ["src/commands/*/.ts"] not_contains = ["console.error", "process.exit"] message = "Use oclif's error handling utilities instead of console.error or process.exit" }

Documentation

rule "command-docs" { # Enforce documentation for commands matches = ["src/commands/*/.ts"] pattern = "static description = '[^']{10,}'" message = "Commands must have meaningful descriptions (at least 10 characters)" }

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted 1mo ago
Active
AdoptionUnder 100 stars
11 ★ · Niche
DocsMissing or thin
Undocumented

GitHub Signals

Stars11
Forks9
Issues16
Updated1mo ago
View on GitHub
MIT License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Any AI assistant that accepts custom rules or system prompts

Claude
ChatGPT
Cursor
Windsurf
Copilot
+ more