원클릭으로
database-query-optimizer
Use when optimizing SQLAlchemy queries or addressing N+1 problems
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when optimizing SQLAlchemy queries or addressing N+1 problems
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Record browser-based feature demos as GIFs via Playwright and optionally document them in docs/features/index.md. Trigger with "Demo <feature>" or "Demo and Document <feature>".
Use when creating service modules in apps/api/skillhub/services/
Use when writing API tests in apps/api/tests/
Use when implementing division-based access control on any endpoint
Use when adding services to docker-compose.yml or creating Dockerfiles
Use when implementing error handling across the API, frontend, or MCP server
| name | database-query-optimizer |
| description | Use when optimizing SQLAlchemy queries or addressing N+1 problems |
from sqlalchemy.orm import joinedload, selectinload
# joinedload = single JOIN query (good for to-one)
skills = db.query(Skill).options(joinedload(Skill.category_rel)).all()
# selectinload = separate IN query (good for to-many)
skills = db.query(Skill).options(selectinload(Skill.divisions)).all()
CREATE INDEX idx_skills_category ON skills(category);
CREATE INDEX idx_skills_status ON skills(status);
CREATE INDEX idx_skills_trending ON skills(trending_score DESC);
CREATE INDEX idx_installs_skill_user ON installs(skill_id, user_id);
CREATE INDEX idx_favorites_user ON favorites(user_id);
CREATE INDEX idx_audit_log_event ON audit_log(event_type, created_at);
Counters on skills table (install_count, etc.) avoid expensive COUNT queries. Trade-off: must update on every social action. Source of truth = join table; counter = cache.
EXPLAIN ANALYZE SELECT * FROM skills WHERE category = 'testing' ORDER BY trending_score DESC LIMIT 20;
apps/api/skillhub/services/skills.pylibs/db/skillhub_db/models/