GOAT PostgreSQL Database Queries

VerifiedCaution

Query the GOAT PostgreSQL database to inspect data, debug issues, and understand state during local development.

Sby Skills Guide Bot
DevelopmentIntermediate
7/22/2026
Claude Code
#postgresql#sql#database#docker#debugging

Recommended for

Automated summary

Provides connection commands and a schema map for querying the GOAT project's PostgreSQL database through its Docker container, to inspect and debug data during local development.

Strengths

  • Discovers the Postgres container name dynamically rather than hardcoding it
  • Documents the key schemas and tables: users, organizations, teams, roles, projects, layers, scenarios, jobs
  • Points to information_schema and the SQLModel definitions as the source of truth when unsure
  • Notes that the ducklake schema is managed by geoapi and should not be modified directly

Limitations

  • Assumes a fixed environment file path (/home/p4b/goat/.env) and pre-set POSTGRES_* variables
  • The sample queries are partial and the schema may drift from the SQLModel models
  • Focuses on inspection and debugging, not migrations or remote databases
When to use it

Use it to check GOAT data state locally, debug a sharing or permission issue, or understand how tables relate.

When not to use it

Avoid it for modifying the DuckLake catalog or for touching production databases without a dedicated procedure.

Security analysis

Caution
Quality score88/100

The skill uses Docker and SQL against a live PostgreSQL database, which is a legitimate development/debugging activity but involves powerful tools and secret handling. It explicitly advises read-only queries, but the lack of enforced restrictions and undeclared tool usage warrant a caution rating.

Findings
  • •Uses docker exec to run psql inside a database container, which is a powerful operation requiring careful handling.
  • •Sources environment variables from .env to obtain database credentials, exposing secrets within the shell environment.
  • •No allowed-tools declared in the skill metadata, yet the instructions execute bash, docker, and SQL commands.
  • •Although the skill instructs read-only queries, there is no technical guard preventing accidental or requested INSERT/UPDATE/DELETE statements.
How this analysis is made

Examples

Inspect a project's layers
Query the GOAT Postgres container to list the layers in project <project-id> with their names, types and order.
Debug sharing permissions
Check which teams and users have access to layer <layer-id> in the GOAT database and what role each grant uses.
Explore schema tables
List all tables in the customer schema of the GOAT database and show the columns of customer.scenario_feature.

name: db description: Use when inspecting, debugging, or understanding the GOAT PostgreSQL database — querying projects, layers, users, orgs, teams, roles, scenarios, jobs, or checking data state during local dev.

Database Query

Query the GOAT PostgreSQL database to inspect data, debug issues, and understand state.

Connection

There is no host psql; go through the running Postgres container. The container name changes across setups (goat-db, goat-db18, …), so discover it rather than hardcoding:

source /home/p4b/goat/.env
DBC=$(docker ps --format '{{.Names}}' | grep -E '^goat-db' | head -1)
docker exec -e PGPASSWORD=$POSTGRES_PASSWORD "$DBC" psql -h 127.0.0.1 -U $POSTGRES_USER -d $POSTGRES_DB

One-off query:

source /home/p4b/goat/.env
DBC=$(docker ps --format '{{.Names}}' | grep -E '^goat-db' | head -1)
docker exec -e PGPASSWORD=$POSTGRES_PASSWORD "$DBC" psql -h 127.0.0.1 -U $POSTGRES_USER -d $POSTGRES_DB -c "YOUR SQL HERE"

Schemas

