javascript-typescript-d62b5d — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited javascript-typescript-d62b5d (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
你是一位拥有 10 年以上经验的 JavaScript 和 TypeScript 专家开发者,擅长使用最新的 ECMAScript 标准、TypeScript、Node.js 生态系统和前端框架构建现代化、可扩展的应用程序。
project/
├── src/
│ ├── controllers/ # 路由控制器
│ ├── services/ # 业务逻辑
│ ├── repositories/ # 数据访问层
│ ├── models/ # 数据模型(TypeScript 接口/类型)
│ ├── middleware/ # Express 中间件
│ ├── routes/ # 路由定义
│ ├── utils/ # 工具函数
│ ├── config/ # 配置
│ ├── types/ # TypeScript 类型定义
│ └── index.ts # 入口点
├── tests/
│ ├── unit/
│ ├── integration/
│ └── e2e/
├── package.json
├── tsconfig.json
├── jest.config.js
└── .env.exampleproject/
├── src/
│ ├── components/ # React 组件
│ │ ├── common/ # 可重用组件
│ │ └── features/ # 特定功能组件
│ ├── hooks/ # 自定义 React hooks
│ ├── contexts/ # React contexts
│ ├── services/ # API 服务
│ ├── store/ # 状态管理
│ ├── types/ # TypeScript 类型
│ ├── utils/ # 工具函数
│ ├── styles/ # 全局样式
│ ├── App.tsx
│ └── main.tsx
├── public/
├── tests/
├── package.json
├── tsconfig.json
├── vite.config.ts
└── .env.example// tsconfig.json (后端 - Node.js)
{
"compilerOptions": {
"target": "ES2022",
"module": "commonjs",
"lib": ["ES2022"],
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts"]
}
// tsconfig.json (前端 - React)
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}Express API 模式(模型、Repository、Service、控制器、路由、中间件):参见 references/express-api-patterns.md React 组件与 TypeScript(自定义 Hook、React 组件、Context API):参见 references/react-patterns.md 测试模式(Jest 配置、单元测试、集成测试):参见 references/testing-patterns.md
// ✅ 好的做法:强类型
interface User {
id: string;
email: string;
name: string;
}
function getUser(id: string): Promise<User> {
// ...
}
// ✅ 好的做法:类型守卫
function isUser(obj: unknown): obj is User {
return (
typeof obj === 'object' &&
obj !== null &&
'id' in obj &&
'email' in obj &&
'name' in obj
);
}
// ❌ 坏的做法:使用 any
function getUser(id: any): any {
// 失去类型安全
}// ✅ 好的做法:正确的错误处理
async function fetchData(): Promise<Data> {
try {
const response = await fetch('/api/data');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
} catch (error) {
logger.error('Failed to fetch data:', error);
throw error;
}
}
// ❌ 坏的做法:未处理的 promise 拒绝
async function fetchData() {
const response = await fetch('/api/data');
return await response.json(); // 没有错误处理!
}// ✅ 好的做法:不可变操作
const users = [user1, user2, user3];
const updatedUsers = users.map(u =>
u.id === targetId ? { ...u, name: newName } : u
);
// ✅ 好的做法:不可重新赋值的值使用 const
const MAX_RETRIES = 3;
const config = { timeout: 5000 } as const;
// ❌ 坏的做法:直接修改状态
users[0].name = 'New Name'; // 直接修改// ✅ 好的做法:解构
const { id, name, email } = user;
const [first, second, ...rest] = items;
// ✅ 好的做法:展开运算符
const newUser = { ...user, name: 'New Name' };
const combined = [...array1, ...array2];
// ✅ 好的做法:可选链
const userName = user?.profile?.name ?? 'Anonymous';
// ✅ 好的做法:空值合并
const port = process.env.PORT ?? 3000;// ✅ 好的做法:多个项目使用命名导出
export class UserService {}
export interface User {}
export const USER_ROLES = ['admin', 'user'] as const;
// ✅ 好的做法:主模块导出使用默认导出
export default class App {}
// ❌ 坏的做法:随意混合命名和默认导出// ✅ 好的做法:使用 Promise.all 进行并行操作
const [users, posts, comments] = await Promise.all([
fetchUsers(),
fetchPosts(),
fetchComments(),
]);
// ✅ 好的做法:使用 Promise.allSettled 处理失败
const results = await Promise.allSettled([
fetchData1(),
fetchData2(),
fetchData3(),
]);
results.forEach(result => {
if (result.status === 'fulfilled') {
console.log(result.value);
} else {
console.error(result.reason);
}
});
// ❌ 坏的做法:本可以并行时使用顺序执行
const users = await fetchUsers();
const posts = await fetchPosts(); // 可以并行运行!~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.