Typescript Style
tjx666/vscode-mcp
TypeScript code style and repo conventions for VSCode MCP — inference vs explicit types, ESM import suffixes, zod schema contracts, async VSCode/Node APIs, JSON-safe IPC results, JSDoc for public…
“TypeScript严格模式检查”
$ npx skills add shenjingnan/xiaozhi-client --skill type-validator -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install shenjingnan/xiaozhi-client type-validator --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/shenjingnan/xiaozhi-client.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/type-validator .claude/skills/type-validator && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "type-validator" agent skill from https://github.com/shenjingnan/xiaozhi-client/tree/main/.agents/skills/type-validator into .claude/skills/type-validator/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "type-validator", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/shenjingnan/xiaozhi-client/tree/main/.agents/skills/type-validatorType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add shenjingnan/xiaozhi-client --skill type-validator -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install shenjingnan/xiaozhi-client type-validator --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/shenjingnan/xiaozhi-client.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/type-validator .agents/skills/type-validator && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "type-validator" agent skill from https://github.com/shenjingnan/xiaozhi-client/tree/main/.agents/skills/type-validator into .agents/skills/type-validator/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "type-validator", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add shenjingnan/xiaozhi-client --skill type-validator -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install shenjingnan/xiaozhi-client type-validator --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/shenjingnan/xiaozhi-client.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/type-validator .cursor/skills/type-validator && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "type-validator" agent skill from https://github.com/shenjingnan/xiaozhi-client/tree/main/.agents/skills/type-validator into .cursor/skills/type-validator/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "type-validator", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/shenjingnan/xiaozhi-client.git --path .agents/skills/type-validator--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add shenjingnan/xiaozhi-client --skill type-validator -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install shenjingnan/xiaozhi-client type-validator --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/shenjingnan/xiaozhi-client.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/type-validator .gemini/skills/type-validator && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "type-validator" agent skill from https://github.com/shenjingnan/xiaozhi-client/tree/main/.agents/skills/type-validator into .gemini/skills/type-validator/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "type-validator", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install shenjingnan/xiaozhi-client type-validatorInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add shenjingnan/xiaozhi-client --skill type-validator -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/shenjingnan/xiaozhi-client.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/type-validator .github/skills/type-validator && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "type-validator" agent skill from https://github.com/shenjingnan/xiaozhi-client/tree/main/.agents/skills/type-validator into .github/skills/type-validator/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "type-validator", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add shenjingnan/xiaozhi-client --skill type-validator -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install shenjingnan/xiaozhi-client type-validator --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/shenjingnan/xiaozhi-client.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/type-validator .opencode/skills/type-validator && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "type-validator" agent skill from https://github.com/shenjingnan/xiaozhi-client/tree/main/.agents/skills/type-validator into .opencode/skills/type-validator/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "type-validator", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
type-validatorType Validator is a skill in shenjingnan/xiaozhi-client (341 stars). Its SKILL.md is about 2.2k tokens. Licence: MIT.
12 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit fe3c382. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
pnpmnpxFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use pnpm and npx, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Type Validator loads about 2.2k tokens when it runs. Until then it costs about 8 tokens; SKILL.md has 184 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from shenjingnan/xiaozhi-client at commit fe3c382, republished under its MIT licence (© shenjingnan). 184 words, ~2,189 tokens.
.claude/skills/type-validator/SKILL.md (or your agent's skills folder).我是 TypeScript 严格模式检查技能,专门针对 xiaozhi-client 项目的 TypeScript 配置进行类型安全检查和修复建议,同时遵循务实开发理念。
核心能力:检测并修复所有 any 类型的使用,符合项目的严格类型要求。
const/let/var 声明的 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"
};
}确保所有接口、类型定义和函数都有完整的类型注解。
? 标记可选属性// 不完整的类型定义
interface User {
name: string;
// age 类型缺失
address?: any; // 使用 any 类型
}
// 完整的类型定义
interface User {
name: string;
age: number;
address?: {
street: string;
city: string;
zipCode: string;
};
}确保运行时验证与 TypeScript 类型定义的一致性。
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>;确保 xiaozhi-client 项目复杂路径别名系统的类型安全,避免别名使用导致的类型错误。
// 检查别名导入的类型定义(xiaozhi-client 项目 @/ 路径别名体系)
import { MCPConnection } from "@/mcp-core";
import { Container } from "@/cli";
import { StartCommand } from "@/cli/commands/start";
import { HandlerManager } from "@/server/handlers/HandlerManager";
import type { XiaozhiConfig, AppConfig } from "@/types";
// 验证导入的模块是否具有正确的类型定义
// 确保所有 @/ 别名指向 src/ 下的正确文件// 确保 xiaozhi-client 项目 @/ 路径别名映射不会导致类型冲突
interface XiaozhiClientTypeMapping {
"@/types": "./src/types"; // 共享类型定义
"@/config": "./src/config"; // 配置管理
"@/mcp-core": "./src/mcp-core"; // MCP 协议核心
"@/endpoint": "./src/endpoint"; // 端点处理
"@/esp32": "./src/esp32"; // ESP32 硬件相关
"@/cli": "./src/cli"; // CLI 命令行工具
"@/utils": "./src/utils"; // 通用工具
"@/server": "./src/server"; // 后端服务
}
// 验证映射的正确性和类型完整性与现有的 Biome 代码检查工具集成,确保类型检查与代码规范的一致性。
// 代码前
function processData(data: any): any {
return JSON.parse(data);
}
// 代码后
function processData(data: unknown): unknown {
if (typeof data === 'string') {
return JSON.parse(data);
}
throw new Error('Invalid data type');
}// 代码前
function setValue(value: any) {
// ...
}
// 代码后
function setValue(value: string | number | boolean) {
// ...
}// 代码前
function createResponse(data: any, status: any) {
return { data, status };
}
// 代码后
function createResponse<T, U extends number>(data: T, status: U) {
return { data, status };
}function isString(value: unknown): value is string {
return typeof value === 'string';
}
function isNumber(value: unknown): value is number {
return typeof value === 'number' && !isNaN(value);
}
function isArray(value: unknown): value is unknown[] {
return Array.isArray(value);
}function isMCPRequest(value: unknown): value is MCPRequest {
return (
typeof value === 'object' &&
value !== null &&
'jsonrpc' in value &&
(value as any).jsonrpc === '2.0' &&
'id' in value &&
'method' in value
);
}
function isXiaozhiConfig(value: unknown): value is XiaozhiConfig {
return (
typeof value === 'object' &&
value !== null &&
('mcpEndpoint' in value || 'mcpServers' in value)
);
}
function isTransportAdapter(value: unknown): value is TransportAdapter {
return (
typeof value === 'object' &&
value !== null &&
'connect' in value &&
'disconnect' in value &&
'send' in value
);
}export class ValidationError extends Error {
public readonly code: string;
public readonly field?: string;
constructor(message: string, code: string, field?: string) {
super(message);
this.name = 'ValidationError';
this.code = code;
if (field !== undefined) {
this.field = field;
}
}
}type Result<T, E = Error> =
| { success: true; data: T }
| { success: false; error: E };
function safeParse<T>(data: unknown, schema: z.Schema<T>): Result<T> {
try {
const result = schema.parse(data);
return { success: true, data: result };
} catch (error) {
if (error instanceof z.ZodError) {
return { success: false, error: new ValidationError(error.message, 'VALIDATION_ERROR') };
}
return { success: false, error: error as Error };
}
}interface TypeIssue {
type: 'any_usage' | 'missing_type' | 'invalid_cast' | 'unsafe_assignment';
severity: 'error' | 'warning' | 'info';
file: string;
line: number;
column: number;
message: string;
suggestion: string;
}
const issues: TypeIssue[] = scanTypeIssues(sourceCode);interface TypeAnalysis {
anyUsageCount: number;
missingTypes: string[];
invalidCasts: Array<{ from: string; to: string; line: number }>;
unsafeAssignments: Array<{ variable: string; type: string; line: number }>;
recommendations: string[];
}
const analysis = analyzeTypeIssues(issues);interface FixResult {
fixedIssues: number;
remainingIssues: TypeIssue[];
modifiedFiles: string[];
warnings: string[];
}
const result = applyTypeFixes(analysis, options);// 自动替换规则
const replacementRules = [
{
pattern: /const\s+(\w+)\s*:\s*any\s*=/,
replacement: (match, varName) => `const ${varName}: unknown =`
},
{
pattern: /function\s+(\w+)\s*\([^)]*\)\s*:\s*any\s*{/,
replacement: (match, fnName) => `function ${fnName}(): unknown {`
}
];// 自动添加类型注解
function inferAndAddTypes(ast: ASTNode): TypeAnnotation[] {
// 基于 AST 分析推断类型
// 生成适当的类型注解
}// 自动整理和优化类型导入
function organizeTypeImports(sourceFile: SourceFile): void {
// 确保所有必要的类型都已导入
// 移除未使用的类型导入
// 按照项目规范排序导入语句
}# 运行类型检查(xiaozhi-client 项目)
pnpm typecheck
# 运行代码规范和格式检查
pnpm lint
# 运行拼写检查
pnpm spellcheck
# 运行所有质量检查
pnpm check:all
# 运行测试并检查覆盖率
pnpm test:coverage// 确保类型检查不影响运行时性能
function performanceCheck() {
const start = performance.now();
// 类型检查逻辑
const end = performance.now();
console.log(`Type validation took ${end - start} milliseconds`);
}# 检查整个项目
npx type-validator check
# 检查特定文件
npx type-validator check src/services/light.ts
# 自动修复
npx type-validator fix --auto
# 生成报告
npx type-validator report --format json --output type-report.json# GitHub Actions 示例
- name: Type Validation
run: |
npx type-validator check --strict
npx type-validator report --format junit --output type-results.xml通过这个技能,可以确保 xiaozhi-client 项目始终保持高质量的 TypeScript 代码标准,减少运行时错误,提升开发效率。特别针对 MCP 协议的复杂类型和项目的路径别名系统提供专门的类型安全保障。
© shenjingnan, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/type-validator of shenjingnan/xiaozhi-client.
Open the folder on GitHubat commit fe3c382
Type Validator next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Type Validator this skillshenjingnan/xiaozhi-client | 341 | — | ~2.2k | Automated safety check: Pass | MIT | |
| Typescript Styletjx666/vscode-mcp | 106 | — | ~961 | Automated safety check: Pass | Custom licence | |
| Typed Service Contractsgoogle-labs-code/stitch-sdk | 1.8k | — | ~1.4k | Automated safety check: Pass | Apache-2.0 | |
| Add Server Env Var for User Settinglobehub/lobehub | 83k | — | ~644 | Automated safety check: Pass | Custom licence | |
| Ban Type AssertionsFactory-AI/factory-plugins | 110 | — | ~1.7k | Automated safety check: Pass | None | |
| Hono Idiomsirahardianto/awesome-agv | 157 | — | ~3k | Automated safety check: Pass | MIT |
tjx666/vscode-mcp
TypeScript code style and repo conventions for VSCode MCP — inference vs explicit types, ESM import suffixes, zod schema contracts, async VSCode/Node APIs, JSON-safe IPC results, JSDoc for public…
google-labs-code/stitch-sdk
Architecture standard for building robust, type-safe TypeScript services using the "Spec and Handler" pattern.
lobehub/lobehub
Adds a server-side environment variable that sets the default for a user setting in LobeHub, wired from the env schema through server config to the user store and docs.
Factory-AI/factory-plugins
Ban as type assertions in a package via the @typescript-eslint/consistent-type-assertions lint rule, replacing them with compiler-verified type-safe alternatives.
irahardianto/awesome-agv
Hono lightweight web framework patterns: type-safe route handlers, middleware composition, Zod validation, and RPC clients for Cloudflare Workers, Node, or Bun.
irahardianto/awesome-agv
Next.js App Router architecture: React Server Components (RSC), Server Actions, nested layouts, route handlers, and streaming.
shenjingnan/xiaozhi-client
分析当前分支 git 改动,检查 e2e 测试用例覆盖情况,并可补充缺失的测试用例. An agent skill from shenjingnan/xiaozhi-client.
shenjingnan/xiaozhi-client
GitHub 评论修复技能,用于获取 PR 的 Copilot 评论并分析修复问题. An agent skill from shenjingnan/xiaozhi-client.
shenjingnan/xiaozhi-client
文档自动生成
shenjingnan/xiaozhi-client
CI检查验证和质量保障
shenjingnan/xiaozhi-client
生成代码评审友好的 commit 信息
shenjingnan/xiaozhi-client
开发流程检查技能,确保代码修改后执行必要的质量检查
Works with
Categories
Run `npx skills add shenjingnan/xiaozhi-client --skill type-validator -a claude-code`. Or copy the skill folder (.agents/skills/type-validator in shenjingnan/xiaozhi-client) into .claude/skills/type-validator in your project. Claude Code loads it when a task matches its description.
Run `npx skills add shenjingnan/xiaozhi-client --skill type-validator -a codex`. Or copy the skill folder (.agents/skills/type-validator in shenjingnan/xiaozhi-client) into .agents/skills/type-validator in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add shenjingnan/xiaozhi-client --skill type-validator -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/type-validator, .gemini/skills/type-validator, .github/skills/type-validator and .opencode/skills/type-validator in your project.
Going by SKILL.md and its folder, Type Validator needs the command-line tools its instructions call (pnpm and npx).
SKILL.md contains no URLs. Its commands use npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Type Validator is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.2k tokens (SKILL.md is roughly 8.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Type Validator: Typescript Style (tjx666/vscode-mcp, 106 stars), Typed Service Contracts (google-labs-code/stitch-sdk, 1.8k stars), Add Server Env Var for User Setting (lobehub/lobehub, 83k stars) and Ban Type Assertions (Factory-AI/factory-plugins, 110 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
shenjingnan (a GitHub user) maintains it in shenjingnan/xiaozhi-client, which has 341 GitHub stars. The repository holds 16 skills in this directory. The repository was last updated on September 3, 2026.
Source: shenjingnan/xiaozhi-client on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.