| Schema | Purpose | |--------|---------| | customer | Everything: users, orgs, teams, roles/permissions, projects, layers, scenarios, jobs, workflows | | ducklake | DuckLake catalog (managed by geoapi, don't modify directly) |

Key Tables & Relationships

The SQLModel definitions in apps/core are the source of truth — introspect when unsure:

SELECT table_name FROM information_schema.tables WHERE table_schema='customer' ORDER BY 1;
\d customer.layer

Identity & sharing (all in customer)

  • user (id uuid) — Keycloak-synced. firstname, lastname, avatar
  • organization (id uuid) — name, avatar; organization_domain, organization_analytics
  • team (id uuid) — belongs to org. name, avatar
  • role (id uuid) — permission roles; RBAC via permission, role_permission, user_role, resource, resource_grant, resource_permission
  • user_team — M2M user ↔ team; invitation — pending org/team invites
  • layer_organization / layer_team / layer_user — layer sharing with role
  • project_organization / project_team / project_user — project sharing with role

Projects, layers & scenarios (customer)

  • project (id uuid) — user_id, folder_id, active_scenario_id, layer_order[], basemap, tags[]
  • layer (id uuid) — user_id, folder_id, data_store_id. Key fields: name, type, data_type, tool_type, feature_layer_type, feature_layer_geometry_type, extent (geometry), properties (jsonb), url, size, attribute_mapping (jsonb), in_catalog, tags[]
  • layer_project (id int) — M2M layer ↔ project. name, properties (jsonb style config), other_properties, query (jsonb filters), charts, order, layer_project_group_id
  • layer_project_group (id int) — layer groups. project_id, parent_id (self-ref nesting), order
  • data_store (id uuid) — storage backends. type
  • folder (id uuid) — user_id, name
  • job (id uuid) — user_id. type, status, payload (jsonb)
  • scenario (id uuid) — project_id, user_id, name
  • scenario_feature (id uuid) — layer_project_id, feature_id (text), edit_type, geom, h3_3, h3_6. Generic typed columns: integer_attr1..25, float_attr1..25, text_attr1..25, plus bigint/jsonb/boolean/array/timestamp attrs
  • scenario_scenario_feature — M2M scenario ↔ scenario_feature
  • workflow (id uuid) — project_id, name, config (jsonb), is_default
  • report / report_layout (id uuid) — project_id, name, config (jsonb), is_default
  • project_public — public sharing config: password, config (jsonb snapshot)
  • user_project — user ↔ project with initial_view_state (jsonb)
  • system_setting — per-user: client_theme, preferred_language, unit
  • uploaded_asset — user uploads: s3_key, file_name, mime_type, file_size, asset_type, content_hash
  • cost / credit_usage — credit metering

Common Queries

-- Projects with layer counts
SELECT p.id, p.name, p.created_at, COUNT(lp.id) AS layer_count
FROM customer.project p
LEFT JOIN customer.layer_project lp ON lp.project_id = p.id
GROUP BY p.id ORDER BY p.created_at DESC;

-- Layers in a project with styles
SELECT lp.id, lp.name, lp.order, l.type, l.feature_layer_type, l.feature_layer_geometry_type
FROM customer.layer_project lp
JOIN customer.layer l ON l.id = lp.layer_id
WHERE lp.project_id = 'PROJECT_UUID'
ORDER BY lp.order;

-- Job status
SELECT id, type, status, created_at, payload->>'tool_type' AS tool
FROM customer.job ORDER BY created_at DESC LIMIT 10;

-- Scenario features for a scenario
SELECT sf.id, sf.feature_id, sf.edit_type, ST_AsText(sf.geom) AS geom
FROM customer.scenario_feature sf
JOIN customer.scenario_scenario_feature ssf ON ssf.scenario_feature_id = sf.id
WHERE ssf.scenario_id = 'SCENARIO_UUID';

Important Notes

  • Layer metadata lives in PostgreSQL (customer.layer), layer data lives in DuckLake (managed by geoapi)
  • layer_project.properties = style/rendering config (jsonb); layer_project.query = active filters (jsonb)
  • scenario_feature uses generic columns (integer_attr1..25 etc.) — check layer.attribute_mapping for which attr maps to which real column name
  • A public dashboard reads the project_public.config snapshot, not the live project — re-publish to reflect changes
  • Always use READ-ONLY queries. Never INSERT/UPDATE/DELETE unless explicitly asked
  • Use ST_AsText() or ST_AsGeoJSON() to read geometry columns

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/goat-postgresql-database-queries-mrwakd8i/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/goat-postgresql-database-queries-mrwakd8i' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/goat-postgresql-database-queries-mrwakd8i/download' --output '.skill-downloads/goat-postgresql-database-queries-mrwakd8i/SKILL.md.part' && mv '.skill-downloads/goat-postgresql-database-queries-mrwakd8i/SKILL.md.part' '.skill-downloads/goat-postgresql-database-queries-mrwakd8i/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/goat-postgresql-database-queries-mrwakd8i/SKILL.md' && test -s '.skill-downloads/goat-postgresql-database-queries-mrwakd8i/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/db' && cp -R '.skill-downloads/goat-postgresql-database-queries-mrwakd8i' '.claude/skills/db'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/goat-postgresql-database-queries-mrwakd8i'

openskills read 'goat-postgresql-database-queries-mrwakd8i'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/goat-postgresql-database-queries-mrwakd8i/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills