typescript-coding-standards

A set of standards for writing production TypeScript, a programming language that adds types to JavaScript.

In plain words
What is it for?
Use it when adding structured Pino logs, choosing server or browser loggers, and recording useful context for debugging.
Why use it?
It keeps application behavior easier to monitor and prevents inconsistent direct use of console logging.

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/technickai/ai-coding-config/typescript-coding-standards
Clone the repo
git clone --depth 1 https://github.com/TechNickAI/ai-coding-config

Made for: Cursor.

Per session 1,399 This file is loaded in full into every session.
When invoked 1,399 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.01399 $0.01399
Opus 5 $0.00700 $0.00700
Sonnet 5 $0.00280 $0.00280
Haiku 4.5 $0.00140 $0.00140

Measured yesterday against content hash 5a328895d5cd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

typescript-coding-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 yesterday.

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/frontend/typescript-coding-standards.mdc · 232 lines

How it starts

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

TypeScript Coding Standards

Write production TypeScript code that is maintainable, observable, and follows modern patterns.

Structured Logging with Pino

Use pino logger for structured JSON logging. The logger auto-silences during tests and provides pretty formatting in development.

import { logger } from "@/lib/logger";

logger.info({ userId, email, service }, "User authenticated");
logger.error({ error, userEmail, action }, "Failed to execute action");
logger.warn({ retryCount, url }, "HTTP request retry");
logger.debug({ requestId, method }, "Processing request");

For client-side code, use the client logger which works in browsers:

import { logger } from "@/lib/client-logger";

logger.error({ error, context }, "Failed to copy text");
logger.info({ service }, "Connection successful");

The first argument is ALWAYS a context object (even if empty {}), the second is ALWAYS the message string. Structure your context with meaningful keys that help debug issues. Use emojis in messages when they add clarity and make logs more scannable.

Never use console.log, console.error, console.warn, or console.info directly. Always use the appropriate logger for consistent structured logging.

Error Monitoring with Sentry

Sentry captures errors with rich context for observability. Add context at error boundaries to make debugging easier.

Capture exceptions with tags and extra data:

import * as Sentry from "@sentry/nextjs";

try {
  await riskyOperation();
} catch (error) {
  logger.error({ error, userId }, "Operation failed");

  Sentry.captureException(error, {
    tags: { component: "api", action: "send_email" },
    extra: { userId, messageId, attemptCount },
  });

  throw error;
}

Add breadcrumbs for important state changes:

Sentry.addBreadcrumb({
  category: "http.retry",
  message: `Retrying ${method} ${url}`,
  level: "warning",
  data: { url, retryCount },
});

Create spans for performance monitoring:

Read the full file on GitHub · 232 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. yesterday First seen · 232 lines · 1,399 tokens per session scan A 5a328895d5cd

Subscribe to this mod's changes

typescript-coding-standards is a cursor rule published in the GitHub repository TechNickAI/ai-coding-config (24 stars, last pushed 2mo ago), licensed MIT. It adds 1,399 tokens to every session, about $0.0070 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.