feat: biblioteca inteligente libs/ + 5 novas skills (20 skills total)
NOVAS SKILLS: - next-best-practices v0.1.0 (CLEAN) — Next.js App Router, RSC, caching, data - nextjs-patterns v1.0.0 (CLEAN) — Next.js 15: Server Actions, route handlers - vite v1.0.0 (CLEAN) — env vars, aliases, proxy, CJS compat - uncle-bob v1.0.0 (CLEAN) — Clean Code, SOLID, Clean Architecture - clean-code-review v1.0.0 (CLEAN) — naming, guard clauses, anti-patterns, refactoring - vue v1.0.0 (CLEAN) — Vue framework - vue-composition-api-best-practices v1.0.0 (CLEAN) — composables, Pinia, reactivity BIBLIOTECA INTELIGENTE libs/ (10 dominios, 11 arquivos): - typescript/ — TS safe + generics gotchas - react/ — Next.js App Router + Vite config - vue/ — Composition API + Pinia - linux/ — System diagnostic cheatsheet - database/ — PostgreSQL + MySQL patterns - browser/ — Chromium CLI + E2E testing - security/ — SAST audit (OWASP Top 10) - best-practices/ — Clean Code + SOLID + Clean Architecture - deploy/ — Docker multi-stack + OpenClaw ops - + INDEX.md como guia de navegacao .learnings/ — LRN-20260519-003 criado (biblioteca compartilhada)
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# Clean Code — Copilot Instructions
|
||||
|
||||
## Instructions
|
||||
|
||||
Follow these pragmatic coding standards in all generated code. Be concise, direct, and solution-focused. Never over-engineer.
|
||||
|
||||
## Core Principles
|
||||
|
||||
Apply these principles to every piece of code:
|
||||
|
||||
- **SRP** — Single Responsibility. Each function/class does ONE thing.
|
||||
- **DRY** — Don't Repeat Yourself. Extract shared logic.
|
||||
- **KISS** — Keep It Simple. Simplest solution that works.
|
||||
- **YAGNI** — Don't build features that aren't needed yet.
|
||||
|
||||
## Naming Patterns
|
||||
|
||||
```
|
||||
// Variables — reveal intent
|
||||
✅ userCount, isAuthenticated, orderTotal
|
||||
❌ n, flag, x
|
||||
|
||||
// Functions — verb + noun
|
||||
✅ getUserById(), calculateTotal(), sendEmail()
|
||||
❌ user(), calc(), email()
|
||||
|
||||
// Booleans — question form
|
||||
✅ isActive, hasPermission, canEdit
|
||||
❌ active, permission, edit
|
||||
```
|
||||
|
||||
## Function Structure
|
||||
|
||||
Keep functions small (5–20 lines), with max 3 arguments. Use guard clauses:
|
||||
|
||||
```typescript
|
||||
// ✅ Guard clauses — flat and readable
|
||||
function processOrder(order: Order): Result {
|
||||
if (!order) return { error: 'No order' };
|
||||
if (!order.items.length) return { error: 'Empty order' };
|
||||
if (!order.payment) return { error: 'No payment' };
|
||||
|
||||
const total = calculateTotal(order.items);
|
||||
return chargeAndFulfill(order, total);
|
||||
}
|
||||
```
|
||||
|
||||
## Anti-Patterns to Avoid
|
||||
|
||||
- Don't comment obvious code — let names self-document
|
||||
- Don't create helpers for one-liners — inline instead
|
||||
- Don't create `utils.ts` for a single function
|
||||
- Don't use magic numbers — define named constants
|
||||
- Don't write functions over 20 lines — split by responsibility
|
||||
- Don't nest deeper than 2 levels — use early returns
|
||||
|
||||
## Before Editing Files
|
||||
|
||||
Always check: what imports this file, what tests cover it, and whether dependent files need updates too. Edit all affected files together.
|
||||
Reference in New Issue
Block a user