conventions

conventions is a cursor rule for Cursor from Srajangpt1/agent-rule-sync. It costs 1,446 tokens per session, scanned A, original, MIT.

A set of project coding conventions for errors, asynchronous work, function structure, and types. Asynchronous work means operations that finish later, such as file access or network calls.

In plain words
What is it for?
Use it when adding TypeScript functions, handling failures, writing async code, or organizing exported modules.
Why use it?
It gives contributors consistent patterns, making code easier to read and reducing mistakes in error handling and asynchronous functions.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding TypeScript functions, handling failures, writing async code, or organizing exported modules.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/srajangpt1/agent-rule-sync/conventions
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.

Clone the repo
git clone --depth 1 https://github.com/Srajangpt1/agent-rule-sync

Made for: Cursor.

Wrote 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.

agentmods badge for conventions

README.md
[![agentmods](https://agentmods.dev/badge/rules/srajangpt1/agent-rule-sync/conventions/github.svg)](https://agentmods.dev/rules/srajangpt1/agent-rule-sync/conventions)
Your own site
<a href="https://agentmods.dev/rules/srajangpt1/agent-rule-sync/conventions"><img src="https://agentmods.dev/badge/rules/srajangpt1/agent-rule-sync/conventions/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.

agentmods 80×15 button for conventions

Your own site · 80×15
<a href="https://agentmods.dev/rules/srajangpt1/agent-rule-sync/conventions"><img src="https://agentmods.dev/badge/rules/srajangpt1/agent-rule-sync/conventions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,446 This file is loaded in full into every session.
When invoked 1,446 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01446 $0.01446
Opus 5.5 $0.00578 $0.00578
Sonnet 5.5 $0.00289 $0.00289
Haiku 4.5 $0.00145 $0.00145

Measured 1mo ago against content hash 77a819cadc75, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

conventions scanned grade A with 0 findings 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 1mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/conventions.mdc · 139 lines

How it starts

The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.

  • Error Handling: Always check for errors using instanceof Error before accessing error properties. Use instanceof Error before accessing .message. Return error objects with success: false and error message string. Log errors appropriately based on context (console.error for CLI, return error for library API).

    • catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Unknown error occurred', }; }
    • process.on('error', (err) => { resolve({ installed: false, error: err.message, }); });
  • Async/Await Usage: Always use async/await for asynchronous operations, never Promise chains (.then/.catch). Make async functions return Promise with explicit type. Use try-catch blocks for error handling in async functions. Wrap callback-based APIs (like spawn) in Promise constructors.

    • export async function generateRules(config: GenerateRulesConfig = {}): Promise { try { const result = await analyzeCodebase({ verbose }); // ... } catch (error) { // handle error } }
    • export async function checkCursorAgent(): Promise { return new Promise((resolve) => { // callback-based logic }); }
  • Function Organization: Export functions at module level. Group related functions together. Use helper functions to break down complex logic. Keep functions focused on a single responsibility. Document exported functions with JSDoc comments.

    • export async function generateRules(...) { }
    • export async function checkAgent() { }
    • export async function analyze(...) { }
    • function createAnalysisPrompt(): string { }
    • function parseRawOutput(rawOutput: string): AnalysisData | null { }
  • TypeScript Type Usage: Define interfaces for all data structures. Use optional properties (?) for values that may be undefined. Use explicit return types on all exported functions. Use union types for literal value sets. Avoid any type, use unknown if type is truly unknown.

    • export interface AnalysisResult { success: boolean; data?: AnalysisData; error?: string; rawOutput?: string; }
    • ruleType?: 'always' | 'auto-attached' | 'agent-requested' | 'manual';
    • export async function generateRules(config: GenerateRulesConfig = {}): Promise
  • Default Parameters: Use default parameters for optional configuration options. Provide sensible defaults. Use object destructuring with defaults in function parameters.

    • export async function generateRules(config: GenerateRulesConfig = {}): Promise
    • export async function analyzeCodebase(options: AnalyzeOptions = {}): Promise { const { timeout = 300000, verbose = false } = options; }
    • export async function analyze(verbose: boolean = false): Promise
  • Result Objects: Use result objects with success boolean and additional data/error fields for function returns. This pattern allows for consistent error handling and data extraction. Include arrays for operation results (created, updated, unchanged).

    • interface RulesManagerResult { success: boolean; created: string[]; updated: string[]; unchanged: string[]; error?: string; }
    • return { success: true, created: ['file1.mdc'], updated: [], unchanged: [], };
  • Verbose Logging Pattern: Accept verbose boolean parameter for detailed logging. Check verbose flag before logging detailed information. Use console.log for verbose output, console.error for errors. Provide helpful progress messages during long operations. For large outputs, truncate and show length/preview.

    • if (verbose) { console.log(Using cursor-agent: ${agentCheck.version}); }
    • if (verbose && analysisResult.success && analysisResult.data) { console.log('Analysis successful, data received'); }
    • if (analysisResult.rawOutput.length < 500) { console.log('Raw output:', analysisResult.rawOutput); } else { console.log('Raw output (first 500 chars):', analysisResult.rawOutput.substring(0, 500)); }

Read the full file on GitHub · 139 lines

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. 1mo ago First seen · 139 lines · 1,446 tokens per session scan A 77a819cadc75

Subscribe to this mod's changes

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