Habilidades database
🗄️

database

Baixo Risco 🌐 Acesso à rede📁 Acesso ao sistema de arquivos⚡ Contém scripts⚙️ Comandos externos🔑 Variáveis de ambiente

Build Production-Ready Database Operations

Writing database code from scratch leads to connection leaks, slow queries, and migration headaches. This skill provides battle-tested patterns for async database operations, connection pooling, migrations, and performance optimization that work across PostgreSQL, MySQL, and SQLite.

Suporta: Claude Codex Code(CC)
⚠️ 66 Ruim
1

Baixar o ZIP da skill

2

Upload no Claude

Vá em Configurações → Capacidades → Skills → Upload skill

3

Ative e comece a usar

Testar

A utilizar "database". Create a User model with email, username, full name, and is_active fields with proper indexes

Resultado esperado:

  • 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

A utilizar "database". Set up async PostgreSQL connection with connection pooling for production

Resultado esperado:

  • 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

A utilizar "database". Write an Alembic migration to add a new table for user profiles

Resultado esperado:

  • 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

Auditoria de Segurança

Baixo Risco
v5 • 1/16/2026

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.

3
Arquivos analisados
1,059
Linhas analisadas
5
achados
5
Total de auditorias
Auditado por: claude Ver Histórico de Auditoria →

Pontuação de qualidade

38
Arquitetura
100
Manutenibilidade
87
Conteúdo
21
Comunidade
90
Segurança
74
Conformidade com especificações

O Que Você Pode Construir

Set up production database layer

Configure async connections, connection pooling, and migrations for a new Python web application.

Optimize query performance

Analyze slow queries, add proper indexes, and implement caching strategies for large datasets.

Configure production databases

Set up connection limits, monitoring, backup strategies, and security configurations.

Tente Estes Prompts

Create database models
Create SQLModel models for a [entity name] with fields for [field descriptions], including timestamps, soft delete, and proper indexes.
Set up async connections
Set up async database connection with SQLAlchemy including connection pooling for [development/production] with pool size [number] and max overflow [number].
Build repository pattern
Create a repository class for [model name] with methods for create, get, get_multi, update, remove, and count with proper async support.
Write migration script
Write an Alembic migration to [describe schema change] including upgrading and downgrading functions.

Melhores Práticas

  • Always use async sessions with expire_on_commit=False for better performance
  • Implement connection pooling with appropriate pool size based on expected concurrent users
  • Add indexes on foreign keys and frequently filtered columns to optimize queries

Evitar

  • Do not use synchronous database calls in async FastAPI or other async frameworks
  • Do not commit transactions manually when using context managers for sessions
  • Do not skip indexes on foreign key columns as this causes N+1 query problems

Perguntas Frequentes

Which databases are supported?
PostgreSQL, MySQL, and SQLite are fully supported. Any database with a SQLAlchemy async driver works.
What is the maximum connection pool size?
Pool size depends on your database limits. Start with pool_size=30 and max_overflow=40 for medium workloads.
How does this integrate with FastAPI?
Use the async sessionmaker with FastAPI dependencies. Inject sessions into route handlers for proper lifecycle management.
Is my data safe when using these patterns?
Yes. These patterns include connection disposal, proper transaction handling, and security recommendations for production.
Why are my queries slow?
Check for missing indexes, N+1 query patterns, or missing eager loading. Use the query analyzer to identify bottlenecks.
How is this different from raw SQL?
SQLModel provides type safety, relationship handling, and migrations. Raw SQL is faster for bulk operations but harder to maintain.

Detalhes do Desenvolvedor

Estrutura de arquivos