frameworks

A set of framework and library conventions for a strict TypeScript Node.js project. It covers Node.js modules, Commander.js command-line interfaces, and related project patterns.

In plain words
What is it for?
Use it when adding TypeScript commands, working with files or child processes, or defining exported functions in this Node.js project.
Why use it?
It keeps code consistent with the project's chosen tools and type-checking settings.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/srajangpt1/agent-rule-sync/frameworks
Clone the repo
git clone --depth 1 https://github.com/Srajangpt1/agent-rule-sync

Made for: Cursor.

Per session 932 This file is loaded in full into every session.
When invoked 932 The same file — it is already loaded in full.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00932 $0.00932
Opus 5 $0.00466 $0.00466
Sonnet 5 $0.00186 $0.00186
Haiku 4.5 $0.00093 $0.00093

Measured 2d ago against content hash 3530a47cc119, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

frameworks scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- **Node.js Patterns**: Use Node.js built-in modules (child_process, fs, path) following Node.js conventions. Use spawn from child_process for executing external commands. Use fs.readFileSync/fs.writeFileSync for synchro
.cursor/rules/frameworks.mdc · 80 lines

What it actually says

  • TypeScript Configuration: Use strict TypeScript mode (strict: true). Target ES2020. Use CommonJS modules for Node.js compatibility. Enable declaration files for type definitions. Always define explicit return types for exported functions.

    • export async function generateRules(config: GenerateRulesConfig = {}): Promise
    • interface AnalysisResult { success: boolean; data?: AnalysisData; error?: string; }
  • Node.js Patterns: Use Node.js built-in modules (child_process, fs, path) following Node.js conventions. Use spawn from child_process for executing external commands. Use fs.readFileSync/fs.writeFileSync for synchronous file operations when appropriate. Use path.join() for cross-platform path construction.

    • import { spawn } from 'child_process'; const process = spawn('cursor-agent', ['--version']);
    • import * as fs from 'fs'; import * as path from 'path'; const filePath = path.join(baseDir, '.cursor', 'rules');
  • Commander.js CLI Framework: Use commander for CLI interface. Define commands and options with descriptive names and help text. Use .action() for command handlers. Structure CLI with main command and subcommands. Use chalk for colored output in CLI. Include shebang (#!/usr/bin/env node) at top of CLI entry point.

    • #!/usr/bin/env node const program = new Command(); program .name('agent-rule-sync') .description('...') .option('-v, --verbose', 'Enable verbose logging', false) .action(async (options) => { });
    • program .command('check') .description('Check if cursor-agent is installed') .action(async () => { });
  • Chalk for Terminal Output: Use chalk for colored terminal output to improve user experience. Use semantic color choices: green for success, red for errors, yellow for warnings, cyan for info, gray for secondary info. Use chalk.bold for emphasis.

    • console.log(chalk.green('Success!'));
    • console.error(chalk.red('Error: ...'));
    • console.log(chalk.bold.cyan('\nAgent Rule Sync\n'));
  • Promise-based Async Patterns: Use async/await consistently, not Promise chains. Wrap spawn operations in Promise constructors for better control. Always handle errors in async functions with try-catch blocks.

    • export async function checkCursorAgent(): Promise { return new Promise((resolve) => { const process = spawn('cursor-agent', ['--version']); // ... resolve/reject logic }); }
    • try { const result = await generateRules(config); } catch (error) { // handle error }
  • Type Definitions: Define all types and interfaces in types.ts. Use descriptive interface names. Make properties optional (?) for values that may be undefined. Use union types for literal values. Export all public types.

    • export interface GenerateRulesConfig { outputDir?: string; verbose?: boolean; dryRun?: boolean; cwd?: string; }
    • export interface CursorAgentCheck { installed: boolean; version?: string; error?: string; }
  • ESLint Configuration: Use TypeScript ESLint with strict type checking. Require explicit function return types (warn level). Disallow any type. Require await for promises. Allow console statements for CLI tools. Enforce const for variables that aren't reassigned. Use prefer-const and no-var rules. Configure unused variable ignore pattern with '^_' prefix.

    • "@typescript-eslint/explicit-function-return-type": "warn"
    • "@typescript-eslint/no-explicit-any": "error"
    • "@typescript-eslint/no-floating-promises": "error"
    • "@typescript-eslint/await-thenable": "error"
    • "no-console": "off"
    • "prefer-const": "error"
    • "no-var": "error"
  • Index File Re-exports: Use index.ts as the main entry point to re-export public APIs from other modules. This provides a clean public API surface. Export types using export * from './types'.

    • import { checkCursorAgent, analyzeCodebase } from './analyzer'; import { getRulesDirectory, writeRules } from './rules-manager'; export * from './types';
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 80 lines · 932 tokens per session scan A 3530a47cc119

Subscribe to this mod's changes

frameworks is a cursor rule published in the GitHub repository Srajangpt1/agent-rule-sync (12 stars, last pushed 5mo ago), licensed MIT. It adds 932 tokens to every session, about $0.0047 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.