Converts raw SQL to ORM query code and vice versa across EF Core, Prisma, Drizzle, TypeORM, Knex, SQLAlchemy, Django, JPA, jOOQ, GORM. Flags untranslatable constructs.
Ships in AI for Developers Toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Translate between raw SQL and ORM query code in either direction (or between two ORMs), keeping the result set identical and flagging constructs that don't translate cleanly.
Works on a target (a file, folder, project/repo, GitHub URL) or a pasted query. For SQL -> ORM you need the model/entity definitions and relationships - find them before writing code.
| Manifest | Look for | Target API | Find the models |
|---|---|---|---|
*.csproj | Microsoft.EntityFrameworkCore | LINQ (method syntax) | grep -rn "DbSet<|class .*Configuration" --include=*.cs |
package.json | @prisma/client, drizzle-orm, typeorm, knex | Prisma Client / Drizzle query builder / TypeORM QueryBuilder / Knex | schema.prisma, pgTable(/mysqlTable(, @Entity |
pyproject.toml, requirements*.txt | sqlalchemy, django | SQLAlchemy 2.0 select() / Django QuerySet | DeclarativeBase/Mapped[, models.Model |
pom.xml, build.gradle(.kts) | spring-boot-starter-data-jpa, jooq | JPQL / Criteria API / Spring Data derived queries / jOOQ | @Entity, JpaRepository |
go.mod | gorm.io/gorm, sqlc, sqlx | GORM chain / sqlc queries / sqlx | struct tags, query.sql |
If the user names a target ("in Prisma"), use it. Also note the database dialect - it decides LIMIT/TOP, ILIKE, date functions, and boolean literals.
= NULL never matches; NOT IN with NULLs returns nothing; ORMs differ in how they translate != against nullable columns.SUM returns NULL, not 0; COUNT(col) skips NULLs, COUNT(*) does not.HAVING becomes a filter after grouping.ORDER BY is nondeterministic.LIKE vs ILIKE, DB collation vs in-memory comparison.SELECT c.name, COUNT(o.id) AS orders
FROM customers c LEFT JOIN orders o ON o.customer_id = c.id
WHERE c.is_active = TRUE
GROUP BY c.id, c.name HAVING COUNT(o.id) > 5
ORDER BY orders DESC;
C# / EF Core (LINQ)
var rows = await db.Customers
.Where(c => c.IsActive)
.Select(c => new { c.Name, Orders = c.Orders.Count() })
.Where(x => x.Orders > 5)
.OrderByDescending(x => x.Orders)
.ToListAsync(ct);
See the SQL with query.ToQueryString() or LogTo. Raw SQL when needed: FromSql($"... {p}") (interpolation is parameterized) or Database.SqlQuery<T>(...) for unmapped types.
TypeScript - Prisma / Drizzle
Prisma has no HAVING on relation counts in findMany; use groupBy with having on the FK table, or a typed raw query:
const rows = await prisma.$queryRaw<{ name: string; orders: bigint }[]>`
SELECT c.name, COUNT(o.id) AS orders FROM customers c
LEFT JOIN orders o ON o.customer_id = c.id
WHERE c.is_active = TRUE GROUP BY c.id, c.name HAVING COUNT(o.id) > 5 ORDER BY orders DESC`;
// Drizzle
const orderCount = count(orders.id);
const rows = await db.select({ name: customers.name, orders: orderCount })
.from(customers).leftJoin(orders, eq(orders.customerId, customers.id))
.where(eq(customers.isActive, true))
.groupBy(customers.id, customers.name)
.having(gt(orderCount, 5))
.orderBy(desc(orderCount));
TypeORM: createQueryBuilder("c").leftJoin("c.orders", "o").select(...).addSelect("COUNT(o.id)", "orders").where(...).groupBy(...).having("COUNT(o.id) > :n", { n: 5 }).getRawMany().
Python - SQLAlchemy 2.0 / Django
order_count = func.count(Order.id).label("orders")
stmt = (select(Customer.name, order_count)
.outerjoin(Customer.orders)
.where(Customer.is_active.is_(True))
.group_by(Customer.id, Customer.name)
.having(func.count(Order.id) > 5)
.order_by(order_count.desc()))
rows = (await session.execute(stmt)).all()
# Django
rows = (Customer.objects.filter(is_active=True)
.annotate(orders=Count("orders"))
.filter(orders__gt=5).order_by("-orders").values("name", "orders"))
SQL: print(stmt) / stmt.compile(dialect=...); Django str(qs.query).
Java / Kotlin - JPQL / Spring Data
@Query("""
select new com.acme.CustomerOrders(c.name, count(o))
from Customer c left join c.orders o
where c.active = true
group by c.id, c.name having count(o) > 5
order by count(o) desc""")
List<CustomerOrders> activeWithManyOrders();
Criteria API for dynamic filters (or Spring Data Specification); jOOQ when the team prefers type-safe SQL. SQL: spring.jpa.show-sql / Hibernate SQL logging.
Go - GORM
var rows []struct{ Name string; Orders int64 }
err := db.WithContext(ctx).Model(&Customer{}).
Select("customers.name, COUNT(orders.id) AS orders").
Joins("LEFT JOIN orders ON orders.customer_id = customers.id").
Where("customers.is_active = ?", true).
Group("customers.id, customers.name").
Having("COUNT(orders.id) > ?", 5).
Order("orders DESC").Scan(&rows).Error
SQL: db.Debug() or db.ToSQL(...). For SQL-first Go teams, sqlc generates typed code from the original query - often the better answer.
Show the SQL the ORM will produce, using its own tooling (ToQueryString(), Prisma log: ['query'], str(qs.query), Hibernate SQL logging, db.ToSQL), and point out N+1 patterns, client-side evaluation, and missing ORDER BY on paged queries.
PIVOT, LATERAL - support varies (SQLAlchemy, jOOQ, and Drizzle handle many; EF Core, Prisma, and GORM mostly don't). Use the ORM's raw SQL escape hatch or a mapped view, and say so.EF.Functions.*, SQLAlchemy func.*, Drizzle's sql template, Django Func expressions, or JPQL function(...) where available; else raw SQL.UNION/INTERSECT/EXCEPT) - check ORM support before promising it.FromSql, $queryRaw, session.execute(text(...)), @Procedure/StoredProcedureQuery, db.Raw), or port the logic if simple.FOR UPDATE, WITH (NOLOCK)) - map to the ORM's lock API where it exists, else raw SQL.## Target
<ORM + dialect detected>
## Converted query
<code, ready to paste>
## Generated SQL (expected)
<SQL, or the command to print it>
## Semantics notes
- <any difference in NULL/join/aggregate/collation behavior; anything that falls back to raw SQL>
"Convert this SQL to EF Core LINQ", "write this query in Prisma / Drizzle", "port this stored procedure to SQLAlchemy", "what SQL does this Django QuerySet generate", "turn this native query into JPQL", "rewrite this raw query with GORM". Pairs with orm-query-optimizer.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/ai-dev-toolkit:sql-orm-converterfrom AI for Developers Toolkit
npx claudepluginhub stefanthecode/ai-for-developers --plugin ai-dev-toolkit45 skills in this plugin
/api-endpoint-scaffolderScaffold HTTP API endpoints in any stack - ASP.NET Core Minimal APIs or controllers, Express, Fastify, NestJS, FastAPI, Django REST Framework, Spring Boot controllers, Go net/http, chi, Gin - one feature per endpoint (REPR style) with request validation, typed responses, route grouping, auth, and OpenAPI metadata. Use this skill whenever the user wants to add an endpoint or route, convert controllers to minimal APIs, structure routes or routers, set up endpoint groups, TypedResults, route handlers, request DTOs/schemas (zod, Pydantic, Bean Validation, binding tags), or asks "how do I add an endpoint / structure my API routes". Always use this skill for endpoint scaffolding; it generates a complete, validated endpoint that matches the project's conventions./architecture-test-generatorGenerate architecture tests / fitness functions that fail the build when architectural rules are violated - layer dependencies, module boundaries, cycles, naming, and visibility conventions - in any stack: NetArchTest or ArchUnitNET (.NET), ArchUnit or Konsist (Java/Kotlin), dependency-cruiser or eslint-plugin-boundaries (TypeScript/JavaScript), import-linter (Python), go-arch-lint or depguard (Go). Use this skill whenever the user wants architecture tests, to enforce layering or the dependency rule, dependency rules as tests, import rules, forbidden imports, no circular dependencies, naming conventions, fitness functions, or asks "how do I stop people breaking the architecture / enforce my layers / keep modules from importing each other". Always use this skill for architecture-test requests; it generates rules matching the project's real structure.Other plugins' skills for the same job