Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

offensive-typesafety进攻性类型安全

Agent Skill

offensive-typesafety 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

672

周安装

28

GitHub Stars

2

下载量

224
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:offensive-typesafety(进攻性类型安全)
来源仓库:https://github.com/jonmumm/skills
仓库路径:skills/offensive-typesafety
安装命令:
npx skills add https://github.com/jonmumm/skills --skill offensive-typesafety
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/jonmumm/skills --skill offensive-typesafety

简介

offensive-typesafety 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 适用于类型安全、代码质量和防御性编程等技术查询场景。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需结合原始 README 核验具体用法和功能边界。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Offensive Typesafety

When to invoke this skill:

  • When setting up or evaluating a new tech stack.
  • When designing API, URL state, or database boundaries.
  • When refactoring untyped string-based logic into strict, compiler-checked contracts.

Offensive Typesafety is the practice of using strong, compiler-enforced types to accelerate development. Instead of using types defensively (just to catch bugs before production), use them offensively to establish strict boundaries that allow you—and AI code generators—to move blazingly fast without breaking things.

Core Philosophy: Compilers over Conventions

  • Constraints over "looks right": Code should not just look plausible; it should fail at the compiler level if it is structurally or conceptually wrong.
  • Explicit over Magic: Prefer explicit, traversable data structures over string-based assumptions or untyped framework magic.
  • Fail Early: The compiler is the first line of defense. The faster it fails, the faster you can iterate.
  • AI Viability: When AI writes code, types act as a contract, a feedback loop, and a way to self-correct. If an AI generates a typo in a string route, it fails silently at runtime. If it messes up a strongly typed route, the compiler catches it instantly.

Architecture Patterns for Moving Fast

Default to tools that enforce correctness at every layer.

1. Type-Safe Routing (e.g., TanStack Router, Expo Router)

A surprising amount of app complexity lives in routes, path parameters, and navigation. String-based routing and filesystem-only navigation often silently fail at runtime when links break or params change.

Avoid: String-based routing where broken links aren't caught until clicked. Prefer: Explicit, structurally-typed routes.

// BAD: String soup routing. Easy to break on refactoring.
<Link to={`/users/${userId}?tab=settings`}>Settings</Link>

// GOOD: Type-checked routing. The compiler ensures the target route, path params, and search params exist and are valid.
<Link
  to="/users/$userId"
  params={{ userId }}
  search={{ tab: 'settings' }}
>
  Settings
</Link>

2. Validated External Inputs (e.g., Zod, Valibot, ArkType)

URL state and API responses are real application state. They must be strictly typed and validated, not treated as untyped "string soup."

Avoid: Parsing window.location.search manually or using unbound search param hooks. Prefer: Defining schemas (e.g., via Zod) to validate and type search parameters before they enter the application logic.

import { z } from 'zod';

// Define the contract for the URL
const userSearchSchema = z.object({
  tab: z.enum(['profile', 'settings']).default('profile'),
  page: z.number().catch(1),
});

// The router enforces this contract
export const Route = createFileRoute('/users/$userId')({
  validateSearch: userSearchSchema,
});

// The component instantly benefits from typed, parsed, and safe search params
function UserPage() {
  const { tab, page } = Route.useSearch(); // tab is automatically 'profile' | 'settings'
  // ...
}

3. Unified Server/Client Boundaries (e.g., TanStack Start, tRPC, Hono RPC)

Your frontend and backend must speak the same type language. Manual API endpoints and manual type casting introduce dangerous gaps where the client expects one shape and the server returns another. This is especially true for E2E testing, where type-safe clients (like hc from Hono) prevent test queries from becoming outdated.

Avoid: Fetching data from manually constructed fetch endpoints and casting with as MyType. Prefer: Server functions or RPC procedures that automatically infer their inputs and outputs across the network boundary, ensuring both app requests and test suites stay synced.

import { createServerFn } from '@tanstack/start';

// Server Function: Defines the exact input and output types naturally
export const getUserStats = createServerFn("GET", async (userId: string) => {
  const dbUser = await db.query.users.findFirst({ userId });
  return { active: dbUser.isActive, score: dbUser.score }; // Inferred output type
});

// Route Loader: Consumes the server function directly. Type logic is preserved over the network.
export const Route = createFileRoute('/users/$userId')({
  loader: async ({ params }) => {
    // The compiler enforces that params.userId is a string, and 'stats' is { active: boolean, score: number }
    const stats = await getUserStats(params.userId);
    return { stats };
  },
});

4. End-to-End Database Types (e.g., Drizzle ORM, Prisma, Kysely)

Your database schema should drive the types for the rest of your application.

Avoid: Writing SQL strings and manually declaring a TypeScript interface to match the expected results. Prefer: A TypeScript ORM where the schema definition dictates the types exactly.

// schema.ts
export const users = pgTable('users', {
  id: serial('id').primaryKey(),
  email: varchar('email', { length: 255 }).notNull(),
  isActive: boolean('is_active').default(true),
});

// Re-use inferred types everywhere
export type User = typeof users.$inferSelect;
export type NewUser = typeof users.$inferInsert;

Summary Checklist

  • Does your chosen tech stack rely on compiler errors rather than runtime checks to catch broken links and payloads?
  • Are external inputs (like search parameters and API requests) validated through a strict schema before they hit application logic?
  • Are routes and paths treated as explicit data structures rather than strings?
  • Is there a single source of truth for types crossing from the database, through the server, and into the client boundary?

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.46%
按下载量换算82

Claude

27.17%
按下载量换算61

Cursor

19.49%
按下载量换算44

Gemini CLI

8.45%
按下载量换算19

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills