database
Produktionsreife Datenbankoperationen erstellen
Datenbankcode von Grund auf zu schreiben führt zu Verbindungslecks, langsamen Abfragen und Migrationsproblemen. Diese Fähigkeit bietet erprobte Muster für asynchrone Datenbankoperationen, Connection Pooling, Migrationen und Performance-Optimierung, die PostgreSQL, MySQL und SQLite unterstützen.
تنزيل ZIP المهارة
رفع في Claude
اذهب إلى Settings → Capabilities → Skills → Upload skill
فعّل وابدأ الاستخدام
اختبرها
استخدام "database". Create a User model with email, username, full name, and is_active fields with proper indexes
النتيجة المتوقعة:
- Model includes email and username as unique indexed fields
- Uses Text for longer content like bio field
- Created_at and updated_at timestamps with server defaults
- Composite indexes for common query patterns
- Soft delete mixin available for logical deletion
استخدام "database". Set up async PostgreSQL connection with connection pooling for production
النتيجة المتوقعة:
- Async engine created with postgresql+asyncpg driver
- Connection pool configured with pool_size=30 and max_overflow=40
- Pool_pre_ping enabled to detect stale connections
- Pool_recycle set to 3600 seconds for connection rotation
- Environment-based configuration for different environments
استخدام "database". Write an Alembic migration to add a new table for user profiles
النتيجة المتوقعة:
- Migration file includes upgrade() and downgrade() functions
- Creates user_profiles table with user_id foreign key
- Adds unique index on user_id to enforce one-to-one relationship
- Includes proper column definitions with nullable constraints
التدقيق الأمني
مخاطر منخفضةThis skill is pure documentation (SKILL.md only) containing database best practices and code examples. Static findings are false positives - the scanner detects SQLAlchemy's session.exec() method as Python exec(), database URLs in documentation as credential exposure, and hardcoded example strings as malicious patterns. No executable code, no network calls, no file operations exist in this skill.
عوامل الخطر
🌐 الوصول إلى الشبكة (1)
📁 الوصول إلى نظام الملفات (1)
⚡ يحتوي على سكربتات (6)
⚙️ الأوامر الخارجية (23)
🔑 متغيرات البيئة (5)
درجة الجودة
ماذا يمكنك بناءه
Produktionsdatenbankschicht einrichten
Asynchrone Verbindungen, Connection Pooling und Migrationen für eine neue Python-Webanwendung konfigurieren.
Abfrageperformance optimieren
Langsame Abfragen analysieren, geeignete Indizes hinzufügen und Caching-Strategien für große Datensätze implementieren.
Produktionsdatenbanken konfigurieren
Verbindungslimits, Überwachung, Backup-Strategien und Sicherheitskonfigurationen einrichten.
جرّب هذه الموجهات
Create SQLModel models for a [entity name] with fields for [field descriptions], including timestamps, soft delete, and proper indexes.
Set up async database connection with SQLAlchemy including connection pooling for [development/production] with pool size [number] and max overflow [number].
Create a repository class for [model name] with methods for create, get, get_multi, update, remove, and count with proper async support.
Write an Alembic migration to [describe schema change] including upgrading and downgrading functions.
أفضل الممارسات
- Verwenden Sie immer asynchrone Sessions mit expire_on_commit=False für bessere Performance
- Implementieren Sie Connection Pooling mit geeigneter Pool-Größe basierend auf erwarteten gleichzeitigen Benutzern
- Fügen Sie Indizes für Fremdschlüssel und häufig gefilterte Spalten hinzu, um Abfragen zu optimieren
تجنب
- Verwenden Sie keine synchronen Datenbankaufrufe in asynchronem FastAPI oder anderen asynchronen Frameworks
- Committen Sie Transaktionen nicht manuell, wenn Sie Context-Manager für Sessions verwenden
- Überspringen Sie keine Indizes auf Fremdschlüsselspalten, da dies N+1-Abfrageprobleme verursacht