portability
하는 일
이 스킬은 로컬과 호스팅 PostgreSQL에서 같은 방식으로 작동하는 테이블과 데이터베이스 쿼리를 정의하는 방법을 보여 줍니다. Agent-Native 앱 템플릿을 만드는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓앱의 새 데이터베이스 테이블이나 스키마를 정의할 때.
- ✓데이터를 읽거나 저장하는 원시 SQL이나 새 서버 경로를 작성할 때.
- ✓앱을 바꾸지 않고 로컬 데이터베이스와 호스팅 데이터베이스 모두에서 실행하고 싶을 때.
스킬 링크
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/portability/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“식사 테이블과 각 항목을 저장하는 서버 경로를 추가하되, 어떤 호스팅에서도 계속 작동하게 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 에이전트에게 테이블과 쿼리에 Drizzle의 PostgreSQL 도구를 쓰라고 알려 줍니다. 그래서 같은 코드가 로컬과 호스팅 데이터베이스 모두에서 실행됩니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Portability
Rule
Templates use one PostgreSQL schema and query contract. Local PGlite and hosted PostgreSQL share the same SQL semantics.
Database
Use Drizzle's PostgreSQL exports directly for schemas and its query builder for reads/writes:
import { sql } from "drizzle-orm";
import {
boolean,
doublePrecision,
integer,
pgTable,
text,
} from "drizzle-orm/pg-core";
export const meals = pgTable("meals", {
id: text("id").primaryKey(),
name: text("name").notNull(),
calories: integer("calories").notNull(),
weight: doublePrecision("weight"),
archived: boolean("archived").notNull().default(false),
createdAt: text("created_at").notNull().default(sql`now()`),
});
| Export | Purpose |
|---|---|
pgTable |
Defines a PostgreSQL table |
text |
Defines a text column, with optional enum values |
integer |
Defines an integer column |
boolean |
Defines a boolean column |
doublePrecision |
Defines a double-precision column |
sql |
Builds SQL expressions such as now() |
Use @agent-native/core/db/schema only for framework-owned sharing helpers such
as ownableColumns() and createSharesTable().
Use Drizzle's PostgreSQL query builder for app code:
import { and, desc, eq } from "drizzle-orm";
const rows = await db
.select()
.from(meals)
.where(and(eq(meals.ownerEmail, userEmail), eq(meals.archived, false)))
.orderBy(desc(meals.createdAt));
Avoid db.execute(...), getDbExec(), and handwritten SQL in actions, handlers, and stores when Drizzle can express the query. Raw SQL should be limited to additive migrations, health checks, carefully reviewed advanced queries, or one-off maintenance scripts. For timestamps in Drizzle schemas, use .default(now()); for migration SQL, use runMigrations().
Raw SQL helpers
getDbExec()— executes parameterized PostgreSQL SQL- Use PostgreSQL types such as
BIGINTdirectly in raw SQL.
Never
When writing docs, say "PostgreSQL" or "PGlite" precisely.
Use Postgres syntax deliberately in advanced queries and migrations, and prefer Drizzle APIs or framework helpers for ordinary application code.
When giving deployment guidance, be precise about durability: local PGlite is for development, while shared and production environments need a persistent hosted PostgreSQL DATABASE_URL.
Hosting Agnostic
The server runs on Nitro with H3 as the HTTP framework. Templates must be deployable to any Nitro-supported target.
Never use Express
All server code uses H3/Nitro: defineEventHandler, readBody, getMethod, setResponseHeader, etc. Express is not a dependency. If you see Express types or patterns anywhere, replace them with H3 equivalents.
No platform-specific config in scaffolded template source
Files like netlify.toml, wrangler.toml, vercel.json, and netlify/functions/ must NOT appear in the CLI scaffold source (packages/core/src/templates/) — apps generated for users stay hosting-agnostic, with platform configuration living in CI/hosting dashboards.
This monorepo's own first-party deployed apps keep platform configuration in app-specific hosting manifests such as templates/*/netlify.toml; this rule only applies to the CLI scaffold source.
No Node APIs in server routes/plugins
Never use fs, child_process, or path in server routes and plugins. Use Nitro abstractions. (Actions in actions/ run in Node.js and can use Node APIs freely.)
No persistent-process assumptions
Never assume a persistent server process. Use the SQL database for all state.
Related Skills
storing-data— Schema patterns and the core SQL storesserver-plugins— Framework routes and H3 handler patternssecurity— SQL injection prevention via parameterized queries
자주 묻는 질문
스키마에 어떤 라이브러리를 써야 하나요?
테이블을 정의하고 쿼리를 만들 때 Drizzle의 PostgreSQL 내보내기를 씁니다.
로컬 데이터베이스에서도 작동하나요?
네. 로컬 PGlite와 호스팅 PostgreSQL은 같은 SQL 동작을 공유하도록 설계되었습니다.
공유 스키마 도우미는 언제 써야 하나요?
소유 가능한 열이나 공유 테이블처럼 프레임워크의 공유 도우미에만 사용합니다.
상세 정보
작성자의 원본 설명
How to keep template code PostgreSQL-specific and hosting-agnostic. Use when defining schemas, writing raw SQL, or creating server routes.
repo: BuilderIO/agent-native
인기도
- GitHub 스타
- 7.6k
- 순위
- #13172
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
design-exploration
7.6k에이전트가 여러 UI 디자인 방향을 나란히 보여 주고, 사용자가 하나를 고르면 그 디자인을 다듬도록 돕습니다.
visual-edit
7.6k에이전트가 실행 중인 로컬 앱을 시각 편집기에 열어, 실제 화면을 함께 검토하고 편집하도록 돕습니다.
turn-into-app
7.6k워크플로, 스프레드시트 또는 프로젝트를 데이터가 채워진 세련된 시각 앱으로 바꾸고, 컨트롤 뒤에서 에이전트가 작업하도록 합니다.
visual-plan
7.6k일반 텍스트 계획을 다이어그램, 파일 맵, 코드 조각, 열린 질문이 담긴 대화형 시각 계획으로 바꿔 줍니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.