code-standards.rules

General coding rules focused on readable, modular, testable, consistent, and efficient code, including a line-length limit for JavaScript and TypeScript files.

In plain words
What is it for?
Reviewing Node.js and TypeScript changes, deciding when to refactor, maintaining module structure, and preserving tests while reorganizing code.
Why use it?
They help prevent oversized files and tangled code by requiring related logic to be split into focused modules and checked with tests.

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/drumnation/unsplash-smart-mcp-server/code-standards.rules
Clone the repo
git clone --depth 1 https://github.com/drumnation/unsplash-smart-mcp-server

Made for: Cursor.

Per session 1,278 This file is loaded in full into every session.
When invoked 1,278 The same file — it is already loaded in full.
Security scan A 0 findings. 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.01278 $0.01278
Opus 5 $0.00639 $0.00639
Sonnet 5 $0.00256 $0.00256
Haiku 4.5 $0.00128 $0.00128

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

Security

Grade A, and why

code-standards.rules 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 3d 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/code-standards.rules.mdc · 103 lines

How it starts

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

Core Principles:

  1. Readability and Maintainability: Prioritize code that is easy to understand and modify.
  2. Modularity: Break down large components into smaller, manageable modules.
  3. Testability: Ensure that code is easily testable.
  4. Performance: Optimize code for efficiency.
  5. Consistency: Adhere to established coding standards and patterns.
  6. Proactive Refactoring: Address code complexity and length early.

Cursor Ruleset (Node.js/TypeScript):

1. File Length and Refactoring:

  • Rule: "Monitor all .ts and .js files. When a file exceeds 500 lines, initiate a refactoring process to break down the file into smaller, more focused modules or classes. Prioritize extracting logically related code blocks into separate files or functions."
  • Action:
    • "Analyze the file to identify logical units of functionality."
    • "Create new files or modules for these units, ensuring clear separation of concerns."
    • "Update import/export statements to maintain functionality."
    • "Ensure all extracted code is thoroughly tested."
    • "Provide a summary of the refactoring steps taken and the rationale behind them."

2. Module Structure and Organization:

  • Rule: "Organize code into logical modules based on functionality. Utilize the src/ directory for source code and test/ for tests. Create subdirectories within src/ to represent different features or components."
  • Action:
    • "Ensure that related files are grouped together in subdirectories."
    • "Use index.ts files to aggregate exports from subdirectories, providing a clean API for other modules."
    • "Maintain a clear and consistent file naming convention."

3. Function and Class Design:

  • Rule: "Functions and classes should have a single responsibility. Keep functions short and focused. Classes should encapsulate related data and behavior."
  • Action:
    • "Refactor long functions into smaller, more manageable functions."
    • "Extract common logic into reusable functions or classes."
    • "Adhere to the Single Responsibility Principle (SRP)."
    • "Use descriptive names for functions and classes."
    • "Use typescript interfaces to define the shape of objects."

4. Error Handling:

  • Rule: "Implement robust error handling using try...catch blocks and custom error classes. Log errors with sufficient context for debugging."
  • Action:
    • "Wrap potentially error-prone code in try...catch blocks."
    • "Create custom error classes for specific error scenarios."
    • "Log errors with timestamps, file names, and line numbers."
    • "Avoid throwing generic errors, provide useful error messages."

5. Asynchronous Operations:

  • Rule: "Use async/await for asynchronous operations. Avoid callback hell. Implement proper error handling for asynchronous code."
  • Action:
    • "Prefer async/await over callbacks or promises."
    • "Use try...catch blocks within async functions to handle errors."
    • "Validate inputs and outputs of async functions."

6. Testing:

  • Rule: "Write comprehensive unit tests for all code. Use a testing framework like Jest or Mocha. Aim for 100% test coverage, especially for critical modules."
  • Action:
    • "Create test files in the test/ directory, mirroring the src/ directory structure."
    • "Use mocking and stubbing to isolate units of code."
    • "Write tests for edge cases and error scenarios."
    • "Use code coverage tools to measure test effectiveness."

7. Code Style and Linting:

  • Rule: "Adhere to a consistent code style using ESLint and Prettier. Configure these tools to enforce coding standards and automatically format code."
  • Action:
    • "Install and configure ESLint and Prettier with appropriate rules."
    • "Integrate linting and formatting into the development workflow (e.g., using Git hooks or CI/CD pipelines)."
    • "Use a consistent indentation style, and consistent use of semicolons."

Read the full file on GitHub · 103 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. 3d ago First seen · 103 lines · 1,278 tokens per session scan A e89034f8e628

Subscribe to this mod's changes

code-standards.rules is a cursor rule published in the GitHub repository drumnation/unsplash-smart-mcp-server (63 stars, last pushed 7mo ago), licensed MIT. It adds 1,278 tokens to every session, about $0.0064 per session on Opus 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.