cc-skill-backend-patterns
Skalierbare Backend-Systeme entwickeln
Backend-Anwendungen leiden häufig unter schlechter Architektur, Skalierbarkeitsproblemen und Sicherheitslücken. Diese Fähigkeit bietet bewährte Muster für API-Design, Datenbankoptimierung, Caching, Authentifizierung und Fehlerbehandlung.
Télécharger le ZIP du skill
Importer dans Claude
Allez dans Paramètres → Capacités → Skills → Importer un skill
Activez et commencez à utiliser
Tester
Utilisation de "cc-skill-backend-patterns". Zeige mir, wie man eine RESTful API für eine Produktressource entwirft
Résultat attendu:
GET /api/products - List all products
GET /api/products/:id - Get single product
POST /api/products - Create product
PUT /api/products/:id - Replace product
PATCH /api/products/:id - Update product
DELETE /api/products/:id - Delete product
Query params: ?status=active&sort=price&limit=20&offset=0
Utilisation de "cc-skill-backend-patterns". Wie vermeide ich N+1-Abfragen beim Abrufen von Bestellungen mit Kunden?
Résultat attendu:
Instead of:
for (const order of orders) {
order.customer = await getCustomer(order.customerId)
}
Use:
const customerIds = orders.map(o => o.customerId)
const customers = await getCustomers(customerIds)
const customerMap = new Map(customers.map(c => [c.id, c]))
orders.forEach(o => o.customer = customerMap.get(o.customerId))
Utilisation de "cc-skill-backend-patterns". Erstelle eine JWT-Authentifizierungs-Middleware
Résultat attendu:
export function verifyToken(token: string) {
try {
return jwt.verify(token, process.env.JWT_SECRET!)
} catch (error) {
throw new ApiError(401, 'Invalid token')
}
}
export async function requireAuth(request: Request) {
const token = request.headers.get('authorization')?.replace('Bearer ', '')
if (!token) throw new ApiError(401, 'Missing token')
return verifyToken(token)
}
Audit de sécurité
Risque faibleEducational backend development patterns skill. Static analyzer flagged numerous false positives due to misidentification of code comments as shell commands, environment variable access as sensitive data exposure, and URL paths as reconnaissance. True positive finding: JWT secret accessed via process.env - standard secure practice. No malicious behavior detected.
Problèmes à risque faible (1)
Facteurs de risque
🔑 Variables d’environnement (1)
Motifs détectés
Score de qualité
Ce que vous pouvez construire
Neue API-Endpunkte entwerfen
Architekten und Entwickler, die neue REST-APIs erstellen, können die ressourcenbasierten URL-Muster und Middleware-Ansätze für konsistentes, wartbares API-Design anwenden.
Langsame Datenbankabfragen optimieren
Entwickler mit Performance-Problemen können N+1-Abfrageprobleme mit Batch-Fetching und Abfrageoptimierungsmustern identifizieren und beheben.
Sichere Authentifizierung implementieren
Entwickler, die Authentifizierung hinzufügen, können JWT-Validierung und rollenbasierte Zugriffskontrolle nach Sicherheits-Best-Practices implementieren.
Essayez ces prompts
Design a RESTful API structure for a [resource] resource. Include endpoints for listing, getting by ID, creating, updating, and deleting. Show query parameter examples for filtering and pagination.
I have a function that fetches a list of orders and then loops through each to get customer details. This is causing slow performance. Show me how to refactor this using the batch fetch pattern to avoid N+1 queries.
Show me how to implement JWT token validation and a requireAuth middleware for protecting API routes. Include error handling for invalid tokens.
Create a cache-aside pattern implementation using Redis for a getUser function. Include cache hit/miss logic and cache invalidation.
Bonnes pratiques
- Trennung der Zuständigkeiten mit Repository-, Service- und Controller-Schichten für wartbaren Code
- Eingabe immer mit Schema-Validierungsbibliotheken wie Zod vor der Verarbeitung validieren
- Caching strategisch implementieren – teure Operationen cachen, aber ordnungsgemäß invalidieren
Éviter
- Nicht alle Spalten mit SELECT * auswählen – nur benötigte Felder angeben für bessere Performance
- Verschachtelte Datenbankaufrufe in Schleifen vermeiden – stattdessen Batch-Fetches verwenden
- Rohdatenbankfehler nicht an Clients exponieren – zentralisierte Fehlerbehandlung verwenden
Foire aux questions
Welche Sprachen und Frameworks deckt diese Fähigkeit ab?
Wie wähle ich zwischen PUT und PATCH?
Wann sollte ich Redis vs. In-Memory-Caching verwenden?
Wie handhabe ich Authentifizierung in Serverless-Funktionen?
Was ist die empfohlene Struktur für ein Backend-Projekt?
Wie implementiere ich Rate-Limiting korrekt?
Détails du développeur
Auteur
affaan-mLicence
MIT
Dépôt
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/cc-skill-backend-patternsRéf
main
Structure de fichiers
📄 SKILL.md