typescript-standards

typescript-standards is a cursor rule for Cursor from Algovate/xhs-mcp. It costs 0 tokens per session (544 once invoked), scanned A, original, MIT.

A set of TypeScript coding rules for the XHS MCP project. TypeScript is a programming language that adds type checks to JavaScript, while MCP is a way for software to provide tools to an AI assistant.

In plain words
What is it for?
Use it when writing or reviewing TypeScript code in this project, especially public methods, shared interfaces, error handling, and module imports.
Why use it?
It gives contributors consistent rules for types, imports, naming, errors, and project structure. This reduces unclear code and mistakes that can be caught before the program runs.

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/algovate/xhs-mcp/typescript-standards
Clone the repo
git clone --depth 1 https://github.com/Algovate/xhs-mcp

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 typescript-standards

README.md
[![agentmods](https://agentmods.dev/badge/rules/algovate/xhs-mcp/typescript-standards.svg)](https://agentmods.dev/rules/algovate/xhs-mcp/typescript-standards)
Your own site
<a href="https://agentmods.dev/rules/algovate/xhs-mcp/typescript-standards"><img src="https://agentmods.dev/badge/rules/algovate/xhs-mcp/typescript-standards.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 544 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.00544
Opus 5 $0.00000 $0.00272
Sonnet 5 $0.00000 $0.00109
Haiku 4.5 $0.00000 $0.00054

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

Security

Grade A, and why

typescript-standards 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 4d 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/typescript-standards.mdc · 53 lines

How it starts

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

TypeScript Standards for XHS MCP

Type Safety

  • Strict Mode: Always use strict TypeScript configuration
  • Explicit Types: Use explicit return types for public methods: method(): ReturnType
  • No Any: Avoid any type - use unknown or specific types
  • Nullish Coalescing: Use ?? operator instead of || for null/undefined checks
  • Optional Chaining: Use ?. operator for safe property access

Import/Export Patterns

  • ES Modules: Use ES module syntax (import/export)
  • Named Exports: Prefer named exports over default exports
  • Index Files: Use index files for clean module boundaries
  • Type Imports: Use import type for type-only imports

Interface Design

  • Consistent Naming: Use PascalCase for interfaces (XHSResponse, BrowserConfig)
  • Generic Types: Use generics for reusable interfaces (XHSResponse<T>)
  • Optional Properties: Mark optional properties with ?
  • Readonly: Use readonly for immutable properties

Error Handling

  • Custom Errors: Extend XHSError base class for domain-specific errors
  • Error Context: Include context objects with error information
  • Type-Safe Errors: Use specific error types (AuthenticationError, BrowserError)

Service Patterns

  • Base Service: All services extend BaseService
  • Dependency Injection: Inject dependencies via constructor
  • Protected Methods: Use protected for internal service methods
  • Abstract Classes: Use abstract base classes for common functionality

Code Organization

  • Single Responsibility: One class/service per file
  • Co-location: Keep related types and implementations together
  • Barrel Exports: Use index files for clean imports
  • File Naming: Use kebab-case for files (auth.service.ts, browser.manager.ts)

Async Patterns

  • Async/Await: Prefer async/await over Promises
  • Error Propagation: Let errors bubble up naturally
  • Timeout Handling: Use proper timeout configurations
  • Resource Cleanup: Ensure proper cleanup in finally blocks

Read the full file on GitHub · 53 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. 4d ago First seen · 53 lines · 544 tokens per session scan A 200c44e13abf

Subscribe to this mod's changes

typescript-standards is a cursor rule published in the GitHub repository Algovate/xhs-mcp (54 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 544 tokens. 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.