lokstra-schema-design

Generate PostgreSQL schemas with tables, indexes, RLS policies, and migrations for Lokstra modules.

8|1|Updated Jun 21, 2025
One-click install
npx skills add https://github.com/primadi/lokstra --skill lokstra-schema-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lokstra-schema-design
Source: https://github.com/primadi/lokstra/tree/main/.github/skills/design-lokstra-schema-design
Command: npx skills add https://github.com/primadi/lokstra --skill lokstra-schema-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generate robust, production-ready PostgreSQL database schemas for Lokstra modules with built-in multi-tenant patterns, ensuring data integrity, security, and maintainable migrations.

Core Features & Use Cases

  • Design tenant-aware schemas with tenant_id, composite foreign keys, and Row-Level Security (RLS) to enforce data isolation.
  • Produce migration-ready SQL including tables, indexes, RLS policies, triggers, and audit logging templates.
  • Provide structured guidance and templates to accelerate designing scalable, compliant data layers for Lokstra applications.

Quick Start

Use lokstra-schema-design to draft a complete PostgreSQL schema for a new Lokstra module, including tables, indexes, RLS policies, and migration scripts.

Frequently Asked Questions about lokstra-schema-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design a multi-tenant PostgreSQL schema with Row-Level Security?

A multi-tenant PostgreSQL schema enforces data isolation by applying tenant_id patterns, composite foreign keys, and Row-Level Security (RLS) policies to restrict data access per tenant across your database tables.

What is the best way to generate migration-ready SQL for multi-tenant databases?

The best way to generate migration-ready SQL is to produce scripts that include tables, indexes, RLS policies, triggers, and audit logging templates, ensuring your multi-tenant schema maintains data integrity during deployments.

How do I add audit trails to a PostgreSQL schema using triggers?

You add audit trails to a PostgreSQL schema by generating triggers and audit logging templates within your migration scripts, which automatically track data changes and maintain compliance across your multi-tenant data layer.

When do I need composite foreign keys in a multi-tenant database schema?

You need composite foreign keys in a multi-tenant database schema when establishing relationships between tenant-aware tables, ensuring referential integrity by validating both the primary record and the associated tenant_id together.

Can I use this schema design approach for existing PostgreSQL migrations?

Yes, you can apply this schema design approach to existing PostgreSQL migrations by integrating tenant_id patterns, RLS policies, and audit trails into your current migration scripts to secure and scale your data layer.