[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E16AZ7BRHXMHAF2B40B18G":3,"skill-same:01M6E16AZ7BRHXMHAF2B40B18G":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":34,"linkOnly":35,"markdownContent":36,"markdownBody":37,"frontMatter":38,"refName":39,"commitSha":40,"skillDirectory":41,"forksCount":13,"repositoryHtmlUrl":42,"repositoryHomepageUrl":43,"ownerHtmlUrl":44,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":45,"install":46,"resources":59},"01M6E16AZ7BRHXMHAF2B40B18G","django-tdd",null,"Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.","7dvq6yrkgs-stack\u002Fplaywright","7dvq6yrkgs-stack","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F251638143?v=4","01M6E061J2AMGWYZ6TK7Y8NM74","01M6E061PQCQJGQMPBERMCFN5G",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack\u002Fplaywright\u002Fblob\u002Fmain\u002Fskills\u002Fdjango-tdd\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33],"tdd","django tdd","django","testing","framework","methodology","REST","factory","coverage","pytest","strategies","2026-11-10 10:12:30",false,"---\nname: django-tdd\ndescription: Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.\n---\n\n# Django テスト駆動開発(TDD)\n\npytest、factory_boy、Django REST Frameworkを使用したDjangoアプリケーションのテスト駆動開発。\n\n## いつ有効化するか\n\n- 新しいDjangoアプリケーションを書くとき\n- Django REST Framework APIを実装するとき\n- Djangoモデル、ビュー、シリアライザーをテストするとき\n- Djangoプロジェクトのテストインフラを設定するとき\n\n## DjangoのためのTDDワークフロー\n\n### Red-Green-Refactorサイクル\n\n```python\n# ステップ1: RED - 失敗するテストを書く\ndef test_user_creation():\n    user = User.objects.create_user(email='test@example.com', password='testpass123')\n    assert user.email == 'test@example.com'\n    assert user.check_password('testpass123')\n    assert not user.is_staff\n\n# ステップ2: GREEN - テストを通す\n# Userモデルまたはファクトリーを作成\n\n# ステップ3: REFACTOR - テストをグリーンに保ちながら改善\n```\n\n## セットアップ\n\n### pytest設定\n\n```ini\n# pytest.ini\n[pytest]\nDJANGO_SETTINGS_MODULE = config.settings.test\ntestpaths = tests\npython_files = test_*.py\npython_classes = Test*\npython_functions = test_*\naddopts =\n    --reuse-db\n    --nomigrations\n    --cov=apps\n    --cov-report=html\n    --cov-report=term-missing\n    --strict-markers\nmarkers =\n    slow: marks tests as slow\n    integration: marks tests as integration tests\n```\n\n### テスト設定\n\n```python\n# config\u002Fsettings\u002Ftest.py\nfrom .base import *\n\nDEBUG = True\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.sqlite3',\n        'NAME': ':memory:',\n    }\n}\n\n# マイグレーションを無効化して高速化\nclass DisableMigrations:\n    def __contains__(self, item):\n        return True\n\n    def __getitem__(self, item):\n        return None\n\nMIGRATION_MODULES = DisableMigrations()\n\n# より高速なパスワードハッシング\nPASSWORD_HASHERS = [\n    'django.contrib.auth.hashers.MD5PasswordHasher',\n]\n\n# メールバックエンド\nEMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'\n\n# Celeryは常にeager\nCELERY_TASK_ALWAYS_EAGER = True\nCELERY_TASK_EAGER_PROPAGATES = True\n```\n\n### conftest.py\n\n```python\n# tests\u002Fconftest.py\nimport pytest\nfrom django.utils import timezone\nfrom django.contrib.auth import get_user_model\n\nUser = get_user_model()\n\n@pytest.fixture(autouse=True)\ndef timezone_settings(settings):\n    \"\"\"一貫したタイムゾーンを確保。\"\"\"\n    settings.TIME_ZONE = 'UTC'\n\n@pytest.fixture\ndef user(db):\n    \"\"\"テストユーザーを作成。\"\"\"\n    return User.objects.create_user(\n        email='test@example.com',\n        password='testpass123',\n        username='testuser'\n    )\n\n@pytest.fixture\ndef admin_user(db):\n    \"\"\"管理者ユーザーを作成。\"\"\"\n    return User.objects.create_superuser(\n        email='admin@example.com',\n        password='adminpass123',\n        username='admin'\n    )\n\n@pytest.fixture\ndef authenticated_client(client, user):\n    \"\"\"認証済みクライアントを返す。\"\"\"\n    client.force_login(user)\n    return client\n\n@pytest.fixture\ndef api_client():\n    \"\"\"DRF APIクライアントを返す。\"\"\"\n    from rest_framework.test import APIClient\n    return APIClient()\n\n@pytest.fixture\ndef authenticated_api_client(api_client, user):\n    \"\"\"認証済みAPIクライアントを返す。\"\"\"\n    api_client.force_authenticate(user=user)\n    return api_client\n```\n\n## Factory Boy\n\n### ファクトリーセットアップ\n\n```python\n# tests\u002Ffactories.py\nimport factory\nfrom factory import fuzzy\nfrom datetime import datetime, timedelta\nfrom django.contrib.auth import get_user_model\nfrom apps.products.models import Product, Category\n\nUser = get_user_model()\n\nclass UserFactory(factory.django.DjangoModelFactory):\n    \"\"\"Userモデルのファクトリー。\"\"\"\n\n    class Meta:\n        model = User\n\n    email = factory.Sequence(lambda n: f\"user{n}@example.com\")\n    username = factory.Sequence(lambda n: f\"user{n}\")\n    password = factory.PostGenerationMethodCall('set_password', 'testpass123')\n    first_name = factory.Faker('first_name')\n    last_name = factory.Faker('last_name')\n    is_active = True\n\nclass CategoryFactory(factory.django.DjangoModelFactory):\n    \"\"\"Categoryモデルのファクトリー。\"\"\"\n\n    class Meta:\n        model = Category\n\n    name = factory.Faker('word')\n    slug = factory.LazyAttribute(lambda obj: obj.name.lower())\n    description = factory.Faker('text')\n\nclass ProductFactory(factory.django.DjangoModelFactory):\n    \"\"\"Productモデルのファクトリー。\"\"\"\n\n    class Meta:\n        model = Product\n\n    name = factory.Faker('sentence', nb_words=3)\n    slug = factory.LazyAttribute(lambda obj: obj.name.lower().replace(' ', '-'))\n    description = factory.Faker('text')\n    price = fuzzy.FuzzyDecimal(10.00, 1000.00, 2)\n    stock = fuzzy.FuzzyInteger(0, 100)\n    is_active = True\n    category = factory.SubFactory(CategoryFactory)\n    created_by = factory.SubFactory(UserFactory)\n\n    @factory.post_generation\n    def tags(self, create, extracted, **kwargs):\n        \"\"\"製品にタグを追加。\"\"\"\n        if not create:\n            return\n        if extracted:\n            for tag in extracted:\n                self.tags.add(tag)\n```\n\n### ファクトリーの使用\n\n```python\n# tests\u002Ftest_models.py\nimport pytest\nfrom tests.factories import ProductFactory, UserFactory\n\ndef test_product_creation():\n    \"\"\"ファクトリーを使用した製品作成をテスト。\"\"\"\n    product = ProductFactory(price=100.00, stock=50)\n    assert product.price == 100.00\n    assert product.stock == 50\n    assert product.is_active is True\n\ndef test_product_with_tags():\n    \"\"\"タグ付き製品をテスト。\"\"\"\n    tags = [TagFactory(name='electronics'), TagFactory(name='new')]\n    product = ProductFactory(tags=tags)\n    assert product.tags.count() == 2\n\ndef test_multiple_products():\n    \"\"\"複数の製品作成をテスト。\"\"\"\n    products = ProductFactory.create_batch(10)\n    assert len(products) == 10\n```\n\n## モデルテスト\n\n### モデルテスト\n\n```python\n# tests\u002Ftest_models.py\nimport pytest\nfrom django.core.exceptions import ValidationError\nfrom tests.factories import UserFactory, ProductFactory\n\nclass TestUserModel:\n    \"\"\"Userモデルをテスト。\"\"\"\n\n    def test_create_user(self, db):\n        \"\"\"通常のユーザー作成をテスト。\"\"\"\n        user = UserFactory(email='test@example.com')\n        assert user.email == 'test@example.com'\n        assert user.check_password('testpass123')\n        assert not user.is_staff\n        assert not user.is_superuser\n\n    def test_create_superuser(self, db):\n        \"\"\"スーパーユーザー作成をテスト。\"\"\"\n        user = UserFactory(\n            email='admin@example.com',\n            is_staff=True,\n            is_superuser=True\n        )\n        assert user.is_staff\n        assert user.is_superuser\n\n    def test_user_str(self, db):\n        \"\"\"ユーザーの文字列表現をテスト。\"\"\"\n        user = UserFactory(email='test@example.com')\n        assert str(user) == 'test@example.com'\n\nclass TestProductModel:\n    \"\"\"Productモデルをテスト。\"\"\"\n\n    def test_product_creation(self, db):\n        \"\"\"製品作成をテスト。\"\"\"\n        product = ProductFactory()\n        assert product.id is not None\n        assert product.is_active is True\n        assert product.created_at is not None\n\n    def test_product_slug_generation(self, db):\n        \"\"\"自動スラッグ生成をテスト。\"\"\"\n        product = ProductFactory(name='Test Product')\n        assert product.slug == 'test-product'\n\n    def test_product_price_validation(self, db):\n        \"\"\"価格が負の値にならないことをテスト。\"\"\"\n        product = ProductFactory(price=-10)\n        with pytest.raises(ValidationError):\n            product.full_clean()\n\n    def test_product_manager_active(self, db):\n        \"\"\"アクティブマネージャーメソッドをテスト。\"\"\"\n        ProductFactory.create_batch(5, is_active=True)\n        ProductFactory.create_batch(3, is_active=False)\n\n        active_count = Product.objects.active().count()\n        assert active_count == 5\n\n    def test_product_stock_management(self, db):\n        \"\"\"在庫管理をテスト。\"\"\"\n        product = ProductFactory(stock=10)\n        product.reduce_stock(5)\n        product.refresh_from_db()\n        assert product.stock == 5\n\n        with pytest.raises(ValueError):\n            product.reduce_stock(10)  # 在庫不足\n```\n\n## ビューテスト\n\n### Djangoビューテスト\n\n```python\n# tests\u002Ftest_views.py\nimport pytest\nfrom django.urls import reverse\nfrom tests.factories import ProductFactory, UserFactory\n\nclass TestProductViews:\n    \"\"\"製品ビューをテスト。\"\"\"\n\n    def test_product_list(self, client, db):\n        \"\"\"製品リストビューをテスト。\"\"\"\n        ProductFactory.create_batch(10)\n\n        response = client.get(reverse('products:list'))\n\n        assert response.status_code == 200\n        assert len(response.context['products']) == 10\n\n    def test_product_detail(self, client, db):\n        \"\"\"製品詳細ビューをテスト。\"\"\"\n        product = ProductFactory()\n\n        response = client.get(reverse('products:detail', kwargs={'slug': product.slug}))\n\n        assert response.status_code == 200\n        assert response.context['product'] == product\n\n    def test_product_create_requires_login(self, client, db):\n        \"\"\"製品作成に認証が必要であることをテスト。\"\"\"\n        response = client.get(reverse('products:create'))\n\n        assert response.status_code == 302\n        assert response.url.startswith('\u002Faccounts\u002Flogin\u002F')\n\n    def test_product_create_authenticated(self, authenticated_client, db):\n        \"\"\"認証済みユーザーとしての製品作成をテスト。\"\"\"\n        response = authenticated_client.get(reverse('products:create'))\n\n        assert response.status_code == 200\n\n    def test_product_create_post(self, authenticated_client, db, category):\n        \"\"\"POSTによる製品作成をテスト。\"\"\"\n        data = {\n            'name': 'Test Product',\n            'description': 'A test product',\n            'price': '99.99',\n            'stock': 10,\n            'category': category.id,\n        }\n\n        response = authenticated_client.post(reverse('products:create'), data)\n\n        assert response.status_code == 302\n        assert Product.objects.filter(name='Test Product').exists()\n```\n\n## DRF APIテスト\n\n### シリアライザーテスト\n\n```python\n# tests\u002Ftest_serializers.py\nimport pytest\nfrom rest_framework.exceptions import ValidationError\nfrom apps.products.serializers import ProductSerializer\nfrom tests.factories import ProductFactory\n\nclass TestProductSerializer:\n    \"\"\"ProductSerializerをテスト。\"\"\"\n\n    def test_serialize_product(self, db):\n        \"\"\"製品のシリアライズをテスト。\"\"\"\n        product = ProductFactory()\n        serializer = ProductSerializer(product)\n\n        data = serializer.data\n\n        assert data['id'] == product.id\n        assert data['name'] == product.name\n        assert data['price'] == str(product.price)\n\n    def test_deserialize_product(self, db):\n        \"\"\"製品データのデシリアライズをテスト。\"\"\"\n        data = {\n            'name': 'Test Product',\n            'description': 'Test description',\n            'price': '99.99',\n            'stock': 10,\n            'category': 1,\n        }\n\n        serializer = ProductSerializer(data=data)\n\n        assert serializer.is_valid()\n        product = serializer.save()\n\n        assert product.name == 'Test Product'\n        assert float(product.price) == 99.99\n\n    def test_price_validation(self, db):\n        \"\"\"価格検証をテスト。\"\"\"\n        data = {\n            'name': 'Test Product',\n            'price': '-10.00',\n            'stock': 10,\n        }\n\n        serializer = ProductSerializer(data=data)\n\n        assert not serializer.is_valid()\n        assert 'price' in serializer.errors\n\n    def test_stock_validation(self, db):\n        \"\"\"在庫が負にならないことをテスト。\"\"\"\n        data = {\n            'name': 'Test Product',\n            'price': '99.99',\n            'stock': -5,\n        }\n\n        serializer = ProductSerializer(data=data)\n\n        assert not serializer.is_valid()\n        assert 'stock' in serializer.errors\n```\n\n### API ViewSetテスト\n\n```python\n# tests\u002Ftest_api.py\nimport pytest\nfrom rest_framework.test import APIClient\nfrom rest_framework import status\nfrom django.urls import reverse\nfrom tests.factories import ProductFactory, UserFactory\n\nclass TestProductAPI:\n    \"\"\"Product APIエンドポイントをテスト。\"\"\"\n\n    @pytest.fixture\n    def api_client(self):\n        \"\"\"APIクライアントを返す。\"\"\"\n        return APIClient()\n\n    def test_list_products(self, api_client, db):\n        \"\"\"製品リストをテスト。\"\"\"\n        ProductFactory.create_batch(10)\n\n        url = reverse('api:product-list')\n        response = api_client.get(url)\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['count'] == 10\n\n    def test_retrieve_product(self, api_client, db):\n        \"\"\"製品取得をテスト。\"\"\"\n        product = ProductFactory()\n\n        url = reverse('api:product-detail', kwargs={'pk': product.id})\n        response = api_client.get(url)\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['id'] == product.id\n\n    def test_create_product_unauthorized(self, api_client, db):\n        \"\"\"認証なしの製品作成をテスト。\"\"\"\n        url = reverse('api:product-list')\n        data = {'name': 'Test Product', 'price': '99.99'}\n\n        response = api_client.post(url, data)\n\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_create_product_authorized(self, authenticated_api_client, db):\n        \"\"\"認証済みユーザーとしての製品作成をテスト。\"\"\"\n        url = reverse('api:product-list')\n        data = {\n            'name': 'Test Product',\n            'description': 'Test',\n            'price': '99.99',\n            'stock': 10,\n        }\n\n        response = authenticated_api_client.post(url, data)\n\n        assert response.status_code == status.HTTP_201_CREATED\n        assert response.data['name'] == 'Test Product'\n\n    def test_update_product(self, authenticated_api_client, db):\n        \"\"\"製品更新をテスト。\"\"\"\n        product = ProductFactory(created_by=authenticated_api_client.user)\n\n        url = reverse('api:product-detail', kwargs={'pk': product.id})\n        data = {'name': 'Updated Product'}\n\n        response = authenticated_api_client.patch(url, data)\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['name'] == 'Updated Product'\n\n    def test_delete_product(self, authenticated_api_client, db):\n        \"\"\"製品削除をテスト。\"\"\"\n        product = ProductFactory(created_by=authenticated_api_client.user)\n\n        url = reverse('api:product-detail', kwargs={'pk': product.id})\n        response = authenticated_api_client.delete(url)\n\n        assert response.status_code == status.HTTP_204_NO_CONTENT\n\n    def test_filter_products_by_price(self, api_client, db):\n        \"\"\"価格による製品フィルタリングをテスト。\"\"\"\n        ProductFactory(price=50)\n        ProductFactory(price=150)\n\n        url = reverse('api:product-list')\n        response = api_client.get(url, {'price_min': 100})\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['count'] == 1\n\n    def test_search_products(self, api_client, db):\n        \"\"\"製品検索をテスト。\"\"\"\n        ProductFactory(name='Apple iPhone')\n        ProductFactory(name='Samsung Galaxy')\n\n        url = reverse('api:product-list')\n        response = api_client.get(url, {'search': 'Apple'})\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['count'] == 1\n```\n\n## モッキングとパッチング\n\n### 外部サービスのモック\n\n```python\n# tests\u002Ftest_views.py\nfrom unittest.mock import patch, Mock\nimport pytest\n\nclass TestPaymentView:\n    \"\"\"モックされた決済ゲートウェイで決済ビューをテスト。\"\"\"\n\n    @patch('apps.payments.services.stripe')\n    def test_successful_payment(self, mock_stripe, client, user, product):\n        \"\"\"モックされたStripeで成功した決済をテスト。\"\"\"\n        # モックを設定\n        mock_stripe.Charge.create.return_value = {\n            'id': 'ch_123',\n            'status': 'succeeded',\n            'amount': 9999,\n        }\n\n        client.force_login(user)\n        response = client.post(reverse('payments:process'), {\n            'product_id': product.id,\n            'token': 'tok_visa',\n        })\n\n        assert response.status_code == 302\n        mock_stripe.Charge.create.assert_called_once()\n\n    @patch('apps.payments.services.stripe')\n    def test_failed_payment(self, mock_stripe, client, user, product):\n        \"\"\"失敗した決済をテスト。\"\"\"\n        mock_stripe.Charge.create.side_effect = Exception('Card declined')\n\n        client.force_login(user)\n        response = client.post(reverse('payments:process'), {\n            'product_id': product.id,\n            'token': 'tok_visa',\n        })\n\n        assert response.status_code == 302\n        assert 'error' in response.url\n```\n\n### メール送信のモック\n\n```python\n# tests\u002Ftest_email.py\nfrom django.core import mail\nfrom django.test import override_settings\n\n@override_settings(EMAIL_BACKEND='django.core.mail.backends.locmem.EmailBackend')\ndef test_order_confirmation_email(db, order):\n    \"\"\"注文確認メールをテスト。\"\"\"\n    order.send_confirmation_email()\n\n    assert len(mail.outbox) == 1\n    assert order.user.email in mail.outbox[0].to\n    assert 'Order Confirmation' in mail.outbox[0].subject\n```\n\n## 統合テスト\n\n### 完全フローテスト\n\n```python\n# tests\u002Ftest_integration.py\nimport pytest\nfrom django.urls import reverse\nfrom tests.factories import UserFactory, ProductFactory\n\nclass TestCheckoutFlow:\n    \"\"\"完全なチェックアウトフローをテスト。\"\"\"\n\n    def test_guest_to_purchase_flow(self, client, db):\n        \"\"\"ゲストから購入までの完全なフローをテスト。\"\"\"\n        # ステップ1: 登録\n        response = client.post(reverse('users:register'), {\n            'email': 'test@example.com',\n            'password': 'testpass123',\n            'password_confirm': 'testpass123',\n        })\n        assert response.status_code == 302\n\n        # ステップ2: ログイン\n        response = client.post(reverse('users:login'), {\n            'email': 'test@example.com',\n            'password': 'testpass123',\n        })\n        assert response.status_code == 302\n\n        # ステップ3: 製品を閲覧\n        product = ProductFactory(price=100)\n        response = client.get(reverse('products:detail', kwargs={'slug': product.slug}))\n        assert response.status_code == 200\n\n        # ステップ4: カートに追加\n        response = client.post(reverse('cart:add'), {\n            'product_id': product.id,\n            'quantity': 1,\n        })\n        assert response.status_code == 302\n\n        # ステップ5: チェックアウト\n        response = client.get(reverse('checkout:review'))\n        assert response.status_code == 200\n        assert product.name in response.content.decode()\n\n        # ステップ6: 購入を完了\n        with patch('apps.checkout.services.process_payment') as mock_payment:\n            mock_payment.return_value = True\n            response = client.post(reverse('checkout:complete'))\n\n        assert response.status_code == 302\n        assert Order.objects.filter(user__email='test@example.com').exists()\n```\n\n## テストのベストプラクティス\n\n### すべきこと\n\n- **ファクトリーを使用**: 手動オブジェクト作成の代わりに\n- **テストごとに1つのアサーション**: テストを焦点を絞る\n- **説明的なテスト名**: `test_user_cannot_delete_others_post`\n- **エッジケースをテスト**: 空の入力、None値、境界条件\n- **外部サービスをモック**: 外部APIに依存しない\n- **フィクスチャを使用**: 重複を排除\n- **パーミッションをテスト**: 認可が機能することを確認\n- **テストを高速に保つ**: `--reuse-db`と`--nomigrations`を使用\n\n### すべきでないこと\n\n- **Django内部をテストしない**: Djangoが機能することを信頼\n- **サードパーティコードをテストしない**: ライブラリが機能することを信頼\n- **失敗するテストを無視しない**: すべてのテストが通る必要がある\n- **テストを依存させない**: テストは任意の順序で実行できるべき\n- **過度にモックしない**: 外部依存関係のみをモック\n- **プライベートメソッドをテストしない**: パブリックインターフェースをテスト\n- **本番データベースを使用しない**: 常にテストデータベースを使用\n\n## カバレッジ\n\n### カバレッジ設定\n\n```bash\n# カバレッジでテストを実行\npytest --cov=apps --cov-report=html --cov-report=term-missing\n\n# HTMLレポートを生成\nopen htmlcov\u002Findex.html\n```\n\n### カバレッジ目標\n\n| コンポーネント | 目標カバレッジ |\n|-----------|-----------------|\n| モデル | 90%+ |\n| シリアライザー | 85%+ |\n| ビュー | 80%+ |\n| サービス | 90%+ |\n| ユーティリティ | 80%+ |\n| 全体 | 80%+ |\n\n## クイックリファレンス\n\n| パターン | 使用法 |\n|---------|-------|\n| `@pytest.mark.django_db` | データベースアクセスを有効化 |\n| `client` | Djangoテストクライアント |\n| `api_client` | DRF APIクライアント |\n| `factory.create_batch(n)` | 複数のオブジェクトを作成 |\n| `patch('module.function')` | 外部依存関係をモック |\n| `override_settings` | 設定を一時的に変更 |\n| `force_authenticate()` | テストで認証をバイパス |\n| `assertRedirects` | リダイレクトをチェック |\n| `assertTemplateUsed` | テンプレート使用を検証 |\n| `mail.outbox` | 送信されたメールをチェック |\n\n**覚えておいてください**: テストはドキュメントです。良いテストはコードがどのように動作すべきかを説明します。シンプルで、読みやすく、保守可能に保ってください。\n","# Django テスト駆動開発(TDD)\n\npytest、factory_boy、Django REST Frameworkを使用したDjangoアプリケーションのテスト駆動開発。\n\n## いつ有効化するか\n\n- 新しいDjangoアプリケーションを書くとき\n- Django REST Framework APIを実装するとき\n- Djangoモデル、ビュー、シリアライザーをテストするとき\n- Djangoプロジェクトのテストインフラを設定するとき\n\n## DjangoのためのTDDワークフロー\n\n### Red-Green-Refactorサイクル\n\n```python\n# ステップ1: RED - 失敗するテストを書く\ndef test_user_creation():\n    user = User.objects.create_user(email='test@example.com', password='testpass123')\n    assert user.email == 'test@example.com'\n    assert user.check_password('testpass123')\n    assert not user.is_staff\n\n# ステップ2: GREEN - テストを通す\n# Userモデルまたはファクトリーを作成\n\n# ステップ3: REFACTOR - テストをグリーンに保ちながら改善\n```\n\n## セットアップ\n\n### pytest設定\n\n```ini\n# pytest.ini\n[pytest]\nDJANGO_SETTINGS_MODULE = config.settings.test\ntestpaths = tests\npython_files = test_*.py\npython_classes = Test*\npython_functions = test_*\naddopts =\n    --reuse-db\n    --nomigrations\n    --cov=apps\n    --cov-report=html\n    --cov-report=term-missing\n    --strict-markers\nmarkers =\n    slow: marks tests as slow\n    integration: marks tests as integration tests\n```\n\n### テスト設定\n\n```python\n# config\u002Fsettings\u002Ftest.py\nfrom .base import *\n\nDEBUG = True\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.sqlite3',\n        'NAME': ':memory:',\n    }\n}\n\n# マイグレーションを無効化して高速化\nclass DisableMigrations:\n    def __contains__(self, item):\n        return True\n\n    def __getitem__(self, item):\n        return None\n\nMIGRATION_MODULES = DisableMigrations()\n\n# より高速なパスワードハッシング\nPASSWORD_HASHERS = [\n    'django.contrib.auth.hashers.MD5PasswordHasher',\n]\n\n# メールバックエンド\nEMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'\n\n# Celeryは常にeager\nCELERY_TASK_ALWAYS_EAGER = True\nCELERY_TASK_EAGER_PROPAGATES = True\n```\n\n### conftest.py\n\n```python\n# tests\u002Fconftest.py\nimport pytest\nfrom django.utils import timezone\nfrom django.contrib.auth import get_user_model\n\nUser = get_user_model()\n\n@pytest.fixture(autouse=True)\ndef timezone_settings(settings):\n    \"\"\"一貫したタイムゾーンを確保。\"\"\"\n    settings.TIME_ZONE = 'UTC'\n\n@pytest.fixture\ndef user(db):\n    \"\"\"テストユーザーを作成。\"\"\"\n    return User.objects.create_user(\n        email='test@example.com',\n        password='testpass123',\n        username='testuser'\n    )\n\n@pytest.fixture\ndef admin_user(db):\n    \"\"\"管理者ユーザーを作成。\"\"\"\n    return User.objects.create_superuser(\n        email='admin@example.com',\n        password='adminpass123',\n        username='admin'\n    )\n\n@pytest.fixture\ndef authenticated_client(client, user):\n    \"\"\"認証済みクライアントを返す。\"\"\"\n    client.force_login(user)\n    return client\n\n@pytest.fixture\ndef api_client():\n    \"\"\"DRF APIクライアントを返す。\"\"\"\n    from rest_framework.test import APIClient\n    return APIClient()\n\n@pytest.fixture\ndef authenticated_api_client(api_client, user):\n    \"\"\"認証済みAPIクライアントを返す。\"\"\"\n    api_client.force_authenticate(user=user)\n    return api_client\n```\n\n## Factory Boy\n\n### ファクトリーセットアップ\n\n```python\n# tests\u002Ffactories.py\nimport factory\nfrom factory import fuzzy\nfrom datetime import datetime, timedelta\nfrom django.contrib.auth import get_user_model\nfrom apps.products.models import Product, Category\n\nUser = get_user_model()\n\nclass UserFactory(factory.django.DjangoModelFactory):\n    \"\"\"Userモデルのファクトリー。\"\"\"\n\n    class Meta:\n        model = User\n\n    email = factory.Sequence(lambda n: f\"user{n}@example.com\")\n    username = factory.Sequence(lambda n: f\"user{n}\")\n    password = factory.PostGenerationMethodCall('set_password', 'testpass123')\n    first_name = factory.Faker('first_name')\n    last_name = factory.Faker('last_name')\n    is_active = True\n\nclass CategoryFactory(factory.django.DjangoModelFactory):\n    \"\"\"Categoryモデルのファクトリー。\"\"\"\n\n    class Meta:\n        model = Category\n\n    name = factory.Faker('word')\n    slug = factory.LazyAttribute(lambda obj: obj.name.lower())\n    description = factory.Faker('text')\n\nclass ProductFactory(factory.django.DjangoModelFactory):\n    \"\"\"Productモデルのファクトリー。\"\"\"\n\n    class Meta:\n        model = Product\n\n    name = factory.Faker('sentence', nb_words=3)\n    slug = factory.LazyAttribute(lambda obj: obj.name.lower().replace(' ', '-'))\n    description = factory.Faker('text')\n    price = fuzzy.FuzzyDecimal(10.00, 1000.00, 2)\n    stock = fuzzy.FuzzyInteger(0, 100)\n    is_active = True\n    category = factory.SubFactory(CategoryFactory)\n    created_by = factory.SubFactory(UserFactory)\n\n    @factory.post_generation\n    def tags(self, create, extracted, **kwargs):\n        \"\"\"製品にタグを追加。\"\"\"\n        if not create:\n            return\n        if extracted:\n            for tag in extracted:\n                self.tags.add(tag)\n```\n\n### ファクトリーの使用\n\n```python\n# tests\u002Ftest_models.py\nimport pytest\nfrom tests.factories import ProductFactory, UserFactory\n\ndef test_product_creation():\n    \"\"\"ファクトリーを使用した製品作成をテスト。\"\"\"\n    product = ProductFactory(price=100.00, stock=50)\n    assert product.price == 100.00\n    assert product.stock == 50\n    assert product.is_active is True\n\ndef test_product_with_tags():\n    \"\"\"タグ付き製品をテスト。\"\"\"\n    tags = [TagFactory(name='electronics'), TagFactory(name='new')]\n    product = ProductFactory(tags=tags)\n    assert product.tags.count() == 2\n\ndef test_multiple_products():\n    \"\"\"複数の製品作成をテスト。\"\"\"\n    products = ProductFactory.create_batch(10)\n    assert len(products) == 10\n```\n\n## モデルテスト\n\n### モデルテスト\n\n```python\n# tests\u002Ftest_models.py\nimport pytest\nfrom django.core.exceptions import ValidationError\nfrom tests.factories import UserFactory, ProductFactory\n\nclass TestUserModel:\n    \"\"\"Userモデルをテスト。\"\"\"\n\n    def test_create_user(self, db):\n        \"\"\"通常のユーザー作成をテスト。\"\"\"\n        user = UserFactory(email='test@example.com')\n        assert user.email == 'test@example.com'\n        assert user.check_password('testpass123')\n        assert not user.is_staff\n        assert not user.is_superuser\n\n    def test_create_superuser(self, db):\n        \"\"\"スーパーユーザー作成をテスト。\"\"\"\n        user = UserFactory(\n            email='admin@example.com',\n            is_staff=True,\n            is_superuser=True\n        )\n        assert user.is_staff\n        assert user.is_superuser\n\n    def test_user_str(self, db):\n        \"\"\"ユーザーの文字列表現をテスト。\"\"\"\n        user = UserFactory(email='test@example.com')\n        assert str(user) == 'test@example.com'\n\nclass TestProductModel:\n    \"\"\"Productモデルをテスト。\"\"\"\n\n    def test_product_creation(self, db):\n        \"\"\"製品作成をテスト。\"\"\"\n        product = ProductFactory()\n        assert product.id is not None\n        assert product.is_active is True\n        assert product.created_at is not None\n\n    def test_product_slug_generation(self, db):\n        \"\"\"自動スラッグ生成をテスト。\"\"\"\n        product = ProductFactory(name='Test Product')\n        assert product.slug == 'test-product'\n\n    def test_product_price_validation(self, db):\n        \"\"\"価格が負の値にならないことをテスト。\"\"\"\n        product = ProductFactory(price=-10)\n        with pytest.raises(ValidationError):\n            product.full_clean()\n\n    def test_product_manager_active(self, db):\n        \"\"\"アクティブマネージャーメソッドをテスト。\"\"\"\n        ProductFactory.create_batch(5, is_active=True)\n        ProductFactory.create_batch(3, is_active=False)\n\n        active_count = Product.objects.active().count()\n        assert active_count == 5\n\n    def test_product_stock_management(self, db):\n        \"\"\"在庫管理をテスト。\"\"\"\n        product = ProductFactory(stock=10)\n        product.reduce_stock(5)\n        product.refresh_from_db()\n        assert product.stock == 5\n\n        with pytest.raises(ValueError):\n            product.reduce_stock(10)  # 在庫不足\n```\n\n## ビューテスト\n\n### Djangoビューテスト\n\n```python\n# tests\u002Ftest_views.py\nimport pytest\nfrom django.urls import reverse\nfrom tests.factories import ProductFactory, UserFactory\n\nclass TestProductViews:\n    \"\"\"製品ビューをテスト。\"\"\"\n\n    def test_product_list(self, client, db):\n        \"\"\"製品リストビューをテスト。\"\"\"\n        ProductFactory.create_batch(10)\n\n        response = client.get(reverse('products:list'))\n\n        assert response.status_code == 200\n        assert len(response.context['products']) == 10\n\n    def test_product_detail(self, client, db):\n        \"\"\"製品詳細ビューをテスト。\"\"\"\n        product = ProductFactory()\n\n        response = client.get(reverse('products:detail', kwargs={'slug': product.slug}))\n\n        assert response.status_code == 200\n        assert response.context['product'] == product\n\n    def test_product_create_requires_login(self, client, db):\n        \"\"\"製品作成に認証が必要であることをテスト。\"\"\"\n        response = client.get(reverse('products:create'))\n\n        assert response.status_code == 302\n        assert response.url.startswith('\u002Faccounts\u002Flogin\u002F')\n\n    def test_product_create_authenticated(self, authenticated_client, db):\n        \"\"\"認証済みユーザーとしての製品作成をテスト。\"\"\"\n        response = authenticated_client.get(reverse('products:create'))\n\n        assert response.status_code == 200\n\n    def test_product_create_post(self, authenticated_client, db, category):\n        \"\"\"POSTによる製品作成をテスト。\"\"\"\n        data = {\n            'name': 'Test Product',\n            'description': 'A test product',\n            'price': '99.99',\n            'stock': 10,\n            'category': category.id,\n        }\n\n        response = authenticated_client.post(reverse('products:create'), data)\n\n        assert response.status_code == 302\n        assert Product.objects.filter(name='Test Product').exists()\n```\n\n## DRF APIテスト\n\n### シリアライザーテスト\n\n```python\n# tests\u002Ftest_serializers.py\nimport pytest\nfrom rest_framework.exceptions import ValidationError\nfrom apps.products.serializers import ProductSerializer\nfrom tests.factories import ProductFactory\n\nclass TestProductSerializer:\n    \"\"\"ProductSerializerをテスト。\"\"\"\n\n    def test_serialize_product(self, db):\n        \"\"\"製品のシリアライズをテスト。\"\"\"\n        product = ProductFactory()\n        serializer = ProductSerializer(product)\n\n        data = serializer.data\n\n        assert data['id'] == product.id\n        assert data['name'] == product.name\n        assert data['price'] == str(product.price)\n\n    def test_deserialize_product(self, db):\n        \"\"\"製品データのデシリアライズをテスト。\"\"\"\n        data = {\n            'name': 'Test Product',\n            'description': 'Test description',\n            'price': '99.99',\n            'stock': 10,\n            'category': 1,\n        }\n\n        serializer = ProductSerializer(data=data)\n\n        assert serializer.is_valid()\n        product = serializer.save()\n\n        assert product.name == 'Test Product'\n        assert float(product.price) == 99.99\n\n    def test_price_validation(self, db):\n        \"\"\"価格検証をテスト。\"\"\"\n        data = {\n            'name': 'Test Product',\n            'price': '-10.00',\n            'stock': 10,\n        }\n\n        serializer = ProductSerializer(data=data)\n\n        assert not serializer.is_valid()\n        assert 'price' in serializer.errors\n\n    def test_stock_validation(self, db):\n        \"\"\"在庫が負にならないことをテスト。\"\"\"\n        data = {\n            'name': 'Test Product',\n            'price': '99.99',\n            'stock': -5,\n        }\n\n        serializer = ProductSerializer(data=data)\n\n        assert not serializer.is_valid()\n        assert 'stock' in serializer.errors\n```\n\n### API ViewSetテスト\n\n```python\n# tests\u002Ftest_api.py\nimport pytest\nfrom rest_framework.test import APIClient\nfrom rest_framework import status\nfrom django.urls import reverse\nfrom tests.factories import ProductFactory, UserFactory\n\nclass TestProductAPI:\n    \"\"\"Product APIエンドポイントをテスト。\"\"\"\n\n    @pytest.fixture\n    def api_client(self):\n        \"\"\"APIクライアントを返す。\"\"\"\n        return APIClient()\n\n    def test_list_products(self, api_client, db):\n        \"\"\"製品リストをテスト。\"\"\"\n        ProductFactory.create_batch(10)\n\n        url = reverse('api:product-list')\n        response = api_client.get(url)\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['count'] == 10\n\n    def test_retrieve_product(self, api_client, db):\n        \"\"\"製品取得をテスト。\"\"\"\n        product = ProductFactory()\n\n        url = reverse('api:product-detail', kwargs={'pk': product.id})\n        response = api_client.get(url)\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['id'] == product.id\n\n    def test_create_product_unauthorized(self, api_client, db):\n        \"\"\"認証なしの製品作成をテスト。\"\"\"\n        url = reverse('api:product-list')\n        data = {'name': 'Test Product', 'price': '99.99'}\n\n        response = api_client.post(url, data)\n\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_create_product_authorized(self, authenticated_api_client, db):\n        \"\"\"認証済みユーザーとしての製品作成をテスト。\"\"\"\n        url = reverse('api:product-list')\n        data = {\n            'name': 'Test Product',\n            'description': 'Test',\n            'price': '99.99',\n            'stock': 10,\n        }\n\n        response = authenticated_api_client.post(url, data)\n\n        assert response.status_code == status.HTTP_201_CREATED\n        assert response.data['name'] == 'Test Product'\n\n    def test_update_product(self, authenticated_api_client, db):\n        \"\"\"製品更新をテスト。\"\"\"\n        product = ProductFactory(created_by=authenticated_api_client.user)\n\n        url = reverse('api:product-detail', kwargs={'pk': product.id})\n        data = {'name': 'Updated Product'}\n\n        response = authenticated_api_client.patch(url, data)\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['name'] == 'Updated Product'\n\n    def test_delete_product(self, authenticated_api_client, db):\n        \"\"\"製品削除をテスト。\"\"\"\n        product = ProductFactory(created_by=authenticated_api_client.user)\n\n        url = reverse('api:product-detail', kwargs={'pk': product.id})\n        response = authenticated_api_client.delete(url)\n\n        assert response.status_code == status.HTTP_204_NO_CONTENT\n\n    def test_filter_products_by_price(self, api_client, db):\n        \"\"\"価格による製品フィルタリングをテスト。\"\"\"\n        ProductFactory(price=50)\n        ProductFactory(price=150)\n\n        url = reverse('api:product-list')\n        response = api_client.get(url, {'price_min': 100})\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['count'] == 1\n\n    def test_search_products(self, api_client, db):\n        \"\"\"製品検索をテスト。\"\"\"\n        ProductFactory(name='Apple iPhone')\n        ProductFactory(name='Samsung Galaxy')\n\n        url = reverse('api:product-list')\n        response = api_client.get(url, {'search': 'Apple'})\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['count'] == 1\n```\n\n## モッキングとパッチング\n\n### 外部サービスのモック\n\n```python\n# tests\u002Ftest_views.py\nfrom unittest.mock import patch, Mock\nimport pytest\n\nclass TestPaymentView:\n    \"\"\"モックされた決済ゲートウェイで決済ビューをテスト。\"\"\"\n\n    @patch('apps.payments.services.stripe')\n    def test_successful_payment(self, mock_stripe, client, user, product):\n        \"\"\"モックされたStripeで成功した決済をテスト。\"\"\"\n        # モックを設定\n        mock_stripe.Charge.create.return_value = {\n            'id': 'ch_123',\n            'status': 'succeeded',\n            'amount': 9999,\n        }\n\n        client.force_login(user)\n        response = client.post(reverse('payments:process'), {\n            'product_id': product.id,\n            'token': 'tok_visa',\n        })\n\n        assert response.status_code == 302\n        mock_stripe.Charge.create.assert_called_once()\n\n    @patch('apps.payments.services.stripe')\n    def test_failed_payment(self, mock_stripe, client, user, product):\n        \"\"\"失敗した決済をテスト。\"\"\"\n        mock_stripe.Charge.create.side_effect = Exception('Card declined')\n\n        client.force_login(user)\n        response = client.post(reverse('payments:process'), {\n            'product_id': product.id,\n            'token': 'tok_visa',\n        })\n\n        assert response.status_code == 302\n        assert 'error' in response.url\n```\n\n### メール送信のモック\n\n```python\n# tests\u002Ftest_email.py\nfrom django.core import mail\nfrom django.test import override_settings\n\n@override_settings(EMAIL_BACKEND='django.core.mail.backends.locmem.EmailBackend')\ndef test_order_confirmation_email(db, order):\n    \"\"\"注文確認メールをテスト。\"\"\"\n    order.send_confirmation_email()\n\n    assert len(mail.outbox) == 1\n    assert order.user.email in mail.outbox[0].to\n    assert 'Order Confirmation' in mail.outbox[0].subject\n```\n\n## 統合テスト\n\n### 完全フローテスト\n\n```python\n# tests\u002Ftest_integration.py\nimport pytest\nfrom django.urls import reverse\nfrom tests.factories import UserFactory, ProductFactory\n\nclass TestCheckoutFlow:\n    \"\"\"完全なチェックアウトフローをテスト。\"\"\"\n\n    def test_guest_to_purchase_flow(self, client, db):\n        \"\"\"ゲストから購入までの完全なフローをテスト。\"\"\"\n        # ステップ1: 登録\n        response = client.post(reverse('users:register'), {\n            'email': 'test@example.com',\n            'password': 'testpass123',\n            'password_confirm': 'testpass123',\n        })\n        assert response.status_code == 302\n\n        # ステップ2: ログイン\n        response = client.post(reverse('users:login'), {\n            'email': 'test@example.com',\n            'password': 'testpass123',\n        })\n        assert response.status_code == 302\n\n        # ステップ3: 製品を閲覧\n        product = ProductFactory(price=100)\n        response = client.get(reverse('products:detail', kwargs={'slug': product.slug}))\n        assert response.status_code == 200\n\n        # ステップ4: カートに追加\n        response = client.post(reverse('cart:add'), {\n            'product_id': product.id,\n            'quantity': 1,\n        })\n        assert response.status_code == 302\n\n        # ステップ5: チェックアウト\n        response = client.get(reverse('checkout:review'))\n        assert response.status_code == 200\n        assert product.name in response.content.decode()\n\n        # ステップ6: 購入を完了\n        with patch('apps.checkout.services.process_payment') as mock_payment:\n            mock_payment.return_value = True\n            response = client.post(reverse('checkout:complete'))\n\n        assert response.status_code == 302\n        assert Order.objects.filter(user__email='test@example.com').exists()\n```\n\n## テストのベストプラクティス\n\n### すべきこと\n\n- **ファクトリーを使用**: 手動オブジェクト作成の代わりに\n- **テストごとに1つのアサーション**: テストを焦点を絞る\n- **説明的なテスト名**: `test_user_cannot_delete_others_post`\n- **エッジケースをテスト**: 空の入力、None値、境界条件\n- **外部サービスをモック**: 外部APIに依存しない\n- **フィクスチャを使用**: 重複を排除\n- **パーミッションをテスト**: 認可が機能することを確認\n- **テストを高速に保つ**: `--reuse-db`と`--nomigrations`を使用\n\n### すべきでないこと\n\n- **Django内部をテストしない**: Djangoが機能することを信頼\n- **サードパーティコードをテストしない**: ライブラリが機能することを信頼\n- **失敗するテストを無視しない**: すべてのテストが通る必要がある\n- **テストを依存させない**: テストは任意の順序で実行できるべき\n- **過度にモックしない**: 外部依存関係のみをモック\n- **プライベートメソッドをテストしない**: パブリックインターフェースをテスト\n- **本番データベースを使用しない**: 常にテストデータベースを使用\n\n## カバレッジ\n\n### カバレッジ設定\n\n```bash\n# カバレッジでテストを実行\npytest --cov=apps --cov-report=html --cov-report=term-missing\n\n# HTMLレポートを生成\nopen htmlcov\u002Findex.html\n```\n\n### カバレッジ目標\n\n| コンポーネント | 目標カバレッジ |\n|-----------|-----------------|\n| モデル | 90%+ |\n| シリアライザー | 85%+ |\n| ビュー | 80%+ |\n| サービス | 90%+ |\n| ユーティリティ | 80%+ |\n| 全体 | 80%+ |\n\n## クイックリファレンス\n\n| パターン | 使用法 |\n|---------|-------|\n| `@pytest.mark.django_db` | データベースアクセスを有効化 |\n| `client` | Djangoテストクライアント |\n| `api_client` | DRF APIクライアント |\n| `factory.create_batch(n)` | 複数のオブジェクトを作成 |\n| `patch('module.function')` | 外部依存関係をモック |\n| `override_settings` | 設定を一時的に変更 |\n| `force_authenticate()` | テストで認証をバイパス |\n| `assertRedirects` | リダイレクトをチェック |\n| `assertTemplateUsed` | テンプレート使用を検証 |\n| `mail.outbox` | 送信されたメールをチェック |\n\n**覚えておいてください**: テストはドキュメントです。良いテストはコードがどのように動作すべきかを説明します。シンプルで、読みやすく、保守可能に保ってください。\n",{"name":5,"description":7},"main","a2e3284ed4488780397ee2f78217366e11470dfb","skills\u002Fdjango-tdd","https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack\u002Fplaywright","https:\u002F\u002Fplaywright.dev","https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack","2026-04-25 06:04:45",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add 7dvq6yrkgs-stack\u002Fplaywright --skill django-tdd",{"tool":52,"command":53},"bunx","bunx skills add 7dvq6yrkgs-stack\u002Fplaywright --skill django-tdd",{"tool":55,"command":56},"pnpm","pnpm dlx skills add 7dvq6yrkgs-stack\u002Fplaywright --skill django-tdd","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack\u002Fplaywright\u002Fblob\u002Fmain\u002Fskills\u002Fdjango-tdd\u002FSKILL.md",true,[60,66,70],{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},".skillfish.json","REFERENCE","参考文档",238,"https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack\u002Fplaywright\u002Fblob\u002Fmain\u002Fskills\u002Fdjango-tdd\u002F.skillfish.json",{"path":67,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":68,"sourceHtmlUrl":69},"evals.json",4862,"https:\u002F\u002Fgithub.com\u002Fvbonnet\u002Fdear-agent\u002Fblob\u002Fmain\u002Fresearch-pipeline\u002Fskills\u002Fresearch-pipeline\u002Fevals.json",{"path":71,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":72,"sourceHtmlUrl":73},"SPEC.md",533,"https:\u002F\u002Fgithub.com\u002Fvbonnet\u002Fdear-agent\u002Fblob\u002Fmain\u002Fresearch-pipeline\u002Fskills\u002Fresearch-pipeline\u002FSPEC.md",[75,105,115,125,140,155],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":93,"publishedAt":34},"01M6E3XK4PRPMQHM7Y98FQPTY1","zyte-api-automation","Automate Zyte API tasks via Rube MCP (Composio). Always search tools first for current schemas.","https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack\u002Fplaywright\u002Fblob\u002Fmain\u002Fskills\u002Fzyte-api-automation\u002FSKILL.md",[81,82,85,88],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":83,"categoryName":84,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":86,"categoryName":87,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":89,"categoryName":90,"taxonomyType":91,"taxonomyTypeDesc":92},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[94,95,96,97,98,99,100,101,102,103,104],"zyte api automation","api","automation","MCP","tasks","search","Tools","first","automate","composio","via",{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":113,"publishedAt":34},"01M6E3XFX6QSTR1QR59NFXJTMA","zylvie-automation","Automate Zylvie tasks via Rube MCP (Composio). Always search tools first for current schemas.","https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack\u002Fplaywright\u002Fblob\u002Fmain\u002Fskills\u002Fzylvie-automation\u002FSKILL.md",[111,112],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":86,"categoryName":87,"taxonomyType":20,"taxonomyTypeDesc":21},[114,96,102,97,98,99,100,101,103,104],"zylvie automation",{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":123,"publishedAt":34},"01M6E3XCX2GDYYCHN58ZJHT37M","zoominfo-automation","Automate Zoominfo tasks via Rube MCP (Composio). Always search tools first for current schemas.","https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack\u002Fplaywright\u002Fblob\u002Fmain\u002Fskills\u002Fzoominfo-automation\u002FSKILL.md",[121,122],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":86,"categoryName":87,"taxonomyType":20,"taxonomyTypeDesc":21},[124,96,99,100,101,102,103,104,98,97],"zoominfo automation",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":133,"publishedAt":34},"01M6E3X9WJ2T73216WQHHTB9BD","zoho_mail-automation","Automate Zoho Mail tasks via Rube MCP (Composio): email sending, folders, labels, and mailbox management. Always search tools first for current schemas.","https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack\u002Fplaywright\u002Fblob\u002Fmain\u002Fskills\u002Fzoho_mail-automation\u002FSKILL.md",[131,132],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":86,"categoryName":87,"taxonomyType":20,"taxonomyTypeDesc":21},[134,135,136,96,97,98,99,137,100,101,102,138,103,139,104],"mail","zoho mail automation","zoho","email","management","mailbox",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":151,"publishedAt":34},"01M6E3X719W648XZBW1EC6JQ64","zoho_invoice-automation","Automate Zoho Invoice tasks via Rube MCP (Composio): invoices, estimates, expenses, clients, and payment tracking. Always search tools first for current schemas.","https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack\u002Fplaywright\u002Fblob\u002Fmain\u002Fskills\u002Fzoho_invoice-automation\u002FSKILL.md",[146,147,148],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":86,"categoryName":87,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":149,"categoryName":150,"taxonomyType":91,"taxonomyTypeDesc":92},"01JBSEEDCAT000000000000040","财务",[152,136,96,98,99,100,101,102,153,154,103,104,97],"zoho invoice automation","tracking","payment",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":163,"publishedAt":34},"01M6E3X28JYTC3QTK32AQF7BYB","zoho_inventory-automation","Automate Zoho Inventory tasks via Rube MCP (Composio): items, orders, warehouses, shipments, and stock management. Always search tools first for current schemas.","https:\u002F\u002Fgithub.com\u002F7dvq6yrkgs-stack\u002Fplaywright\u002Fblob\u002Fmain\u002Fskills\u002Fzoho_inventory-automation\u002FSKILL.md",[161,162],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":86,"categoryName":87,"taxonomyType":20,"taxonomyTypeDesc":21},[96,164,136,165,101,102,100,99,98,97,103,104,166,167,138],"inventory","zoho inventory automation","stock","orders"]