数据库测试
- 作者仓库星标 68,946
- 作者更新于 实时读取
- 作者仓库 paperclip
- 领域
- 通用
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @paperclipai · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: paperclip-dev
description: > This skill covers the day-to-day workflows for developing and operating a local Paperclip inst…
category: 通用
runtime: 无特殊运行时
---
# paperclip-dev 输出预览
## PART A: 任务判断
- 适用问题:通用任务拆解、检查和交付。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Quick Command Reference / Pulling from Master / Worktrees”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于通用任务拆解、检查和交付,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Quick Command Reference / Pulling from Master / Worktrees”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、读取环境变量、会按任务需要访问外部网络、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文没有稳定的斜杠命令要求。安装验证后通常全局生效,直接在对话里点名这个 Skill 并描述任务即可。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令、读取环境变量。
先用一个小任务确认它会围绕“Quick Command Reference / Pulling from Master / Worktrees”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: paperclip-dev
description: > This skill covers the day-to-day workflows for developing and operating a local Paperclip inst…
category: 通用
source: paperclipai/paperclip
---
# paperclip-dev
## 什么时候使用
- 把通用方向的常用动作沉淀成 Agent 可调用的技能 适合处理通用任务拆解、检查、交付和复盘,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;通常不需要额外…
- 面向通用任务拆解、检查和交付,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Quick Command Reference / Pulling from Master / Worktrees」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "paperclip-dev" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Quick Command Reference / Pulling from Master / Worktrees
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令、读取环境变量 | 会按任务需要访问外部网络
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Paperclip Dev
This skill covers the day-to-day workflows for developing and operating a local Paperclip instance. It assumes you are working inside the Paperclip repo checkout with origin pointing to git@github.com:paperclipai/paperclip.git.
OPEN SOURCE HYGIENE: This repository is public-facing. Treat anything you push to
originas publishable. Never commit or push secrets, API keys, tokens, private logs, PII, customer data, or machine-local configuration that should stay private. Keep git history tidy as well: avoid pushing throwaway branches, noisy checkpoint commits, or speculative work that does not need to be shared upstream.
MANDATORY: Before running any CLI command, building, testing, or managing worktrees, you MUST read
doc/DEVELOPING.mdin the Paperclip repo. It is the canonical reference for allpaperclipaiCLI commands, their options, build/test workflows, database operations, worktree management, and diagnostics. Do NOT guess at flags or options — read the doc first.
Quick Command Reference
These are the most common commands. For full option tables and details, see doc/DEVELOPING.md.
| Task | Command |
|---|---|
| Start server (first time or normal) | npx paperclipai run |
| Dev mode with hot reload | pnpm dev |
| Stop dev server | pnpm dev:stop |
| Build | pnpm build |
| Type-check | pnpm typecheck |
| Run tests | pnpm test |
| Run migrations | pnpm db:migrate |
| Regenerate Drizzle client | pnpm db:generate |
| Back up database | npx paperclipai db:backup |
| Health check | npx paperclipai doctor --repair |
| Print env vars | npx paperclipai env |
| Trigger agent heartbeat | npx paperclipai heartbeat run --agent-id <id> |
| Install agent skills locally | npx paperclipai agent local-cli <agent> --company-id <id> |
Pulling from Master
git fetch origin && git pull origin master
pnpm install && pnpm build
If schema changes landed, also run pnpm db:generate && pnpm db:migrate.
Worktrees
Paperclip worktrees combine git worktrees with isolated Paperclip instances — each gets its own database, server port, and environment seeded from the primary instance.
MANDATORY: Before creating or managing worktrees, you MUST read the "Worktree-local Instances" and "Worktree CLI Reference" sections in
doc/DEVELOPING.md. That is the canonical reference for all worktree commands, their options, seed modes, and environment variables.
When to Use Worktrees
- Starting a feature branch that needs its own Paperclip environment
- Running parallel agent work without cross-contaminating the primary instance
- Testing Paperclip changes in isolation before merging
Command Overview
The CLI has two tiers (see doc/DEVELOPING.md for full option tables):
| Command | Purpose |
|---|---|
worktree:make <name> |
Create worktree + isolated instance in one step |
worktree:list |
List worktrees and their Paperclip status |
worktree:merge-history |
Preview/import issue history between worktrees |
worktree:cleanup <name> |
Remove worktree, branch, and instance data |
worktree init |
Bootstrap instance inside existing worktree |
worktree env |
Print shell exports for worktree instance |
worktree reseed |
Refresh worktree DB from another instance |
worktree repair |
Fix broken/missing worktree instance metadata |
Typical Workflow
# 1. Create a worktree for a feature
npx paperclipai worktree:make my-feature --start-point origin/main
# 2. Move into the worktree (path printed by worktree:make) and source the environment
cd <worktree-path>
eval "$(npx paperclipai worktree env)"
# 3. Start the isolated Paperclip server
npx paperclipai run
# 4. Do your work
# 5. When done, merge history back if needed
npx paperclipai worktree:merge-history --from paperclip-my-feature --to current --apply
# 6. Clean up
npx paperclipai worktree:cleanup my-feature
Forks — Prefer Pushing to a User Fork
If the user has a personal fork of paperclipai/paperclip configured as a git remote, push your feature branches to that fork instead of creating branches on the main repo. This keeps the upstream branch list clean and matches the standard open-source contribution flow.
Detect a fork remote
Before pushing or creating a PR, list remotes and check for one that points at a non-paperclipai GitHub fork:
git remote -v
Treat any remote whose URL points to github.com:<user>/paperclip (or github.com/<user>/paperclip.git) as the user's fork. Common names are fork, <username>, or myfork. The remote named origin or upstream that points at paperclipai/paperclip is the canonical upstream — do not push feature branches there if a fork exists.
Pushing to the fork
# Push the current branch to the user's fork and set upstream
git push -u <fork-remote> HEAD
Then create the PR from the fork branch:
gh pr create --repo paperclipai/paperclip --head <fork-owner>:<branch-name> ...
gh pr create usually figures out the head ref automatically when run from a branch tracking the fork; the explicit --head <owner>:<branch> form is the reliable fallback when it does not.
When no fork exists
If git remote -v shows only paperclipai/paperclip remotes (no user fork), fall back to pushing branches to origin as before. Do NOT create a fork on the user's behalf — ask first.
Keeping the fork up to date
The canonical remote that points at paperclipai/paperclip may be named origin or upstream depending on how the user set up the repo. Detect it the same way as in the "Detect a fork remote" step, then fetch and push from/with that remote so the sync works under either convention:
UPSTREAM_REMOTE=$(git remote -v | awk '/paperclipai\/paperclip.*\(fetch\)/{print $1; exit}')
git fetch "$UPSTREAM_REMOTE"
git push <fork-remote> "${UPSTREAM_REMOTE}/master:master"
Pull Requests
MANDATORY PRE-FLIGHT: Before creating ANY pull request, you MUST read the canonical source files listed below. Do NOT run
gh pr createuntil you have read these files and verified your PR body matches every required section.
Step 1 — Read the canonical files
You MUST read all three of these files before creating a PR:
.github/PULL_REQUEST_TEMPLATE.md— the required PR body structureCONTRIBUTING.md— contribution conventions, PR requirements, and thinking-path examples.github/workflows/pr.yml— CI checks that gate merge
Step 2 — Validate your PR body against this checklist
After reading the template, verify your --body includes every one of these sections (names must match exactly):
-
## Thinking Path— blockquote style, 5-8 reasoning steps -
## What Changed— bullet list of concrete changes -
## Verification— how a reviewer confirms this works -
## Risks— what could go wrong -
## Model Used— provider, model ID, version, capabilities -
## Checklist— copied from the template, items checked off
If any section is missing or empty, do NOT submit the PR. Go back and fill it in.
Step 3 — Create the PR
Only after completing Steps 1 and 2, run gh pr create. Use the template contents as the structure for --body — do not write a freeform summary.
Hard Rules — Do NOT Bypass
These rules exist because agents have caused real damage by improvising around CLI failures. Follow them exactly.
CLI is the only interface to worktrees and databases. All worktree and database operations MUST go through
npx paperclipai/pnpm paperclipaicommands. You MUST NOT:- Run
pg_dump,pg_restore,psql,createdb,dropdb, or any raw postgres commands - Manually set
DATABASE_URLto point a worktree server at another instance's database - Run
rm -rfon any.paperclip/,.paperclip-worktrees/, ordb/directory - Directly manipulate embedded postgres data directories
- Kill postgres processes by PID
- Run
If a CLI command fails, stop and report. Do NOT attempt workarounds. If
worktree:make,worktree reseed,worktree init,worktree:cleanup, or any otherpaperclipaicommand fails:- Report the exact error message in your task comment
- Set the task to
blocked - Suggest running
npx paperclipai doctor --repairor recreating the worktree from scratch - Do NOT try to manually replicate what the CLI does
Never share databases between instances. Each worktree instance gets its own isolated database. Never override
DATABASE_URLto point one instance at another's database. This destroys isolation and can corrupt production data.Starting a dev server in a worktree requires setup first. The correct sequence is:
# If the worktree already exists but has no running instance: cd <worktree-path> eval "$(npx paperclipai worktree env)" pnpm install && pnpm build npx paperclipai run # or pnpm dev # If the worktree needs a fresh database: npx paperclipai worktree reseed --seed-mode full # If the worktree is broken beyond repair: npx paperclipai worktree:cleanup <name> npx paperclipai worktree:make <name> --seed-mode fullIf any step fails, follow rule 2 — stop and report.
Seeding is a CLI operation. When asked to seed a worktree database from the main instance, use
worktree reseedor recreate withworktree:make --seed-mode full. Readdoc/DEVELOPING.mdfor the full option tables. Never attempt manual database copying.
Persistent Dev Servers (for Manual Testing)
When an agent needs to start a dev server that outlives the current heartbeat — for example, so a human or QA agent can manually test against it — the server process must be launched in a detached session. A process started directly from a heartbeat shell is killed when the heartbeat exits.
Use tmux for persistent servers
# 1. cd into the worktree (or main repo) and source the environment
cd <worktree-path>
eval "$(npx paperclipai worktree env)" # skip if using the primary instance
# 2. Start the dev server in a named, detached tmux session
tmux new-session -d -s <session-name> 'pnpm dev'
# Example with a descriptive name:
tmux new-session -d -s auth-fix-3102 'pnpm dev'
Managing the session
| Task | Command |
|---|---|
| Check if the session is alive | tmux has-session -t <session-name> 2>/dev/null && echo running |
| View server output | tmux capture-pane -t <session-name> -p |
| Kill the session | tmux kill-session -t <session-name> |
| List all tmux sessions | tmux list-sessions |
Verifying the server is reachable
After launching, confirm the port is listening before reporting success:
# Wait briefly for startup, then verify
sleep 3
curl -sf http://127.0.0.1:<port>/api/health && echo "Server is up"
lsof -nP -iTCP:<port> -sTCP:LISTEN
Key rules
- Always use
tmux(or equivalent) when a dev server needs to stay running after the heartbeat ends. A server started directly from the agent shell will die when the heartbeat exits, even if it appeared healthy moments before. - Name the session descriptively — include the worktree name and port (e.g.,
auth-fix-3102). - Verify the server is listening before reporting the URL to anyone.
- Do not use
nohupor&alone — these are unreliable for agent shells that may have their entire process group killed. - Clean up when done — kill the tmux session when the testing is complete.
Common Mistakes
| Mistake | Fix |
|---|---|
| Server won't start | Run npx paperclipai doctor --repair to diagnose and auto-fix |
| Forgetting to source worktree env | Run eval "$(npx paperclipai worktree env)" after cd-ing into the worktree |
| Stale dependencies after pull | Run pnpm install && pnpm build after pulling |
| Schema out of date after pull | Run pnpm db:generate && pnpm db:migrate |
| Reseeding while target DB is running | Stop the target server first, or use --allow-live-target |
| Cleaning up with unmerged commits | Merge or push first, or use --force if intentionally discarding |
| Running agents against wrong instance | Verify PAPERCLIP_API_URL points to the correct port |
| CLI command fails | Do NOT work around it — report the error and block (see Hard Rules above) |
| Agent tries manual postgres operations | NEVER do this — all DB ops go through the CLI (see Hard Rules above) |
| Dev server dies between heartbeats | Launch in a detached tmux session — see "Persistent Dev Servers" above |
Pushed feature branch to paperclipai/paperclip when a fork exists |
Push to the user's fork remote instead — see "Forks" above |
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核