nextjs-typescript-secure-no-railguard-available

nextjs-typescript-secure-no-railguard-available is a cursor rule for Cursor from brighton-labs/railguard-cursor-coding. It costs 658 tokens per session, scanned A, original, MIT.

Security and consistency rules for TypeScript and Next.js applications, including React Server Components, Tailwind, and Shadcn UI. They cover user input, data fetching, rendering, and the boundary between server and browser code.

In plain words
What is it for?
Use them when building Next.js pages, API handlers, forms, routes, or components that move data between the server and the browser.
Why use it?
They help prevent exposed secrets, unsafe browser code, unvalidated input, injection issues, and unclear types.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use them when building Next.js pages, API handlers, forms, routes, or components that move data between the server and the browser.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/brighton-labs/railguard-cursor-coding/nextjs-typescript-secure-no-railguard-available
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/brighton-labs/railguard-cursor-coding

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 nextjs-typescript-secure-no-railguard-available

README.md
[![agentmods](https://agentmods.dev/badge/rules/brighton-labs/railguard-cursor-coding/nextjs-typescript-secure-no-railguard-available/github.svg)](https://agentmods.dev/rules/brighton-labs/railguard-cursor-coding/nextjs-typescript-secure-no-railguard-available)
Your own site
<a href="https://agentmods.dev/rules/brighton-labs/railguard-cursor-coding/nextjs-typescript-secure-no-railguard-available"><img src="https://agentmods.dev/badge/rules/brighton-labs/railguard-cursor-coding/nextjs-typescript-secure-no-railguard-available/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 nextjs-typescript-secure-no-railguard-available

Your own site · 80×15
<a href="https://agentmods.dev/rules/brighton-labs/railguard-cursor-coding/nextjs-typescript-secure-no-railguard-available"><img src="https://agentmods.dev/badge/rules/brighton-labs/railguard-cursor-coding/nextjs-typescript-secure-no-railguard-available.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 658 This file is loaded in full into every session.
When invoked 658 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.00658 $0.00658
Opus 5 $0.00329 $0.00329
Sonnet 5 $0.00132 $0.00132
Haiku 4.5 $0.00066 $0.00066

Measured 9d ago against content hash 58076af382ca, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

nextjs-typescript-secure-no-railguard-available 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 9d 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/nextjs-typescript-secure-no-railguard-available.mdc · 51 lines

How it starts

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

R: Risk First

  • The goal of this rule is to ensure that all TypeScript and Next.js code is not only performant, but also secure, particularly across input handling, data fetching, rendering contexts, and client/server boundaries.

A: Anchored Constraints

  • Never expose secrets or tokens in the client bundle.
  • Never process authentication logic or sensitive tokens on the client side.
  • Never trust user input without validation and sanitization.
  • Avoid use of dangerouslySetInnerHTML unless explicitly sanitized.
  • Avoid the use of any and unknown in type declarations unless absolutely necessary and justified with a comment.

I: Interpretive Framing

  • If generating an API handler, assume it may be hit by a malicious actor — include schema validation (for example, with zod) and return standardized error responses.
  • If generating form components, treat all input as untrusted and encode output accordingly.
  • If building routes, assume URL parameters may be altered with anything insecure. Apply z.string().safeParse(...) or equivalent validation.

L: Local Defaults

  • Use zod or valibot for runtime validation of all inputs (form values, API payloads, URL params).
  • Use environment variables via process.env only inside server components or server actions.
  • Apply HTTPS and secure cookies (HttpOnly, Secure, SameSite=Strict) in all auth flows.
  • Use Content-Security-Policy headers for enhanced front-end protection.
  • Always set rel="noopener noreferrer" for links with target="_blank".

G: Generative Path Checks

  1. If working with input (forms, URL params, body): validate with a runtime schema before processing.
  2. If handling authentication or secrets: ensure logic remains on the server side.
  3. If displaying user-generated content: escape or sanitize output.
  4. If using 3rd-party packages: prefer well-maintained libraries with no known CVEs.
  5. Always explain in comments where secure handling occurs (for example, // Validated input with zod).

Read the full file on GitHub · 51 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. 9d ago First seen · 51 lines · 658 tokens per session scan A 58076af382ca

Subscribe to this mod's changes

nextjs-typescript-secure-no-railguard-available is a cursor rule published in the GitHub repository brighton-labs/railguard-cursor-coding (13 stars, last pushed 1y ago), licensed MIT. It adds 658 tokens to every session, about $0.0033 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.