بنقرة واحدة
clean-code
Code quality principles and best practices
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Code quality principles and best practices
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Pull request lifecycle domain knowledge — branch strategy detection, PR size classification, confidence-scored review, git-aware context, PR analytics, dependency management, and split/merge/describe operations.
Production readiness audit domains, weighted scoring criteria, and check specifications for the /preflight workflow.
Application scaffolding orchestrator. Creates full-stack applications from requirements, selects tech stack, coordinates agents.
Production deployment workflows, rollback strategies, and CI/CD best practices.
Internationalization and localization patterns for multi-language applications
Mobile UI/UX patterns for iOS and Android. Touch-first, platform-respectful design with React Native/Expo focus.
| name | clean-code |
| description | Code quality principles and best practices |
| triggers | ["context","code","quality","review"] |
Purpose: Write maintainable, readable, and professional code
This skill applies Robert C. Martin's Clean Code principles and industry best practices for writing professional-grade code.
// ❌ Bad
const d = new Date();
const u = users.filter((x) => x.active);
// ✅ Good
const currentDate = new Date();
const activeUsers = users.filter((user) => user.isActive);
// ❌ Bad
function process(data) { ... }
function handle(x) { ... }
// ✅ Good
function validateUserInput(formData) { ... }
function calculateTotalPrice(orderItems) { ... }
// ❌ Bad
class Data { ... }
class Manager { ... }
// ✅ Good
class UserRepository { ... }
class OrderService { ... }
// ❌ Bad - does too much
function processOrder(order) {
validateOrder(order);
calculateTotal(order);
saveToDatabase(order);
sendEmail(order);
}
// ✅ Good - one responsibility each
function validateOrder(order) { ... }
function calculateOrderTotal(order) { ... }
function persistOrder(order) { ... }
function notifyCustomer(order) { ... }
// ❌ Bad
function createUser(name, email, age, address, phone, role) { ... }
// ✅ Good
function createUser(userData: CreateUserDto) { ... }
// ❌ Bad
try {
doSomething();
} catch (e) {
console.log(e);
}
// ✅ Good
try {
await processPayment(order);
} catch (error) {
logger.error("Payment processing failed", { orderId: order.id, error });
throw new PaymentFailedError(order.id, error.message);
}
// ❌ Bad - obvious comment
// Increment counter by 1
counter++;
// ✅ Good - explains WHY
// Offset for 0-based index when displaying to users
const displayIndex = arrayIndex + 1;
| Principle | Guideline |
|---|---|
| Names | Intention-revealing |
| Functions | Small, single purpose |
| Parameters | ≤3 ideally |
| Comments | Explain why, not what |
| Formatting | Consistent, readable |
| Error Handling | Explicit, informative |
| DRY | Don't repeat yourself |
| KISS | Keep it simple |