用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Arete-Consortium/ai-skills --skill mock命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Intelligent CI failure diagnosis and guided remediation for GitHub Actions, GitLab CI, and local builds
Pre-execution mapping of codebases, document collections, or problem spaces. Runs BEFORE any Gorgon workflow to give all agents shared situational awareness
Investigative methodology for analyzing document collections — provenance analysis, anomaly detection, redaction detection, and cross-document validation
正在显示 SKILL.md
| name | mock |
| description | Test Mock & Fixture Generator |
| lifecycle | experimental |
Generate mock objects, fixtures, and test data.
/mock ClassName # Generate mock for class
/mock path/to/module.py # Generate mocks for module
/mock --pytest # Pytest fixtures style
/mock --factory # Factory Boy style
import pytest
from unittest.mock import Mock, MagicMock, patch
@pytest.fixture
def mock_database():
"""Mock database connection."""
db = MagicMock()
db.query.return_value = [{"id": 1, "name": "Test"}]
db.insert.return_value = True
return db
@pytest.fixture
def mock_api_client():
"""Mock external API client."""
client = MagicMock()
client.get.return_value = {"status": "ok", "data": []}
client.post.return_value = {"id": 123}
return client
@pytest.fixture
def sample_user():
"""Sample user for testing."""
return {
"id": 1,
"username": "testuser",
"email": "test@example.com",
"created_at": "2024-01-01T00:00:00Z"
}
import factory
from factory import fuzzy
from myapp.models import User, Order
class UserFactory(factory.Factory):
class Meta:
model = User
id = factory.Sequence(lambda n: n)
username = factory.Faker('user_name')
email = factory.Faker('email')
created_at = factory.Faker('date_time')
class OrderFactory(factory.Factory):
class Meta:
model = Order
id = factory.Sequence(lambda n: n)
user = factory.SubFactory(UserFactory)
total = fuzzy.FuzzyDecimal(10.0, 1000.0)
status = fuzzy.FuzzyChoice(['pending', 'completed', 'cancelled'])
@pytest.fixture
def mock_external_services():
"""Patch all external service calls."""
with patch('myapp.services.api_client') as mock_api, \
patch('myapp.services.db_client') as mock_db, \
patch('myapp.services.cache') as mock_cache:
mock_api.get.return_value = {"data": []}
mock_db.query.return_value = []
mock_cache.get.return_value = None
yield {
'api': mock_api,
'db': mock_db,
'cache': mock_cache
}
mock.method.return_value = "result"
mock.method.side_effect = [1, 2, 3] # Sequential returns
mock.method.side_effect = ValueError("error") # Raise exception
mock.method.assert_called_once()
mock.method.assert_called_with(arg1, arg2)
mock.method.assert_not_called()
assert mock.method.call_count == 3
from unittest.mock import AsyncMock
@pytest.fixture
def mock_async_client():
client = AsyncMock()
client.fetch.return_value = {"data": []}
return client
When /mock is invoked: