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.
git clone --depth 1 https://github.com/Srajangpt1/agent-rule-syncWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/srajangpt1/agent-rule-sync/codepatterns)<a href="https://agentmods.dev/rules/srajangpt1/agent-rule-sync/codepatterns"><img src="https://agentmods.dev/badge/rules/srajangpt1/agent-rule-sync/codepatterns/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/srajangpt1/agent-rule-sync/codepatterns"><img src="https://agentmods.dev/badge/rules/srajangpt1/agent-rule-sync/codepatterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01380 |
| Opus 5.5 | $0.00000 | $0.00552 |
| Sonnet 5.5 | $0.00000 | $0.00276 |
| Haiku 4.5 | $0.00000 | $0.00138 |
Grade A, and why
codepatterns 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 3mo 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.
- import { spawn } from 'child_process'; How it starts
The opening of the file, as written. The whole thing — 114 lines — stays where its author put it; the contents beside it link to each section on GitHub.
-
Indentation Style: Use 2 spaces for indentation, never tabs. All code files consistently use 2-space indentation.
- function example() { const value = 1; return value; }
- if (condition) { doSomething(); }
-
Naming Conventions: Use camelCase for functions, variables, and method names. Use PascalCase for interfaces, types, classes, and exported types. Use descriptive, clear names that indicate purpose.
- camelCase: generateRules, checkCursorAgent, readExistingRules
- PascalCase: GenerateRulesConfig, AnalysisResult, CursorAgentCheck, RuleCategory
-
Function Documentation: All exported functions must have JSDoc-style comments with /** */ syntax. Include a brief description of what the function does. Document parameters and return types in TypeScript types, not JSDoc tags.
- /**
- Check if cursor-agent is installed and accessible */ export async function checkCursorAgent(): Promise
- /**
- Main function to generate cursor rules */ export async function generateRules(config: GenerateRulesConfig = {}): Promise
-
Import Organization: Group imports logically: Node.js built-ins first (if any), then external dependencies, then local imports. Use named imports for clarity. Keep import statements at the top of the file.
- import { spawn } from 'child_process'; import chalk from 'chalk'; import { Command } from 'commander'; import { generateRules } from './index';
- import * as fs from 'fs'; import * as path from 'path'; import { AnalysisData, RulesManagerResult } from './types';
-
Export Patterns: Use named exports (export function, export const) rather than default exports. Export types and interfaces explicitly using export interface/export type. Re-export related items from index.ts using export *.
- export async function generateRules(...) { }
- export interface GenerateRulesConfig { }
- export * from './types';
-
File Organization: One major concern per file. Related functions grouped together. Files named with kebab-case for multi-word names (e.g., rules-manager.ts), single words can use camelCase. Each file should have a clear, singular responsibility.
- src/analyzer.ts - handles cursor-agent integration
- src/rules-manager.ts - handles file system operations for rules
- src/cli.ts - handles CLI interface
-
Code Formatting: Use consistent spacing around operators, after commas, and in object literals. Use trailing commas in multiline arrays and objects. Use semicolons at end of statements.
- const config: GenerateRulesConfig = { outputDir: options.output, verbose: options.verbose, dryRun: options.dryRun, };
- const files = ['file1', 'file2', 'file3'];
-
String Literals: Use single quotes for string literals throughout the codebase. Use template literals (backticks) for multi-line strings and string interpolation.
- const message = 'Simple string';
- const path = path.join(baseDir, '.cursor', 'rules');
- const prompt =
Analyze this entire codebase...;
-
Conditional Logic: Prefer early returns for error conditions. Use explicit boolean checks (=== true, === false) when clarity is needed. Use optional chaining and nullish coalescing where appropriate.
- if (!agentCheck.installed) { return { success: false, error: '...' }; }
- const alwaysApply = category.alwaysApply !== undefined ? category.alwaysApply : category.ruleType === 'always' ? true : false;
-
CLI Error Handling: In CLI entry points (cli.ts), use process.exit() with appropriate exit codes (1 for errors, 0 for success) after displaying error messages. Library functions should return error objects instead of exiting.
- if (!agentCheck.installed) { console.error(chalk.red('Error: ...')); process.exit(1); }
- // In library functions, return errors instead: return { success: false, error: '...' };
-
Filename Comparison: When comparing filenames for existence checks, use case-insensitive comparison by converting to lowercase. This prevents issues with case-sensitive file systems while maintaining compatibility.
- const existingFilenames = new Set(existingRules.map((r) => r.filename.toLowerCase()));
- const existingFile = existingRules.find((r) => r.filename.toLowerCase() === filename.toLowerCase());
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.
- 3mo ago First seen · 114 lines · 0 tokens per session scan A cdcc0513f9b2
codepatterns is a cursor rule published in the GitHub repository Srajangpt1/agent-rule-sync (12 stars, last pushed 8mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,380 tokens. 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.
codepatterns compared with cursor rules from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| codepatternsSrajangpt1/agent-rule-sync | Cursor rule | 12 | 8mo ago | MIT | A | 0 | Cursor |
| vue-typescript-patternssoaring-xiongkulu/easyaiot | Cursor rule | 769 | today | MIT | A | 381 | Cursor |
| nextjs-typescript-app-cursorrules-prompt-filePatrickJS/awesome-cursorrules | Cursor rule | 41k | 6mo ago | CC0-1.0 | A | 66 | Cursor |
| tsun-pany/v3-admin-vite | Cursor rule | 7.1k | 4mo ago | MIT | A | 287 | Cursor |
| typescript-securityfmflurry/settings-opencode | Cursor rule | 170 | 27d ago | MIT | A | 0 | Cursor |
| naming-conventions-ruleholtwood/awesome-cursorrules-zh | Cursor rule | 244 | 1mo ago | MIT | A | 64 | Cursor |
| typescriptjeffgreendesign/textrawl | Cursor rule | 6 | yesterday | MIT | A | 0 | Cursor |