best-practices
Use when refactoring or implementing features - validation, component design, API research
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when refactoring or implementing features - validation, component design, API research
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | best-practices |
| description | Use when refactoring or implementing features - validation, component design, API research |
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.
Use when starting work - guidelines for asking questions and commit policies
Use always - non-negotiable rules for TypeScript safety, socket events, and React patterns
Use when working with Electron - IPC security, renderer isolation, Node API access
Use when writing tests - test structure, verification steps, coverage goals