test-env-setup

test-env-setup is a skill for Claude Code, Codex from TashanGKD/tashan-cursor-skills. It costs 96 tokens per session (4,407 once invoked), scanned C, original, MIT.

A pre-test setup routine that checks services, starts a backend when needed, prepares the database and test accounts, and verifies dependencies.

In plain words
What is it for?
Use it before automated tests to check service health, launch required components, and prepare test data and dependencies.
Why use it?
It removes the repeated manual work of getting a project into a usable state before tests can run and reports when human intervention is required.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it before automated tests to check service health, launch required components, and prepare test data and dependencies.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tashangkd/tashan-cursor-skills/test-env-setup
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add TashanGKD/tashan-cursor-skills --skill test-env-setup
Clone the repo
git clone --depth 1 https://github.com/TashanGKD/tashan-cursor-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-env-setup

README.md
[![agentmods](https://agentmods.dev/badge/skills/tashangkd/tashan-cursor-skills/test-env-setup/github.svg)](https://agentmods.dev/skills/tashangkd/tashan-cursor-skills/test-env-setup)
Your own site
<a href="https://agentmods.dev/skills/tashangkd/tashan-cursor-skills/test-env-setup"><img src="https://agentmods.dev/badge/skills/tashangkd/tashan-cursor-skills/test-env-setup/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for test-env-setup

Your own site · 80×15
<a href="https://agentmods.dev/skills/tashangkd/tashan-cursor-skills/test-env-setup"><img src="https://agentmods.dev/badge/skills/tashangkd/tashan-cursor-skills/test-env-setup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 96 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,407 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00096 $0.04407
Opus 5 $0.00048 $0.02204
Sonnet 5 $0.00019 $0.00881
Haiku 4.5 $0.00010 $0.00441

Measured 9d ago against content hash e0402fff4c13, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade C, and why

test-env-setup scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

curl -s http://localhost:[PORT]/config-check 2>/dev/null | python3 -c "

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s --max-time 3 http://localhost:[PORT]/health 2>/dev/null
skills/test-env-setup/SKILL.md · 442 lines

How it starts

The opening of the file, as written. The whole thing — 442 lines — stays where its author put it; the contents beside it link to each section on GitHub.

测试环境自动准备(test-env-setup)

使命:让「说一句话就能开始测试」成为现实。 在测试智能体开始执行任何测试用例之前,自动完成所有环境准备工作。 若环境不可修复,输出明确的人工干预指引,不静默失败。


知识导航表

层级 文档 用途
D1 项目配置 项目群/[项目]/.cursor/test-config.md(若存在) 项目专属配置:端口/账号/技术栈
D2 技术架构 项目群/[项目]/2_技术架构/技术框架.md 了解服务架构和启动方式
D3 部署文档 项目群/[项目]/DEPLOY_ARCH.md 生产/测试账号信息

激活后立即执行

Step 0  【读取项目配置】
        先尝试读取 .cursor/test-config.md(项目专属配置)
        IF 不存在:使用智能推断(见后文「自动推断逻辑」)

Step 1  【后端服务健康检查 + 自动启动】

        1.1 检查服务是否在目标端口响应:
        ```bash
        curl -s --max-time 3 http://localhost:[PORT]/health 2>/dev/null
        ```
        
        IF 响应正常(含 "ok" 或 HTTP 200):
          → 输出「✅ 后端服务正常(端口 [PORT])」
          → 跳到 Step 2
        
        IF 无响应:
          1.2 检查是否有进程占用端口:
          ```bash
          lsof -i :[PORT] 2>/dev/null | head -5
          ```
          
          IF 有进程但未响应 → kill 并重启:
          ```bash
          pkill -f "uvicorn.*[PORT]" 2>/dev/null || true
          pkill -f "node.*[PORT]" 2>/dev/null || true
          sleep 2
          ```
          
          1.3 自动启动服务(根据技术栈):
          
          FastAPI/Python 项目:
          ```bash
          cd [项目根目录]
          # 激活虚拟环境(优先 .venv,其次 venv,其次系统 Python)
          PYTHON=$([ -f .venv/bin/python ] && echo .venv/bin/python || \
                   [ -f venv/bin/python ] && echo venv/bin/python || \
                   echo python3)
          # 后台启动,日志写入 /tmp/test-backend.log
          nohup $PYTHON -m uvicorn backend.app.main:app \
            --host 0.0.0.0 --port [PORT] --workers 1 \
            > /tmp/test-backend.log 2>&1 &
          echo "启动PID: $!"
          ```
          
          Node.js/Next.js 项目:
          ```bash
          cd [项目根目录]
          nohup npm run dev > /tmp/test-frontend.log 2>&1 &
          ```
          
          1.4 等待服务就绪(最多 30 秒):
          ```bash
          for i in $(seq 1 10); do
            sleep 3
            curl -s http://localhost:[PORT]/health && echo "✅ 服务就绪" && break
            echo "等待中... ($i/10)"
          done
          ```
          
          IF 30 秒后仍无响应:
          → 读取启动日志诊断:cat /tmp/test-backend.log | tail -20
          → 输出错误信息和诊断建议
          → 停止,输出:「❌ 后端服务无法自动启动,需要人工检查」
          → 附上日志内容供人工排查

Step 2  【数据库连接验证】
        ```bash
        # 通过服务健康端点间接验证 DB
        curl -s http://localhost:[PORT]/config-check 2>/dev/null | python3 -c "
        import sys, json
        d = json.load(sys.stdin)
        print('DB:', '✅' if d.get('db_configured') else '❌')
        " 2>/dev/null || echo "config-check 端点不可用(跳过DB验证)"
        ```
        
        IF DB 未连接(db_configured=false):
          → 尝试启动数据库(如有 docker-compose):
          ```bash
          docker-compose -f docker-compose.dev.yml up -d postgres 2>/dev/null || true
          sleep 5
          ```
          → 重新检查
          IF 仍然无法连接 → 输出「❌ 数据库连接失败,需要人工检查」

Step 3  【测试账号验证 + 自动创建(完整 Persona 体系)】
        
        需要创建以下 4 类测试人格账号(Personas):
        
        ```python
        # 测试 Persona 定义(从 test-config.md 读取,以下为默认值)
        PERSONAS = [
            # admin:管理员,生成邀请码
            {"phone": "10000000001", "password": "admin2026",
             "role": "admin",    "handle": "test_admin", "display_name": "测试管理员"},

Read the full file on GitHub · 442 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 442 lines · 96 tokens per session scan C e0402fff4c13

Subscribe to this mod's changes

test-env-setup is a skill published in the GitHub repository TashanGKD/tashan-cursor-skills (20 stars, last pushed 5mo ago), licensed MIT. It adds 96 tokens to every session and 4,407 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it C with 2 findings (downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

deploy-verify

Post-deploy smoke test across browser, Sentry, Supabase, Langfuse, and the public web. Use when "verify deploy", "smoke test production", "post-release check", or "ship or rollback". Deploy + observation loop → workflow-ship-and-observe. npm package release → deploy-npm.

kensaurus/cursor-kenji · 70 tokens

qa

QA lead testing mode with browser automation. Tests affected pages, fills forms, takes screenshots. Use when user says /qa, wants to test the app, needs QA verification, or wants browser-based testing.

Himanshu-Sangshetti/cursor-stack · 43 tokens

android-preflight

Final verification checklist to run before declaring Android work finished — build, both themes, string resources, lifecycle and leak risks, registered permissions and components, resource parity between values and values-night, and honest reporting of what was and was not verified. Use at the end of any feature, fix…

orbitalsonic/AndroidPilot · 79 tokens

browserstack

Run tests on BrowserStack. Use when user mentions "browserstack", "cross-browser", "cloud testing", "browser matrix", "test on safari", "test on firefox", or "browser compatibility".

bestagentkits/agency-skills · 44 tokens

Azure Resource Manager Playwright Dotnet

Azure Resource Manager SDK for Microsoft Playwright Testing in .NET. Use for MANAGEMENT PLANE operations: creating/managing Playwright Testing workspaces, checking name availability, and managing workspace quotas via Azure Resource Manager. NOT for running Playwright tests - use…

mayurrathi/awesome-agent-skills · 110 tokens

patrol-e2e-testing

Use when writing E2E/integration tests, testing native interactions like permissions or system dialogs, capturing UI regressions, or validating cross-platform behavior (Patrol 4.x).

evanca/flutter-ai-rules · 43 tokens