📦 Sqlalchemy Code Review — 技能工具

v1.1.0

审查 SQLAlchemy 2.0 代码的会话生命周期、模型关系、N+1 查询及迁移模式,确保性能与一致性。

0· 90·1 当前·1 累计
by @anderskev (Kevin Anderson)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/27
0
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The skill is an instruction-only SQLAlchemy code-review checklist and reference bundle whose requested resources and actions are consistent with its stated purpose.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

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 TypeReference
Session lifecycle, context managers, async sessionsreferences/sessions.md
relationship(), lazy loading, N+1, joinedloadreferences/relationships.md
select() vs query(), ORM overhead, bulk opsreferences/queries.md
Alembic patterns, reversible migrations, data migrationsreferences/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 appropriate lazy strategy
  • [ ] Explicit joinedload/selectinload to avoid N+1
  • [ ] No lazy loading in loops (N+1 queries)
  • [ ] Using SQLAlchemy 2.0 select() syntax, not legacy query()
  • [ ] 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 ↗ · 中文优化:龙虾技能库