Skip to content
Back to skills

Ts React Antipatterns

ASecurity

Forbidden TypeScript/React patterns — XSS, eval, localStorage tokens, hook bugs, floating Promises. Applies when editing TS/TSX files.

  • 5 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added October 21, 2026
ai-agentstypescriptreactbackend

Security analysis

A100/100

Pro scans all 16 files and shows the line behind each finding

Scanned November 11, 2026

npx -y skills add emgiezet/aisdlc --skill ts-react-antipatterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ts React Antipatterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ts React Antipatterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/emgiezet-ts-react-antipatterns/badge)](https://www.skillsdirectory.com/skills/emgiezet-ts-react-antipatterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ts-react-antipatterns
description: Forbidden TypeScript/React patterns — XSS, eval, localStorage tokens, hook bugs, floating Promises. Applies when editing TS/TSX files.
paths: ["**/*.js","**/*.jsx","**/*.ts","**/*.tsx"]
user-invocable: false
---

# TypeScript / React anti-patterns — do not write these

Checks run automatically after each edit. Findings reference the IDs below.

## Blockers
- AP-TS-SEC-001 — Never set `innerHTML`/`dangerouslySetInnerHTML` from user data; use DOMPurify for rich text.
- AP-TS-SEC-002 — No `eval`/`new Function`/`setTimeout(string)`; use a static dispatch map.
- AP-TS-SEC-004 — Validate that user-supplied URLs have an `https:` or `http:` scheme before rendering.
- AP-TS-SEC-005 — Server-side secrets stay on the server; expose only through a backend proxy endpoint.

## Errors
- AP-TS-SEC-003 — Store session tokens in `HttpOnly; Secure; SameSite` cookies, not `localStorage`.
- AP-TS-PERF-001 — List every value the effect reads in `deps`; compute derived state in the render, not in effects.
- AP-TS-PERF-003 — Define components at module scope; memoize context values with `useMemo`.
- AP-TS-MAINT-002 — Await every Promise or chain `.catch()`; mark intentional fire-and-forget with `void`.
- AP-TS-MAINT-003 — Replace `@ts-ignore` with `@ts-expect-error // reason: <≥10 chars>`.

## Warnings
- AP-TS-PERF-004 — Cancel fetches on cleanup with `AbortController`; prefer a data-fetching library.
- AP-TS-PERF-005 — Never copy or spread the accumulator in `reduce`; mutate in place (`acc[key] = val; return acc`).
- AP-TS-MAINT-001 — Validate external data at the boundary (e.g. zod); avoid `any`, `!`, unsafe `as`, and never `as unknown as T`.
- AP-TS-MAINT-005 — No chained `as` casts; put `// SAFETY: <reason>` above every type assertion.
- AP-TS-MAINT-006 — Don't widen a known value to `unknown` to assert it into another type; use the original type.
- AP-TS-MAINT-007 — No `unknown`/`object` parameters, returns, or aliases; use named interfaces and validate at boundaries.
- AP-TS-MAINT-008 — Replace `Reflect.get`/`Reflect.apply` with direct property access and typed function calls.
- AP-TS-MAINT-009 — Replace `jest.mock`/`vi.mock` full-module replacement with `vi.spyOn`/`jest.spyOn` on specific exports.

Details for any ID: `reference/<ID>.md`

Files in this skill

  • SKILL.md1.8 KB
  • reference/AP-TS-MAINT-001.md815 B
  • reference/AP-TS-MAINT-002.md649 B
  • reference/AP-TS-MAINT-003.md591 B
  • reference/AP-TS-MAINT-004.md769 B
  • reference/AP-TS-MAINT-005.md895 B
  • reference/AP-TS-MAINT-006.md760 B
  • reference/AP-TS-PERF-001.md710 B
  • reference/AP-TS-PERF-002.md593 B
  • reference/AP-TS-PERF-003.md984 B
  • reference/AP-TS-PERF-004.md796 B
  • reference/AP-TS-SEC-001.md827 B
  • reference/AP-TS-SEC-002.md756 B
  • reference/AP-TS-SEC-003.md784 B
  • reference/AP-TS-SEC-004.md793 B
  • reference/AP-TS-SEC-005.md841 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.