📦 Sqlalchemy Code Review — 技能工具
v1.1.0审查 SQLAlchemy 2.0 代码的会话生命周期、模型关系、N+1 查询及迁移模式,确保性能与一致性。
0· 90·1 当前·1 累计
安全扫描
OpenClaw
安全
high confidenceThe skill is an instruction-only SQLAlchemy code-review checklist and reference bundle whose requested resources and actions are consistent with its stated purpose.
安全有层次,运行前请审查代码。
运行时依赖
无特殊依赖
版本
latestv1.1.02026/3/27
Version 1.1.0 of sqlalchemy-code-review adds a comprehensive reference and review checklist for SQLAlchemy 2.0 code practices. - Introduced a clear description of skill usage and review focus areas. - Added quick-reference links for common SQLAlchemy and Alembic issues. - Included a detailed checklist for reviewing session management, relationships, queries, and migrations. - Provided guidance on when to consult reference materials. - Listed key review questions to help ensure code quality and best practices.
● 无害
安装命令
点击复制官方npx clawhub@latest install sqlalchemy-code-review
🇨🇳 镜像加速npx clawhub@latest install sqlalchemy-code-review --registry https://cn.longxiaskill.com
技能文档
Quick Reference
| Issue Type | Reference |
|---|---|
| Session lifecycle, context managers, async sessions | references/sessions.md |
| relationship(), lazy loading, N+1, joinedload | references/relationships.md |
| select() vs query(), ORM overhead, bulk ops | references/queries.md |
| Alembic patterns, reversible migrations, data migrations | references/migrations.md |
Review Checklist
- [ ] Sessions use context managers (
with,async with) - [ ] No session sharing across requests or threads
- [ ] Sessions closed/cleaned up properly
- [ ]
relationship()uses appropriatelazystrategy - [ ] Explicit
joinedload/selectinloadto avoid N+1 - [ ] No lazy loading in loops (N+1 queries)
- [ ] Using SQLAlchemy 2.0
select()syntax, not legacyquery() - [ ] Bulk operations use bulk_insert/bulk_update, not ORM loops
- [ ] Async sessions use proper async context managers
- [ ] Migrations are reversible with
downgrade() - [ ] Data migrations use
op.execute()not ORM models - [ ] Migration dependencies properly ordered
When to Load References
- Reviewing session creation/cleanup → sessions.md
- Reviewing model relationships → relationships.md
- Reviewing database queries → queries.md
- Reviewing Alembic migration files → migrations.md
Review Questions
- Are all sessions properly managed with context managers?
- Are relationships configured to avoid N+1 queries?
- Are queries using SQLAlchemy 2.0
select()syntax? - Are all migrations reversible and properly tested?
数据来源:ClawHub ↗ · 中文优化:龙虾技能库