extension-ts

extension-ts is a cursor rule for Cursor from sruja-ai/sruja. It costs 401 tokens per session, scanned A, original, Apache-2.0.

A set of TypeScript coding rules for a Visual Studio Code extension. It covers editor APIs, asynchronous work, error handling, WebAssembly loading, types, and cleanup.

In plain words
What is it for?
Use it when editing TypeScript under the extension's source folder or connecting the extension to its WebAssembly code.
Why use it?
It helps extension changes follow the project's conventions and avoid common problems such as unsafe types, leaked resources, or incorrect workspace access.

Cursor rule for Cursor

Written for Cursor: installed under .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/sruja-ai/sruja/extension-ts
Clone the repo
git clone --depth 1 https://github.com/sruja-ai/sruja

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 extension-ts

README.md
[![agentmods](https://agentmods.dev/badge/rules/sruja-ai/sruja/extension-ts.svg)](https://agentmods.dev/rules/sruja-ai/sruja/extension-ts)
Your own site
<a href="https://agentmods.dev/rules/sruja-ai/sruja/extension-ts"><img src="https://agentmods.dev/badge/rules/sruja-ai/sruja/extension-ts.svg" alt="Measured on agentmods" height="20"></a>
Per session 401 This file is loaded in full into every session.
When invoked 401 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.1 $0.00401 $0.00401
Opus 5 $0.00200 $0.00200
Sonnet 5 $0.00080 $0.00080
Haiku 4.5 $0.00040 $0.00040

Measured 6d ago against content hash 7c2412b36dd0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

extension-ts 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 6d 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/extension-ts.mdc · 40 lines

What it actually says

VS Code Extension Patterns

Patterns for the Sruja VS Code extension (TypeScript).

Scopes

  • extension/src/**/*.ts

Rules

  1. Use VS Code API: All editor interactions go through the vscode namespace. Never use Node.js fs for workspace operations — use vscode.workspace.fs.
  2. Dispose resources: All disposables (providers, commands, channels) must be registered via context.subscriptions.push() or the extension's Disposable store.
  3. Async/await: All async operations use async/await, not .then() chains.
  4. Error handling: Wrap VS Code API calls in try/catch. Show user-facing errors with vscode.window.showErrorMessage(). Log details to the OutputChannel.
  5. WASM integration: Load WASM via src/wasm.ts. Never import WASM modules directly — use the wrapper.
  6. Type safety: Use strict TypeScript. No any types. Use unknown + type guards for untrusted data.
  7. Null handling: Use undefined consistently. Prefer ?? over || for nullish coalescing. Use ?. for optional chaining.
  8. Constants: Use UPPER_SNAKE_CASE for module-level constants. Use descriptive names.

Patterns

import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext): void {
    const channel = vscode.window.createOutputChannel('Sruja');
    context.subscriptions.push(channel);

    context.subscriptions.push(
        vscode.commands.registerCommand('sruja.validate', async () => {
            try {
                // ...
            } catch (err) {
                vscode.window.showErrorMessage(`Sruja: ${err}`);
                channel.appendLine(`Error: ${err}`);
            }
        })
    );
}
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. 6d ago First seen · 40 lines · 401 tokens per session scan A 7c2412b36dd0

Subscribe to this mod's changes

extension-ts is a cursor rule published in the GitHub repository sruja-ai/sruja (23 stars, last pushed 5d ago), licensed Apache-2.0. It adds 401 tokens to every session, about $0.0020 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.

Related

Other cursor rules, from other repositories

api-design-typescript

API Design for TypeScript — Express, NestJS, Fastify patterns, middleware, validation, and error handling. Extends core/rules/api-design.mdc with TypeScript-specific guidance.

adonai-labs/agent-runway · 0 tokens

typescript

TypeScript best practices — strict configuration, advanced type patterns, type safety, generics, branded types, type guards, performance, testing, and common anti-patterns. Applied when working with TypeScript files.

adonai-labs/agent-runway · 0 tokens

_code-rules-TypeScript-summary

Apply when creating or editing TypeScript (.ts) files or shared TypeScript modules. Enforces typed, modular, readable code with strict formatting, naming, imports, configuration, validation, error handling, async patterns, and separation of concerns. This is a concise summary of…

Brainy-Builds/ts-inspect-cli · 4,354 tokens

typescript-security

TypeScript security guidelines — input validation with Zod, JWT handling, SQL injection prevention, secrets hygiene, and dependency scanning. Applied when working with TypeScript files.

adonai-labs/agent-runway · 0 tokens

typescript-testing

TypeScript testing guidelines — Vitest/Jest setup, unit testing patterns, mocking strategy, integration testing with Testcontainers, and coverage standards. Applied when working with TypeScript test files.

adonai-labs/agent-runway · 0 tokens

vue-typescript-patterns

Cursor rule "vue-typescript-patterns" from soaring-xiongkulu/easyaiot, covering vue3 + typescript 开发规范, vue 组件规范, vue sfc 组件规范, typescript 规范 and 状态管理.

soaring-xiongkulu/easyaiot · 381 tokens