Borrowing it
Nothing to install: this file belongs to shenjingnan/xiaozhi-client. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/shenjingnan/xiaozhi-client/main/.agents/skills/type-validator/SKILL.mdgit clone --depth 1 https://github.com/shenjingnan/xiaozhi-clientWrote 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.
[](https://agentmods.dev/skills/shenjingnan/xiaozhi-client/type-validator)<a href="https://agentmods.dev/skills/shenjingnan/xiaozhi-client/type-validator"><img src="https://agentmods.dev/badge/skills/shenjingnan/xiaozhi-client/type-validator.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00008 | $0.03168 |
| Opus 5 | $0.00004 | $0.01584 |
| Sonnet 5 | $0.00002 | $0.00634 |
| Haiku 4.5 | $0.00001 | $0.00317 |
Grade A, and why
type-validator 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 7d 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.
How it starts
The opening of the file, as written. The whole thing — 458 lines — stays where its author put it; the contents beside it link to each section on GitHub.
我是 TypeScript 严格模式检查技能,专门针对 xiaozhi-client 项目的 TypeScript 配置进行类型安全检查和修复建议,同时遵循务实开发理念。
技能使用原则
- 保持类型安全,但避免过度抽象:确保代码类型正确,但不追求完美的类型设计
- 实用功能优先,理论完美次之:解决实际的类型问题比预防所有可能更重要
- 简单解决方案优于复杂方案:优先选择直接有效的类型定义方式
- 务实开发指导:评估类型定义的必要性,避免过度设计
技能能力
1. any 类型检测与修复
核心能力:检测并修复所有 any 类型的使用,符合项目的严格类型要求。
检测范围
- 变量声明:
const/let/var声明的 any 类型 - 函数参数:参数类型为 any 的情况
- 返回值类型:函数返回值类型为 any
- 对象属性:对象属性的类型为 any
- 数组元素:数组元素的 any 类型
- 类型断言:不安全的类型断言使用
修复策略
// ❌ 原始代码
function process(data: any): any {
return data.value;
}
// ✅ 修复后(xiaozhi-client 项目标准)
function process<T extends Record<string, unknown>>(data: T): T[keyof T] {
return data.value as T[keyof T];
}
// MCP 相关的修复示例
// ❌ 原始代码
function handleMCPMessage(message: any): any {
return { id: message.id, result: "processed" };
}
// ✅ 修复后
function handleMCPMessage(message: MCPRequest): MCPResponse {
return {
jsonrpc: "2.0",
id: message.id,
result: "processed"
};
}
2. 类型定义完整性检查
确保所有接口、类型定义和函数都有完整的类型注解。
检查项目
- 接口属性:确保所有属性都有明确的类型
- 可选属性:正确使用
?标记可选属性 - 函数签名:完整的参数和返回值类型
- 泛型使用:合理的泛型约束和使用
- 类型守卫:提供运行时类型检查
类型补全示例
// 不完整的类型定义
interface User {
name: string;
// age 类型缺失
address?: any; // 使用 any 类型
}
// 完整的类型定义
interface User {
name: string;
age: number;
address?: {
street: string;
city: string;
zipCode: string;
};
}
3. Zod 验证集成
确保运行时验证与 TypeScript 类型定义的一致性。
验证检查
- Schema 匹配:Zod schema 与 TypeScript 接口的对应关系
- 验证逻辑:运行时验证的完整性和正确性
- 错误处理:验证失败时的错误处理逻辑
- 类型推断:Zod 的
z.infer类型使用
集成示例
import { z } from "zod";
// TypeScript 接口
interface LightControlParams {
name: string;
action: "turn_on" | "turn_off";
brightness?: number;
}
// Zod 验证 Schema
const lightControlSchema = z.object({
name: z.string(),
action: z.enum(["turn_on", "turn_off"]),
brightness: z.number().min(1).max(100).optional(),
});
// 类型推断确保一致性
type LightControlParams = z.infer<typeof lightControlSchema>;
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.
- 7d ago First seen · 458 lines · 8 tokens per session scan A 2d0a8120bde8
type-validator is a skill published in the GitHub repository shenjingnan/xiaozhi-client (338 stars, last pushed 3d ago), licensed MIT. It adds 8 tokens to every session and 3,168 once invoked, about $0.0000 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.
Other skills, from other repositories
no-bare-casts
Writing as in TypeScript or TSX production code, modifying a file that contains a bare as cast, silencing a type error with a cast, encountering as unknown as, or reviewing a cast site.
aws-sst-development
SST v4 (Ion) expert for managing AWS resources as code with the Pulumi-backed framework.
league-akari-shard-development
Use when creating, extending, refactoring, splitting, or reviewing League Akari main or renderer shards, including shard file organization, controller/loader/executor/handler boundaries, naming conventions, renderer TSX usage, platform guards, and public contract compatibility.
dd-code-generation
Use pup CLI for immediate Datadog operations or generate code for integration into applications.
migrate-better-result-3
Migrate a TypeScript codebase from better-result 2.x to 3.0. Use when upgrading better-result across the TaggedError syntax, removed Result serialization helpers, recovery inference, matching, or retry APIs.
fast-typescript-check
Keep www-sacred's TypeScript fast to type-check and fast to run. Use when touching the ASCII/canvas animation components (the only real per-frame code here), tightening type-check wall-clock, or auditing a change for runtime or compiler regressions. Scoped to this repo — a React 19 / Next.js 16 component library plus…