run-tests

Backend testing rules for Python projects that use pytest, a Python testing tool, and Ruff, a Python code checker. They require tests and checks for backend changes.

In plain words
What is it for?
Use them when adding features, fixing bugs, or refactoring backend Python code: update tests, run pytest, and run Ruff checks.
Why use it?
They make code changes easier to verify by requiring updated tests and preventing unfinished or style-checked failures from being treated as complete.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/congwa/mobile-agent/run-tests
Any agent
npx skills add congwa/mobile-agent --skill run-tests
Clone the repo
git clone --depth 1 https://github.com/congwa/mobile-agent

Made for: Claude Code, Codex.

Per session 137 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,849 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00137 $0.01849
Opus 5 $0.00068 $0.00924
Sonnet 5 $0.00027 $0.00370
Haiku 4.5 $0.00014 $0.00185

Measured 2d ago against content hash 93c47ccd067c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

run-tests scanned grade A with 0 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 2d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.windsurf/skills/run-tests/SKILL.md · 255 lines

How it starts

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

后端测试验证规则

一、强制要求

当修改后端代码时,必须遵循以下规则:

  1. 新功能必须有测试

    • 每个新增的函数/类必须有对应的单元测试
    • 测试文件放在 backend/tests/ 对应目录下
    • 测试函数命名:test_<功能名>_<场景>
  2. 修改代码必须同步更新测试

    • 修改业务逻辑后,必须检查并更新相关测试用例
    • 如果修改导致测试失败,需判断是代码 bug 还是测试需要更新
    • 业务变更 → 更新测试用例
    • 代码 bug → 修复代码
  3. 测试必须全部通过

    • 功能完成的标准:所有相关测试通过
    • 不允许跳过或注释掉失败的测试
  4. 测试用例必须反映最新业务

    • 测试用例应该与当前业务逻辑保持一致
    • 修改功能时,同时更新测试的预期结果

二、验证命令

2.1 测试命令

# 运行所有测试
cd backend && uv run pytest tests/ -v

# 运行特定模块测试
cd backend && uv run pytest tests/<module>/ -v

# 运行单个测试文件
cd backend && uv run pytest tests/<module>/test_<name>.py -v

# 运行匹配名称的测试
cd backend && uv run pytest -k "<pattern>" -v

2.2 代码质量检查(必须)

# 测试通过后,必须运行 ruff 检查并自动修复
cd backend && uv run ruff check --fix

# 如果有无法自动修复的问题,手动修复后重新检查
cd backend && uv run ruff check

注意:测试通过 + ruff 检查通过,才算代码验证完成。

三、测试目录结构

backend/tests/
├── conftest.py          # 共享 fixtures
├── core/                # 核心模块测试
│   ├── test_config.py
│   └── test_errors.py
├── models/              # 数据模型测试
│   └── test_conversation.py
├── repositories/        # 仓库层测试
│   └── test_base.py
├── schemas/             # Schema 测试
│   ├── test_agent.py
│   ├── test_chat.py
│   ├── test_events.py
│   └── test_websocket.py
└── services/            # 服务层测试
    ├── test_conversation.py
    └── test_streaming.py

四、工作流程

4.1 新增功能时

  1. 先写测试(推荐 TDD)

    # tests/services/test_new_feature.py
    def test_new_feature_basic():
        """测试新功能的基本场景"""
        result = new_feature(input)
        assert result == expected
    
    def test_new_feature_edge_case():
        """测试边界情况"""
        ...
    
    def test_new_feature_error_handling():
        """测试错误处理"""
        with pytest.raises(ExpectedError):
            new_feature(invalid_input)
    
  2. 实现功能代码

  3. 运行测试验证

    cd backend && uv run pytest tests/services/test_new_feature.py -v
    
  4. 测试通过后才算完成

4.2 修改现有功能时

  1. 先找到相关测试文件
    # 搜索相关测试
    grep -r "test_<功能名>" backend/tests/
    

Read the full file on GitHub · 255 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. 2d ago First seen · 255 lines · 137 tokens per session scan A 93c47ccd067c

Subscribe to this mod's changes

run-tests is a skill published in the GitHub repository congwa/mobile-agent (44 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 137 tokens to every session and 1,849 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

agent-host-chat-contributions

Build and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context injection, restored-history transformation, protocol-action observation, or when reviewing changes that add code to AgentSideEffects or AgentService.

microsoft/vscode · 56 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens