.cursor/skills/hasura-metadata-apply/SKILL.md
Applies Hasura metadata changes (track tables, relationships, permissions) by editing hasura/metadata.json and running scripts/hasura_apply_metadata.sh against local dev compose. Use when tracking a new Postgres table in Hasura, adding relationships or permissions, or when the user asks to update Hasura metadata.
npx skillsauth add Intersubjective/tentura hasura-metadata-applyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This project manages Hasura metadata as a single JSON file (hasura/metadata.json).
Changes are applied via replace_metadata through scripts/hasura_apply_metadata.sh.
Edit hasura/metadata.json (Hasura v2 metadata format, version 3).
Track a new table — add an entry to metadata.sources[0].tables:
{
"table": { "name": "my_table", "schema": "public" },
"object_relationships": [],
"select_permissions": [
{
"role": "user",
"permission": {
"columns": ["col_a", "col_b"],
"filter": {}
}
}
]
}
Add object relationship (e.g. 1:1 via FK on child table):
{
"name": "my_table",
"using": {
"foreign_key_constraint_on": {
"column": "parent_id",
"table": { "name": "my_table", "schema": "public" }
}
}
}
Add array relationship (parent → children via FK on child):
{
"name": "children",
"using": {
"foreign_key_constraint_on": {
"column": "parent_id",
"table": { "name": "child_table", "schema": "public" }
}
}
}
python3 -m json.tool hasura/metadata.json > /dev/null
./scripts/hasura_apply_metadata.sh
Default endpoint: http://127.0.0.1:8080 (compose.dev.yaml).
Default admin secret: password.
Override with env vars:
HASURA_URL=http://127.0.0.1:8080 HASURA_GRAPHQL_ADMIN_SECRET=mysecret ./scripts/hasura_apply_metadata.sh
The script uses jq (required dependency). It:
.metadata from the JSON file.replace_metadata to /v1/metadata..error, and is_consistent == true.After Hasura accepts metadata, re-introspect if the client's schema.graphql needs new types. The compose dev stack includes an introspection service, or run manually:
get-graphql-schema -h 'x-hasura-admin-secret=password' -h 'x-hasura-role=user' \
http://localhost:8080/v1/graphql > packages/client/lib/data/gql/schema.graphql
Then run Ferry codegen:
cd packages/client && dart run build_runner build -d
Increment resource_version at the top of metadata.json after each change (convention only; Hasura ignores it on replace_metadata but it helps track edits).
"filter": {} (public read) for role: user. Tables with user-scoped data use "filter": { "user_id": { "_eq": "X-Hasura-User-Id" } }.beacon_review_window).session_argument and often table_argument; see existing examples in metadata.json.metadata.json, never partial API calls.| Symptom | Fix |
|---------|-----|
| is_consistent: false | Table or FK doesn't exist in Postgres; run migrations first. |
| HTTP 401 | Wrong admin secret; check HASURA_GRAPHQL_ADMIN_SECRET. |
| jq: command not found | Install jq: sudo apt install jq. |
| New field returns null in client | Ensure schema.graphql has the type and the .graphql fragment selects it; re-run codegen. |
testing
Use impolite, maximally terse Japanese (タメ口/ぞんざい語) in thinking blocks and subagent prompts to conserve tokens. User-facing output remains in the user's language. Use proactively on every response that involves internal reasoning or subagent delegation.
tools
Implements a Figma selection or node URL as production-quality Flutter UI for this monorepo (packages/client), using MCP design context and screenshot verification. Use when the user mentions Figma, a frame, node, component, screen, MCP, or "implement this design"; when a Figma selection is active; or when a Figma frame/layer link is provided for Flutter UI work.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.