---
name: "ent-entity-framework-graph-queries"
description: "Model data schemas as 100% type-safe graph entities using Meta's Ent framework for Go."
metadata:
  author: "Ent"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "define ent schema"
  - "traverse graph ent go"
  - "generate ent code"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Ent Entity Framework & Schema-Driven Graph Queries

Builds database layers with Ent: defining schemas with ent/schema (fields, edges, indexes), generating code with ent generate, writing fluent graph traversal queries, migration management, and privacy policies.

## When to Invoke
Invoke this skill whenever you need to:
- define ent schema
- traverse graph ent go
- generate ent code

## Execution SOP & Rules
1. Initialize: go run -mod=mod entgo.io/ent/cmd/ent new User Pet.
2. Define schema in ent/schema/user.go specifying Fields() and Edges() (edge.To('pets', Pet.Type)).
3. Compile code: go generate ./ent.
4. Execute graph queries: users, err := client.User.Query().Where(user.AgeGT(18)).WithPets().All(ctx).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
