run-tests — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited run-tests (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
当修改后端代码时,必须遵循以下规则:
backend/tests/ 对应目录下test_<功能名>_<场景># 运行所有测试
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# 测试通过后,必须运行 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 # 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) cd backend && uv run pytest tests/services/test_new_feature.py -v # 搜索相关测试
grep -r "test_<功能名>" backend/tests/assert 语句 cd backend && uv run pytest tests/ -vdef test_<被测对象>_<场景>_<预期结果>():
# 例如:
def test_create_agent_with_valid_data_returns_agent():
def test_create_agent_with_empty_name_raises_error():def test_example():
# Arrange - 准备测试数据
input_data = {...}
# Act - 执行被测代码
result = function_under_test(input_data)
# Assert - 验证结果
assert result == expected# conftest.py
@pytest.fixture
def sample_agent():
return Agent(name="test", type="faq")
# test_file.py
def test_agent_update(sample_agent):
sample_agent.name = "updated"
assert sample_agent.name == "updated"功能完成的检查清单:
uv run pytest tests/ -vuv run ruff check --fix验证流程:
# 1. 运行测试
cd backend && uv run pytest tests/ -v
# 2. 运行代码质量检查
cd backend && uv run ruff check --fix
# 两个命令都通过,功能才算完成只有满足以上所有条件,功能才算真正完成。
# 原代码:返回 {"id": id, "name": name}
# 修改后:返回 {"id": id, "name": name, "status": "active"}
# 需要更新测试:
def test_get_item():
result = get_item(1)
assert result["id"] == 1
assert result["name"] == "test"
assert result["status"] == "active" # 新增断言# 原代码:def process(data)
# 修改后:def process(data, options=None)
# 需要新增测试:
def test_process_with_options():
result = process(data, options={"flag": True})
assert result == expected_with_options# 原逻辑:价格 < 100 返回 "cheap"
# 新逻辑:价格 < 200 返回 "cheap"
# 需要更新测试:
def test_price_category_cheap():
assert get_category(150) == "cheap" # 原来期望 "normal",现在期望 "cheap"~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.