一键导入
1k-code-quality
Code quality standards — lint (eslint/oxlint), type check (tsc), pre-commit hooks, and comment conventions. All comments must be in English.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Code quality standards — lint (eslint/oxlint), type check (tsc), pre-commit hooks, and comment conventions. All comments must be in English.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | 1k-code-quality |
| description | Code quality standards — lint (eslint/oxlint), type check (tsc), pre-commit hooks, and comment conventions. All comments must be in English. |
| allowed-tools | Read, Grep, Glob |
Linting, documentation, and general code quality standards for OneKey.
# Pre-commit (fast, only staged files)
yarn lint:staged
yarn tsc:staged
# CI only (full project check)
yarn lint # Comprehensive: TypeScript, ESLint, folder structure, i18n
yarn lint:only # Quick: oxlint only
yarn tsc:only # Full type check
Note: yarn lint is for CI only. For pre-commit, always use yarn lint:staged.
For fast pre-commit validation:
# Lint only modified files (recommended)
yarn lint:staged
# Or with type check
yarn lint:staged && yarn tsc:staged
// Unused variable - prefix with underscore
const { used, unused } = obj; // ❌ Error: 'unused' is defined but never used
const { used, unused: _unused } = obj; // ✅ OK
// Unused parameter - prefix with underscore
function foo(used: string, unused: number) {} // ❌ Error
function foo(used: string, _unused: number) {} // ✅ OK
// Floating promise - add void or await
someAsyncFunction(); // ❌ Error: Promises must be awaited
void someAsyncFunction(); // ✅ OK (fire-and-forget)
await someAsyncFunction(); // ✅ OK (wait for result)
All comments must be written in English:
// ✅ GOOD: English comment
// Calculate the total balance including pending transactions
// ❌ BAD: Chinese comment
// 计算总余额,包括待处理的交易
// ✅ GOOD: JSDoc in English
/**
* Fetches user balance from the blockchain.
* @param address - The wallet address to query
* @returns The balance in native token units
*/
async function fetchBalance(address: string): Promise<bigint> {
// ...
}
// ✅ GOOD: Explain non-obvious logic
// Use 1.5x gas limit to account for estimation variance on this chain
const gasLimit = estimatedGas * 1.5n;
// ✅ GOOD: Explain business logic
// Premium users get 50% discount on transaction fees
const fee = isPremium ? baseFee * 0.5 : baseFee;
// ❌ BAD: Obvious comment
// Set the value to 5
const value = 5;
Each function should perform a single, atomic task:
// ✅ GOOD: Single responsibility
async function fetchUserBalance(userId: string): Promise<Balance> {
const user = await getUser(userId);
return await getBalanceForAddress(user.address);
}
// ❌ BAD: Multiple responsibilities
async function fetchUserBalanceAndUpdateUI(userId: string) {
const user = await getUser(userId);
const balance = await getBalanceForAddress(user.address);
setBalanceState(balance);
showNotification('Balance updated');
logAnalytics('balance_fetched');
}
Don't create helpers for one-time operations:
// ❌ BAD: Over-abstracted
const createUserFetcher = (config: Config) => {
return (userId: string) => {
return fetchWithConfig(config, `/users/${userId}`);
};
};
const fetchUser = createUserFetcher(defaultConfig);
const user = await fetchUser(userId);
// ✅ GOOD: Simple and direct
const user = await fetch(`/api/users/${userId}`).then(r => r.json());
See code-quality.md for comprehensive guidelines:
See fix-lint.md for complete lint fix workflow:
If a technical term triggers spellcheck errors:
# Check if word exists
grep -i "yourword" development/spellCheckerSkipWords.txt
# Add if not present (ask team lead first)
echo "yourword" >> development/spellCheckerSkipWords.txt
yarn lint:staged passesyarn tsc:staged passes/1k-sentry-analysis - Sentry error analysis and fixes/1k-test-version - Test version creation workflow/1k-coding-patterns - General coding patternsAnalytics event tracking for OneKey. Use when adding tracking events, logging to server, user behavior tracking, or business metrics. Covers the @LogToServer decorator pattern, logger scope/scene architecture, and common pitfalls. Triggers on "埋点", "统计", "打点", "数据追踪", "日志", "analytics", "tracking event", "Mixpanel", "LogToServer", "trackEvent", "defaultLogger".
Create test versions to verify app auto-update functionality and version migration.
Release branch management — checkout from release, prepare builds, pre-release diff checks, publish tracking, and sync back to x. Use this skill when managing release branches, creating branches for bundle releases, running pre-release diff checks, finalizing releases, or syncing release changes to x. Triggers on "bundle release", "release diff", "release publish", "release sync", "release checkout", "发布管理", "release 分支", "release management", "bundle-release", "bundle branch".
Comprehensive PR code review for OneKey monorepo. Use when reviewing PRs, code changes, or diffs — covers security (secrets/PII leakage, supply-chain, AuthN/AuthZ), code quality (hooks, race conditions, null safety, concurrent requests), and OneKey-specific patterns (Fabric crashes, MIUI, BigNumber). Triggers on "review PR", "review this PR", "code review", "check this diff", "审查 PR", "代码审查", "review
Coding patterns and best practices — React components, promise handling, and TypeScript conventions.
Creates a Pull Request from current changes for OneKey app-monorepo. Use when user wants to create PR, submit changes, or merge feature branch. Handles branch creation, commit, push, and PR creation with conversation context extraction for code review AI.