用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/tomes --skill best-practices命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
> Use when this capability is needed.
Use when writing kernel, account, or note MASM code that reads from or writes to the advice provider (advice stack / advice map) — validate advice data.
Use when writing a Rust test that exercises a failure path or a MASM test that expects a `panic` / `assert` — assert on the specific expected error variant or error code.
基于 SOC 职业分类
正在显示 SKILL.md
| name | best-practices |
| description | Use when refactoring or implementing features - validation, component design, API research |
| metadata | {"author":"andyngdz"} |
Use this skill when implementing features or refactoring code to follow established patterns.
When copying code from elsewhere in the codebase:
Examples:
// ✅ Good - component encapsulates its own dependencies
export const ImageGrid: FC<{ images: Image[] }> = ({ images }) => {
const baseURL = useBackendUrl()
return <div>{/* render images with baseURL */}</div>
}
// ❌ Avoid - unnecessary prop drilling
export const ImageGrid: FC<{ images: Image[]; baseURL: string }> = ({
images,
baseURL
}) => {
return <div>{/* render images */}</div>
}
Example:
// ❌ Bad - duplicated configuration
// file1.ts
const options = { timeout: 5000, retries: 3 }
// file2.ts
const options = { timeout: 5000, retries: 3 }
// ✅ Good - extracted to shared constant
// constants.ts
export const API_OPTIONS = { timeout: 5000, retries: 3 }
// file1.ts & file2.ts
import { API_OPTIONS } from './constants'
Example:
// ❌ Bad - defensive code based on assumptions
const value = api.getValue()
if (value === null || value === undefined || value === '') {
// Assuming getValue() can return null/undefined/empty
}
// ✅ Good - verified that getValue() only returns string or throws
try {
const value = api.getValue() // Documentation: returns string or throws
// Use value directly
} catch (error) {
// Handle error case
}
Over-validation:
Premature abstraction:
Ignoring performance:
See @docs/CODING_STYLE.md for detailed coding standards.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.