返回顶部
s

sqlalchemy-code-reviewSQLAlchemy代码审查

Reviews SQLAlchemy code for session management, relationships, N+1 queries, and migration patterns. Use when reviewing SQLAlchemy 2.0 code, checking session lifecycle, relationship() usage, or Alembic migrations.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.1.0
安全检测
已通过
102
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

sqlalchemy-code-review

SQLAlchemy 代码审查

快速参考

问题类型参考文档
会话生命周期、上下文管理器、异步会话references/sessions.md
relationship()、懒加载、N+1、joinedload
references/relationships.md | | select() vs query()、ORM开销、批量操作 | references/queries.md | | Alembic模式、可逆迁移、数据迁移 | references/migrations.md |

审查清单

  • - [ ] 会话使用上下文管理器(with、async with)
  • [ ] 不在请求或线程间共享会话
  • [ ] 会话正确关闭/清理
  • [ ] relationship() 使用适当的 lazy 策略
  • [ ] 显式使用 joinedload/selectinload 避免 N+1
  • [ ] 循环中无懒加载(N+1 查询)
  • [ ] 使用 SQLAlchemy 2.0 select() 语法,而非旧版 query()
  • [ ] 批量操作使用 bulkinsert/bulkupdate,而非 ORM 循环
  • [ ] 异步会话使用正确的异步上下文管理器
  • [ ] 迁移可通过 downgrade() 回滚
  • [ ] 数据迁移使用 op.execute() 而非 ORM 模型
  • [ ] 迁移依赖关系正确排序

何时加载参考文档

  • - 审查会话创建/清理 → sessions.md
  • 审查模型关系 → relationships.md
  • 审查数据库查询 → queries.md
  • 审查 Alembic 迁移文件 → migrations.md

审查问题

  1. 1. 所有会话是否都通过上下文管理器正确管理?
  2. 关系配置是否避免了 N+1 查询?
  3. 查询是否使用 SQLAlchemy 2.0 select() 语法?
  4. 所有迁移是否可逆且经过正确测试?

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 sqlalchemy-code-review-1775982683 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 sqlalchemy-code-review-1775982683 技能

通过命令行安装

skillhub install sqlalchemy-code-review-1775982683

下载

⬇ 下载 sqlalchemy-code-review v1.1.0(免费)

文件大小: 12.61 KB | 发布时间: 2026-4-13 12:09

v1.1.0 最新 2026-4-13 12:09
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.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部