# Database

> 当用户想连数据库、存数据、建表、做数据模型、配置 SQLite/PostgreSQL/Supabase 时使用 — 配置数据库连接并生成增删改查

- **Type:** Skill
- **Install:** `agentstack add skill-lightpointventures-claude-code-starter-database`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [lightpointventures](https://agentstack.voostack.com/s/lightpointventures)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [lightpointventures](https://github.com/lightpointventures)
- **Source:** https://github.com/lightpointventures/claude-code-starter/tree/main/skills/database
- **Website:** https://github.com/lighthouse-strategy/claude-code-starter

## Install

```sh
agentstack add skill-lightpointventures-claude-code-starter-database
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 连接数据库

帮用户为项目配置数据库，从连接到基本操作一步到位。

## 步骤

### 1. 了解需求

**问题 1：存什么数据**
> 你需要存储什么数据？比如用户信息、文章、订单、产品。

**问题 2：数据库选择**
> 推荐方案：
> - SQLite（最简单，不需要安装，适合入门和小项目）
> - PostgreSQL（生产推荐，功能强大）
> - Supabase（云端 PostgreSQL，免费额度大，自带管理界面）
> 不确定就用 SQLite，后面随时可以换。

### 2. 配置连接

根据选择配置数据库：

- **安装依赖** — 添加对应的数据库驱动
- **连接配置** — 数据库 URL 放到环境变量，生成 .env.example
- **连接测试** — 确认能成功连接

### 3. 创建数据模型

根据用户描述的数据，生成：

- **模型/Schema 定义** — 字段名、类型、约束（必填、唯一、默认值）
- **表关系** — 一对多、多对多（如果有）
- **迁移文件** — 创建表的迁移脚本

### 4. 生成 CRUD 函数

为每个模型生成基本操作：

- **Create** — 创建记录，包含数据验证
- **Read** — 查询列表（支持分页）和查询详情
- **Update** — 更新记录
- **Delete** — 删除记录

### 5. 验证

运行迁移，创建一条测试数据，查询确认写入成功。

> 数据库已配置完成。模型和 CRUD 函数已生成。
> 用 /api 可以把这些操作暴露为 API 接口。

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [lightpointventures](https://github.com/lightpointventures)
- **Source:** [lightpointventures/claude-code-starter](https://github.com/lightpointventures/claude-code-starter)
- **License:** MIT
- **Homepage:** https://github.com/lighthouse-strategy/claude-code-starter

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-lightpointventures-claude-code-starter-database
- Seller: https://agentstack.voostack.com/s/lightpointventures
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
