Skip to main content

agent-db

Start an isolated PostgreSQL container for integration testing. Each worktree gets its own container on a unique port — no mutex, no conflicts. Use this before running integration tests in a worktree agent.

跳到安装

来源信息

仓库
prebid/salesagent
最近来源活动
2026年6月16日 20:37
检测到的 SKILL.md 语言
英语
星标
37
分支
53

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
2 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
agent-db
description
Start an isolated PostgreSQL container for integration testing. Each worktree gets its own container on a unique port — no mutex, no conflicts. Use this before running integration tests in a worktree agent.
# Agent Database Starts a lightweight `postgres:17-alpine` container scoped to the current worktree. The container name is deterministic (`agent-pg-<dirname>`), so `up`/`down`/`status` work across calls without tracking state manually. ## When to use - Before running integration tests in a worktree agent - When you need a private Postgres that won't conflict with other agents - Instead of `make test-stack-up` (which starts the full docker-compose stack) ## Setup ```bash eval $(.claude/skills/agent-db/agent-db.sh up) ``` This exports: - `DATABASE_URL` — points to your private Postgres - `ADCP_TESTING=true` - `ENCRYPTION_KEY`, `GEMINI_API_KEY` — test defaults The `integration_db` pytest fixture handles the rest: creates per-test databases, runs `Base.metadata.create_all()`, cleans up after each test. ## Running tests ```bash # Integration tests (real Postgres) uv run pytest tests/integration/ -x -q # Targeted uv run pytest tests/integration/test_specific.py -x -q -k "test_name" # Unit tests (no DB needed) uv run pytest tests/unit/ -x -q ``` ## Commands | Command | Effect | |---------|--------| | `eval $(.claude/skills/agent-db/agent-db.sh up)` | Start container, export env vars | | `.claude/skills/agent-db/agent-db.sh down` | Stop and remove container | | `.claude/skills/agent-db/agent-db.sh status` | Check if running | ## Idempotent Running `up` when already running re-exports the same env vars (same port, same container). Safe to call multiple times. ## Cleanup The container is removed when you run `down` or when the worktree is deleted. If the worktree is cleaned up without running `down`, the container stays orphaned — run `docker rm -f agent-pg-<worktree-name>` to clean it up.
在 GitHub 查看