[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C1TXVJXMQ0VWWGMHD7PKG9":3,"skill-same:01M6C1TXVJXMQ0VWWGMHD7PKG9":116},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":15,"repositoryHtmlUrl":51,"repositoryHomepageUrl":17,"ownerHtmlUrl":52,"ownerBlogUrl":17,"ownerDescription":17,"updatedAt":53,"install":54,"resources":67},"01M6C1TXVJXMQ0VWWGMHD7PKG9","write-pytest","pytest 测试编写","Write pytest tests for any Python codebase. Use when the user asks to write tests, create tests, add tests, or test a module\u002Fservice\u002Fendpoint\u002Ffunction. Framework-agnostic; routes to framework-specific helpers when signals are detected. Follows a research-then-discuss-then-write flow.","为任何 Python 代码库编写 pytest 测试。当用户要求编写测试、创建测试、添加测试，或测试某个模块\u002F服务\u002F端点\u002F函数时使用。与框架无关；当检测到相关信号时会路由到框架专用的辅助工具。遵循“先研究—再讨论—后编写”的流程。","cartaorobbin\u002Fpyramid-temporal","cartaorobbin","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F133803757?v=4","01M6C1SVA1FFVXFG0QTK8ZRNDV","robbin Pagamentos","01M6C1SVEDYW8ZDTP82V7DF2BQ",0,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fwrite-pytest\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42],"write","write pytest","python","research","test","write tests","create","framework","flow","endpoint","user","use","2026-11-10 10:12:30",false,"---\nname: write-pytest\ndescription: Write pytest tests for any Python codebase. Use when the user asks to write tests, create tests, add tests, or test a module\u002Fservice\u002Fendpoint\u002Ffunction. Framework-agnostic; routes to framework-specific helpers when signals are detected. Follows a research-then-discuss-then-write flow.\n---\n\n> **MANAGED SKILL** — Do not edit this file here. It is managed from an external source repository.\n> To make changes, update the source and run \"update my skills\" to sync.\n\n\n# Write Pytest Tests\n\nWrite pytest tests for any Python project following a conversational, phased approach. Always research first, discuss with the user, then write. Defer framework-specific patterns (Pyramid test infrastructure, web client wiring) to the matching helper skill — this skill stays framework-agnostic.\n\n---\n\n## Core Workflow\n\n1. Research the project (read-only): source under test, dependencies, framework signals, existing test infra.\n2. Discuss the proposed test cases, factories, fixtures with the user — one question at a time.\n3. Write the tests following the constraints below.\n4. Verify by running pytest; fix failures and re-run until green.\n\n---\n\n## Constraints\n\n### MUST DO\n\n- Read the source under test before proposing any test case.\n- Detect the framework in Phase 1 (Pyramid, Flask, Django, plain library) and route to the right helper for framework specifics.\n- Detect security signals (auth headers, decorators, middleware, ACLs) in Phase 1. If any are present, security tests are mandatory — never ask whether to include them.\n- Use plain pytest functions, descriptive names, and a brief docstring per test.\n- Place all imports at module top.\n- Extract reusable setup into `@pytest.fixture` in the nearest `conftest.py`.\n- Use `@pytest.mark.parametrize` (with `ids=`) when tests share logic but differ in input\u002Foutput.\n- Prefer real code paths and `responses` for HTTP. Reach for `unittest.mock.patch` only when the dependency cannot be exercised any other way.\n- Keep test files under ~200 lines. Split by concern when they grow (`_api`, `_service`, `_integration`, `_security`).\n\n### MUST NOT DO\n\n- Never use FastAPI or pydantic in examples or generated code.\n- Never use class-based pytest tests (e.g., `class TestFoo: def test_method(self): ...`). The single exception is `hypothesis.stateful.RuleBasedStateMachine` — it is hypothesis's stateful API, exposed to pytest via its `TestCase` attribute, not a pytest test class. See [invariants.md](invariants.md).\n- Never write conditional logic inside test functions (`if`, `else`, `for`, `while`, `try`, ternary).\n- Never put imports inside functions or methods.\n- Never create standalone helper functions for setup — use fixtures.\n- Never mock when `responses` or a real integration would work.\n- Never skip security tests when the endpoint under test is protected.\n- Never edit test files inside `~\u002F.cursor\u002Fskills\u002F` or `~\u002F.claude\u002Fskills\u002F` — those are installed copies.\n\n---\n\n## Reference Guide\n\nLoad these supplementary files only when the listed signals appear. Inline content in this SKILL covers the common case.\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Property invariants and stateful state machines (`hypothesis`) | [invariants.md](invariants.md) | Code under test contains validators, pure transformations, numeric calculations, parsers, or stateful systems whose correctness is best expressed as invariants |\n| Pyramid test infrastructure (`testapp`, `dbsession`, `tm`, factory wiring, plugins, xdist) | [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md) | Project shows Pyramid signals: `pyramid_tm`, Cornice `Service()`, `__acl__`, `pyramid.scripting.prepare`, `webtest.TestApp`, `testing.postgresql` |\n\n---\n\n## Setup Question (Asked at Install Time)\n\nDuring installation, use **AskQuestion**:\n\n```yaml\ntitle: \"Companion Rule\"\nquestions:\n  - id: install_rule\n    prompt: \"Do you want to install a Cursor rule that enforces pytest patterns whenever test files are created or modified?\"\n    options:\n      - id: \"yes\"\n        label: \"Yes, install the test-patterns rule\"\n      - id: \"no\"\n        label: \"No, just the skill\"\n```\n\nIf yes, copy `templates\u002Ftest-patterns-rule.mdc` to `.cursor\u002Frules\u002Ftest-patterns.mdc` in the target project.\n\n---\n\n## Phase 1: Research the Project (Read-Only)\n\nGather context before proposing anything. Do NOT write code yet.\n\n### 1.1 Read the source code\n\nRead the file(s) the user wants tested. Identify the type of code:\n\n- **Web endpoint \u002F view** — Cornice `Service`, Flask route, Django view, or any HTTP-handling callable\n- **Service \u002F business logic** — domain classes or functions\n- **Model** — ORM model definitions (SQLAlchemy, Django ORM, etc.)\n- **Async task** — Celery task, RQ job, asyncio coroutine\n- **Pure utility** — validators, parsers, calculators, transformers\n- **Stateful component** — caches, queues, state machines, in-memory stores\n\n### 1.2 Detect the framework\n\nLook for these signals to choose the right test approach (and the right reference file):\n\n| Signal | Framework |\n|--------|-----------|\n| `pyramid_tm`, Cornice `Service()`, `pyramid.scripting.prepare`, `webtest.TestApp`, `__acl__` in context factories | Pyramid — load [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md) |\n| `flask.Flask`, `app.test_client()`, `flask.Blueprint` | Flask |\n| `django.urls`, `django.test.TestCase`, `pytest-django`, settings module | Django |\n| None of the above | Plain Python library — generic patterns only |\n\nThere are no dedicated test-infrastructure helpers in this repo for Flask or Django yet. When the framework is Flask, Django, or another web framework not listed above, apply the generic patterns in this skill and adapt the test-client API to the framework's conventions:\n\n- **Flask** — `flask.testing.FlaskClient`: use `client.get(url, headers=...)` \u002F `client.post(url, json=payload)`. Status codes are read from `response.status_code`. No `expect_errors` flag needed.\n- **Django** — `django.test.Client`: use `client.get(url, **headers)` \u002F `client.post(url, data=payload, content_type=\"application\u002Fjson\")`. Status codes come from `response.status_code`.\n- **Plain library** — no HTTP client; security tests are skipped (no auth surface). Focus on correctness, edge cases, and invariants.\n\n### 1.3 Map dependencies\n\nFor each source file, identify:\n\n- External HTTP services (`requests.get\u002Fpost`, `httpx`, raw `urllib`)\n- gRPC clients (client\u002Fstub imports and calls)\n- Database access (ORM queries, raw SQL, sessions)\n- Internal services or modules the code calls\n\n### 1.4 Detect security requirements\n\nLook for any of these signals — if found, security tests are **mandatory**:\n\n- Authentication decorators or middleware\n- Permission\u002Fauthorization checks (`permission=`, `@login_required`, ACL `__acl__`, role checks)\n- JWT, session cookies, API keys, or auth header parsing\n- Context factories with `factory=` (Pyramid)\n\n### 1.5 Check existing test infrastructure\n\nRead these files if they exist:\n\n- Root `tests\u002Fconftest.py` and any subdirectory `conftest.py` — available fixtures\n- `tests\u002Ffactories.py` or `tests\u002Ffactories\u002F` — existing factory-boy factories\n- Existing test files for similar modules — naming and style conventions\n- The size of any existing test file you would append to (relevant for the ~200-line cap)\n\n### 1.6 Detect reuse opportunities\n\n- Repeated setup logic that should become a fixture\n- Validation \u002F pure-function code that should be tested with property invariants — load [invariants.md](invariants.md)\n- Stateful components (caches, queues, in-memory stores) that should be tested with `RuleBasedStateMachine` — load [invariants.md](invariants.md)\n\n### 1.7 Build draft test case list\n\nGroup proposed cases by category:\n\n- **Happy path** — success scenarios\n- **Validation errors** — missing\u002Finvalid fields, bad input\n- **Security** (if any auth signal was found) — mandatory, see [Phase 3 — Security Tests](#mandatory-security-tests)\n- **Edge cases** — boundary conditions, empty data, large payloads\n- **Integration** — external service calls, response handling\n- **Property invariants** — see [invariants.md](invariants.md)\n- **Stateful invariants** — see [invariants.md](invariants.md)\n\n---\n\n## Phase 2: Discuss with the User\n\nUse `AskQuestion` one question at a time. Never skip this phase.\n\n### Q1 — Review proposed test cases\n\nPresent the draft test case list from Phase 1, grouped by category:\n\n```yaml\ntitle: \"Proposed Test Cases\"\nquestions:\n  - id: test_cases\n    prompt: \"\u003Cpresent the grouped list here with brief descriptions>\"\n    options:\n      - id: accept\n        label: \"Looks good, proceed\"\n      - id: revise\n        label: \"I want to adjust the list\"\n```\n\nIf `revise`, collect the user's changes before continuing.\n\n### Q2 — Confirm factory needs (if applicable)\n\nIf new factory-boy factories or updates to existing ones are needed:\n\n```yaml\ntitle: \"Factory-Boy Factories\"\nquestions:\n  - id: factories\n    prompt: \"\u003Clist new\u002Fupdated factories needed>\"\n    options:\n      - id: accept\n        label: \"Create\u002Fupdate these factories\"\n      - id: revise\n        label: \"I want to adjust\"\n```\n\nSkip if no new factories are needed.\n\n### Q3 — Confirm fixture needs (if applicable)\n\nIf new `conftest.py` fixtures are needed or existing setup should be extracted:\n\n```yaml\ntitle: \"Pytest Fixtures\"\nquestions:\n  - id: fixtures\n    prompt: \"\u003Clist new fixtures or extractions proposed>\"\n    options:\n      - id: accept\n        label: \"Create\u002Fupdate these fixtures\"\n      - id: revise\n        label: \"I want to adjust\"\n```\n\nSkip if no new fixtures are needed.\n\n---\n\n## Phase 3: Write the Tests\n\nGenerate code following all of these rules. Constraints from the top of this file always apply.\n\n### Structure\n\n- Test file mirrors source structure under `tests\u002F`.\n- One test file per module: `test_\u003Cmodule_name>.py`.\n- Descriptive function names: `test_\u003Caction>_\u003Cscenario>` or `test_\u003Cwhat>_\u003Cexpected_outcome>`.\n- Brief docstring on each test stating what is being tested.\n- Keep files under ~200 lines; split by concern when growing (`_api`, `_service`, `_integration`, `_security`).\n\n### Testing priority (strictly enforced)\n\n1. Real integrations and real code paths — always prefer exercising actual code.\n2. `responses` for external HTTP calls (`@responses.activate`).\n3. `factory-boy` for test data generation.\n4. Pytest fixtures for reusable setup.\n5. `unittest.mock.patch` only as last resort (e.g., gRPC clients, hardware drivers).\n\n### Mandatory security tests\n\nIf Phase 1 detected ANY security signal, include ALL of the following — they are non-negotiable. The examples below use a generic `client` fixture; adapt the call shape (`get` \u002F `post(json=...)`, error handling, header helpers) to the project's test client. For Pyramid specifics — `webtest.TestApp` semantics, `expect_errors=True`, `auth_headers`, `dbsession` wiring — see [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md).\n\n- **Wrong\u002Finvalid token** — request with malformed or expired token, expect 401 or 403.\n- **Wrong permission scope** — request with valid token but insufficient\u002Fwrong permissions, expect 403.\n- **Missing authentication** — request with no auth headers at all, expect 401 or 403.\n- **Wrong credentials** — when the endpoint accepts credentials (e.g., login), test with wrong password\u002Fusername, expect 401.\n\nThe exact status code (401 vs 403) depends on the framework's auth chain; the asserts below use tuple membership (`in (401, 403)`) for the cases where either is acceptable. Tuple membership is not conditional logic — it is a single boolean expression — so it remains compliant with the no-conditional-logic rule.\n\n```python\ndef test_endpoint_rejects_invalid_token(client, dbsession):\n    \"\"\"Verify endpoint rejects requests with an invalid token.\"\"\"\n    resource = ResourceFactory()\n\n    headers = {\"Authorization\": \"Bearer invalid-token-here\"}\n    response = client.get(\n        f\"\u002Fapi\u002Fv1\u002Fresource\u002F{resource.uuid}\",\n        headers=headers,\n    )\n\n    assert response.status_code in (401, 403)\n\n\ndef test_endpoint_rejects_wrong_permission(client, dbsession, auth_headers):\n    \"\"\"Verify endpoint rejects requests with insufficient permissions.\"\"\"\n    resource = ResourceFactory()\n\n    headers = auth_headers([\"wrong::permission::scope\"])\n    response = client.get(\n        f\"\u002Fapi\u002Fv1\u002Fresource\u002F{resource.uuid}\",\n        headers=headers,\n    )\n\n    assert response.status_code == 403\n\n\ndef test_endpoint_rejects_missing_auth(client, dbsession):\n    \"\"\"Verify endpoint rejects unauthenticated requests.\"\"\"\n    resource = ResourceFactory()\n\n    response = client.get(f\"\u002Fapi\u002Fv1\u002Fresource\u002F{resource.uuid}\")\n\n    assert response.status_code in (401, 403)\n```\n\n### `pytest.mark.parametrize` to avoid duplication\n\nWhen multiple tests share the same logic but differ only in input\u002Fexpected output:\n\n```python\n@pytest.mark.parametrize(\n    \"payload,missing_field\",\n    [\n        ({\"name\": \"John Doe\", \"email\": \"john@example.com\"}, \"tax_id\"),\n        ({\"tax_id\": \"12345678901\", \"email\": \"john@example.com\"}, \"name\"),\n        ({\"tax_id\": \"12345678901\", \"name\": \"John Doe\"}, \"email\"),\n    ],\n    ids=[\"missing_tax_id\", \"missing_name\", \"missing_email\"],\n)\ndef test_create_person_rejects_missing_field(client, payload, missing_field):\n    \"\"\"Verify endpoint rejects payload missing a required field.\"\"\"\n    response = client.post(\"\u002Fapi\u002Fv1\u002Fperson\", json=payload)\n\n    assert response.status_code == 400\n```\n\nDo NOT use parametrize when the test logic itself differs between cases.\n\n### Property and stateful invariants with `hypothesis`\n\nWhen the code under test is a validator, parser, numeric calculation, data transformation, or a stateful component, propose hypothesis-based tests. The full guidance — strategies, properties to look for, and `RuleBasedStateMachine` patterns — lives in [invariants.md](invariants.md). Read it during Phase 1 if any of those signals appear.\n\nQuick reach for property invariants:\n\n```python\nfrom hypothesis import given, strategies as st\n\n\n@given(value=st.floats(allow_nan=False, allow_infinity=False))\ndef test_score_normalization_stays_in_range(value):\n    \"\"\"Verify score normalization always produces a value in [0, 1].\"\"\"\n    result = normalize_score(value)\n\n    assert 0.0 \u003C= result \u003C= 1.0\n```\n\nFor stateful systems (caches, queues, in-memory stores) load [invariants.md](invariants.md) and follow the `RuleBasedStateMachine` recipe.\n\n### Reusable setup must be pytest fixtures\n\n- Extract repeated setup into `@pytest.fixture` in `conftest.py`.\n- Place fixtures in the nearest `conftest.py` (directory-level for local, root for project-wide).\n- Fixtures can compose other fixtures and factories.\n\n```python\n@pytest.fixture\ndef verified_person(dbsession):\n    \"\"\"A person that has passed KYC verification.\"\"\"\n    person = PersonFactory(status=\"verified\")\n    dbsession.flush()\n    return person\n```\n\n### Factory-boy patterns\n\nPick the base class that fits the project:\n\n- `factory.Factory` — generic, no ORM\n- `factory.alchemy.SQLAlchemyModelFactory` — SQLAlchemy projects (Pyramid, Flask-SQLAlchemy, plain SQLAlchemy)\n- `factory.django.DjangoModelFactory` — Django projects\n\n```python\nclass CompanyFactory(factory.alchemy.SQLAlchemyModelFactory):\n    class Meta:\n        model = Company\n        sqlalchemy_session_persistence = \"flush\"\n\n    registration_number = factory.LazyFunction(\n        lambda: f\"{random.randint(10000000000000, 99999999999999)}\"\n    )\n    name = factory.Faker(\"company\")\n    revenue = factory.Faker(\"random_int\", min=100000, max=10000000)\n    created_at = factory.Faker(\"date_time\")\n```\n\n- Use `factory.Faker` for realistic data.\n- Use `factory.SubFactory` for relationships.\n- Use `factory.LazyFunction` for computed fields.\n\nFor Pyramid + SQLAlchemy session\u002Ftransaction wiring, see [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md).\n\n### Integration test patterns\n\nExternal HTTP — use `responses`:\n\n```python\n@responses.activate\ndef test_kyc_service_validates_person():\n    \"\"\"Verify KYC service handles person validation response.\"\"\"\n    responses.add(\n        responses.POST,\n        \"https:\u002F\u002Fapi.kyc-provider.com\u002Fv1\u002Fvalidate\",\n        json={\"valid\": True, \"status\": \"verified\", \"confidence\": 0.95},\n        status=200,\n    )\n\n    service = KYCService()\n    result = service.validate_person(person_data)\n\n    assert result[\"valid\"] is True\n    assert result[\"status\"] == \"verified\"\n```\n\ngRPC clients — use `patch` as last resort:\n\n```python\ndef test_legal_entity_grpc_integration():\n    \"\"\"Verify legal entity gRPC client handles validation response.\"\"\"\n    with patch(\"module.clients.legal_entity.LegalEntityClient\") as mock_client:\n        mock_client.return_value.validate_company.return_value = {\n            \"valid\": True,\n            \"company_status\": \"active\",\n        }\n\n        service = LegalEntityService()\n        result = service.validate_company(\"12345678000190\")\n\n        assert result[\"valid\"] is True\n```\n\n---\n\n## Phase 4: Verify\n\n1. Run `pytest \u003Ctest_file> -v` to confirm all tests pass.\n2. If hypothesis tests were added, run once with `--hypothesis-show-statistics` to confirm strategies generate meaningful examples.\n3. Report results to the user: which tests passed, which failed, any issues.\n4. If tests fail, fix and re-run until green.\n\n---\n\n## Error Recovery\n\n**`pytest` collects no tests:**\n- Confirm the file matches the discovery pattern (`test_*.py`) and lives under a path covered by `testpaths` in `pyproject.toml` \u002F `pytest.ini`.\n- Confirm test functions start with `test_`.\n- If using parametrize, confirm `ids=` does not collide with another test's id.\n\n**Fixture not found:**\n- Confirm the fixture is declared in a `conftest.py` at or above the test file.\n- A subdirectory `conftest.py` does not expose fixtures to siblings — move it up if shared.\n- For framework-specific fixtures (`testapp`, `dbsession`, `tm`), follow [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md).\n\n**Hypothesis flaky \u002F `Flaky` exception:**\n- A reproducible counter-example was lost between runs. Pin it with `@example(...)` so it is always tried.\n- If the failure depends on time or random state outside hypothesis, narrow the strategy or move that input to a fixture.\n\n**Hypothesis `HealthCheck` failure (filtering \u002F data generation too slow):**\n- Replace `assume(...)` filters with a more constrained strategy (`st.integers(min_value=..., max_value=...)`, `st.from_regex`).\n- For a single legitimate case, suppress with `@settings(suppress_health_check=[HealthCheck.filter_too_much])` and document why.\n\n**Hypothesis `DeadlineExceeded`:**\n- Increase `@settings(deadline=...)` only when the slowness is intrinsic (e.g., DB-backed test). For pure logic, fix the slow path instead of widening the deadline.\n\n**Factory writes not visible to the code under test:**\n- Confirm `sqlalchemy_session_persistence = \"flush\"` (not `\"commit\"`).\n- For Pyramid: confirm `extra_environ` wires `tm.manager` and `app.dbsession` — see [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md).\n\n**Test file exceeds ~200 lines:**\n- Split by concern: `test_\u003Cmodule>_api.py`, `test_\u003Cmodule>_service.py`, `test_\u003Cmodule>_integration.py`, `test_\u003Cmodule>_security.py`.\n- Propose the split to the user before moving tests.\n\n**`responses` raises `ConnectionError` on an unmatched call:**\n- The code is hitting an URL not registered with `responses.add(...)`. Either register the URL or, if the call is incidental, use `responses.add_passthru(...)` for the prefix that should bypass mocking.\n","> **MANAGED SKILL** — Do not edit this file here. It is managed from an external source repository.\n> To make changes, update the source and run \"update my skills\" to sync.\n\n\n# Write Pytest Tests\n\nWrite pytest tests for any Python project following a conversational, phased approach. Always research first, discuss with the user, then write. Defer framework-specific patterns (Pyramid test infrastructure, web client wiring) to the matching helper skill — this skill stays framework-agnostic.\n\n---\n\n## Core Workflow\n\n1. Research the project (read-only): source under test, dependencies, framework signals, existing test infra.\n2. Discuss the proposed test cases, factories, fixtures with the user — one question at a time.\n3. Write the tests following the constraints below.\n4. Verify by running pytest; fix failures and re-run until green.\n\n---\n\n## Constraints\n\n### MUST DO\n\n- Read the source under test before proposing any test case.\n- Detect the framework in Phase 1 (Pyramid, Flask, Django, plain library) and route to the right helper for framework specifics.\n- Detect security signals (auth headers, decorators, middleware, ACLs) in Phase 1. If any are present, security tests are mandatory — never ask whether to include them.\n- Use plain pytest functions, descriptive names, and a brief docstring per test.\n- Place all imports at module top.\n- Extract reusable setup into `@pytest.fixture` in the nearest `conftest.py`.\n- Use `@pytest.mark.parametrize` (with `ids=`) when tests share logic but differ in input\u002Foutput.\n- Prefer real code paths and `responses` for HTTP. Reach for `unittest.mock.patch` only when the dependency cannot be exercised any other way.\n- Keep test files under ~200 lines. Split by concern when they grow (`_api`, `_service`, `_integration`, `_security`).\n\n### MUST NOT DO\n\n- Never use FastAPI or pydantic in examples or generated code.\n- Never use class-based pytest tests (e.g., `class TestFoo: def test_method(self): ...`). The single exception is `hypothesis.stateful.RuleBasedStateMachine` — it is hypothesis's stateful API, exposed to pytest via its `TestCase` attribute, not a pytest test class. See [invariants.md](invariants.md).\n- Never write conditional logic inside test functions (`if`, `else`, `for`, `while`, `try`, ternary).\n- Never put imports inside functions or methods.\n- Never create standalone helper functions for setup — use fixtures.\n- Never mock when `responses` or a real integration would work.\n- Never skip security tests when the endpoint under test is protected.\n- Never edit test files inside `~\u002F.cursor\u002Fskills\u002F` or `~\u002F.claude\u002Fskills\u002F` — those are installed copies.\n\n---\n\n## Reference Guide\n\nLoad these supplementary files only when the listed signals appear. Inline content in this SKILL covers the common case.\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Property invariants and stateful state machines (`hypothesis`) | [invariants.md](invariants.md) | Code under test contains validators, pure transformations, numeric calculations, parsers, or stateful systems whose correctness is best expressed as invariants |\n| Pyramid test infrastructure (`testapp`, `dbsession`, `tm`, factory wiring, plugins, xdist) | [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md) | Project shows Pyramid signals: `pyramid_tm`, Cornice `Service()`, `__acl__`, `pyramid.scripting.prepare`, `webtest.TestApp`, `testing.postgresql` |\n\n---\n\n## Setup Question (Asked at Install Time)\n\nDuring installation, use **AskQuestion**:\n\n```yaml\ntitle: \"Companion Rule\"\nquestions:\n  - id: install_rule\n    prompt: \"Do you want to install a Cursor rule that enforces pytest patterns whenever test files are created or modified?\"\n    options:\n      - id: \"yes\"\n        label: \"Yes, install the test-patterns rule\"\n      - id: \"no\"\n        label: \"No, just the skill\"\n```\n\nIf yes, copy `templates\u002Ftest-patterns-rule.mdc` to `.cursor\u002Frules\u002Ftest-patterns.mdc` in the target project.\n\n---\n\n## Phase 1: Research the Project (Read-Only)\n\nGather context before proposing anything. Do NOT write code yet.\n\n### 1.1 Read the source code\n\nRead the file(s) the user wants tested. Identify the type of code:\n\n- **Web endpoint \u002F view** — Cornice `Service`, Flask route, Django view, or any HTTP-handling callable\n- **Service \u002F business logic** — domain classes or functions\n- **Model** — ORM model definitions (SQLAlchemy, Django ORM, etc.)\n- **Async task** — Celery task, RQ job, asyncio coroutine\n- **Pure utility** — validators, parsers, calculators, transformers\n- **Stateful component** — caches, queues, state machines, in-memory stores\n\n### 1.2 Detect the framework\n\nLook for these signals to choose the right test approach (and the right reference file):\n\n| Signal | Framework |\n|--------|-----------|\n| `pyramid_tm`, Cornice `Service()`, `pyramid.scripting.prepare`, `webtest.TestApp`, `__acl__` in context factories | Pyramid — load [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md) |\n| `flask.Flask`, `app.test_client()`, `flask.Blueprint` | Flask |\n| `django.urls`, `django.test.TestCase`, `pytest-django`, settings module | Django |\n| None of the above | Plain Python library — generic patterns only |\n\nThere are no dedicated test-infrastructure helpers in this repo for Flask or Django yet. When the framework is Flask, Django, or another web framework not listed above, apply the generic patterns in this skill and adapt the test-client API to the framework's conventions:\n\n- **Flask** — `flask.testing.FlaskClient`: use `client.get(url, headers=...)` \u002F `client.post(url, json=payload)`. Status codes are read from `response.status_code`. No `expect_errors` flag needed.\n- **Django** — `django.test.Client`: use `client.get(url, **headers)` \u002F `client.post(url, data=payload, content_type=\"application\u002Fjson\")`. Status codes come from `response.status_code`.\n- **Plain library** — no HTTP client; security tests are skipped (no auth surface). Focus on correctness, edge cases, and invariants.\n\n### 1.3 Map dependencies\n\nFor each source file, identify:\n\n- External HTTP services (`requests.get\u002Fpost`, `httpx`, raw `urllib`)\n- gRPC clients (client\u002Fstub imports and calls)\n- Database access (ORM queries, raw SQL, sessions)\n- Internal services or modules the code calls\n\n### 1.4 Detect security requirements\n\nLook for any of these signals — if found, security tests are **mandatory**:\n\n- Authentication decorators or middleware\n- Permission\u002Fauthorization checks (`permission=`, `@login_required`, ACL `__acl__`, role checks)\n- JWT, session cookies, API keys, or auth header parsing\n- Context factories with `factory=` (Pyramid)\n\n### 1.5 Check existing test infrastructure\n\nRead these files if they exist:\n\n- Root `tests\u002Fconftest.py` and any subdirectory `conftest.py` — available fixtures\n- `tests\u002Ffactories.py` or `tests\u002Ffactories\u002F` — existing factory-boy factories\n- Existing test files for similar modules — naming and style conventions\n- The size of any existing test file you would append to (relevant for the ~200-line cap)\n\n### 1.6 Detect reuse opportunities\n\n- Repeated setup logic that should become a fixture\n- Validation \u002F pure-function code that should be tested with property invariants — load [invariants.md](invariants.md)\n- Stateful components (caches, queues, in-memory stores) that should be tested with `RuleBasedStateMachine` — load [invariants.md](invariants.md)\n\n### 1.7 Build draft test case list\n\nGroup proposed cases by category:\n\n- **Happy path** — success scenarios\n- **Validation errors** — missing\u002Finvalid fields, bad input\n- **Security** (if any auth signal was found) — mandatory, see [Phase 3 — Security Tests](#mandatory-security-tests)\n- **Edge cases** — boundary conditions, empty data, large payloads\n- **Integration** — external service calls, response handling\n- **Property invariants** — see [invariants.md](invariants.md)\n- **Stateful invariants** — see [invariants.md](invariants.md)\n\n---\n\n## Phase 2: Discuss with the User\n\nUse `AskQuestion` one question at a time. Never skip this phase.\n\n### Q1 — Review proposed test cases\n\nPresent the draft test case list from Phase 1, grouped by category:\n\n```yaml\ntitle: \"Proposed Test Cases\"\nquestions:\n  - id: test_cases\n    prompt: \"\u003Cpresent the grouped list here with brief descriptions>\"\n    options:\n      - id: accept\n        label: \"Looks good, proceed\"\n      - id: revise\n        label: \"I want to adjust the list\"\n```\n\nIf `revise`, collect the user's changes before continuing.\n\n### Q2 — Confirm factory needs (if applicable)\n\nIf new factory-boy factories or updates to existing ones are needed:\n\n```yaml\ntitle: \"Factory-Boy Factories\"\nquestions:\n  - id: factories\n    prompt: \"\u003Clist new\u002Fupdated factories needed>\"\n    options:\n      - id: accept\n        label: \"Create\u002Fupdate these factories\"\n      - id: revise\n        label: \"I want to adjust\"\n```\n\nSkip if no new factories are needed.\n\n### Q3 — Confirm fixture needs (if applicable)\n\nIf new `conftest.py` fixtures are needed or existing setup should be extracted:\n\n```yaml\ntitle: \"Pytest Fixtures\"\nquestions:\n  - id: fixtures\n    prompt: \"\u003Clist new fixtures or extractions proposed>\"\n    options:\n      - id: accept\n        label: \"Create\u002Fupdate these fixtures\"\n      - id: revise\n        label: \"I want to adjust\"\n```\n\nSkip if no new fixtures are needed.\n\n---\n\n## Phase 3: Write the Tests\n\nGenerate code following all of these rules. Constraints from the top of this file always apply.\n\n### Structure\n\n- Test file mirrors source structure under `tests\u002F`.\n- One test file per module: `test_\u003Cmodule_name>.py`.\n- Descriptive function names: `test_\u003Caction>_\u003Cscenario>` or `test_\u003Cwhat>_\u003Cexpected_outcome>`.\n- Brief docstring on each test stating what is being tested.\n- Keep files under ~200 lines; split by concern when growing (`_api`, `_service`, `_integration`, `_security`).\n\n### Testing priority (strictly enforced)\n\n1. Real integrations and real code paths — always prefer exercising actual code.\n2. `responses` for external HTTP calls (`@responses.activate`).\n3. `factory-boy` for test data generation.\n4. Pytest fixtures for reusable setup.\n5. `unittest.mock.patch` only as last resort (e.g., gRPC clients, hardware drivers).\n\n### Mandatory security tests\n\nIf Phase 1 detected ANY security signal, include ALL of the following — they are non-negotiable. The examples below use a generic `client` fixture; adapt the call shape (`get` \u002F `post(json=...)`, error handling, header helpers) to the project's test client. For Pyramid specifics — `webtest.TestApp` semantics, `expect_errors=True`, `auth_headers`, `dbsession` wiring — see [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md).\n\n- **Wrong\u002Finvalid token** — request with malformed or expired token, expect 401 or 403.\n- **Wrong permission scope** — request with valid token but insufficient\u002Fwrong permissions, expect 403.\n- **Missing authentication** — request with no auth headers at all, expect 401 or 403.\n- **Wrong credentials** — when the endpoint accepts credentials (e.g., login), test with wrong password\u002Fusername, expect 401.\n\nThe exact status code (401 vs 403) depends on the framework's auth chain; the asserts below use tuple membership (`in (401, 403)`) for the cases where either is acceptable. Tuple membership is not conditional logic — it is a single boolean expression — so it remains compliant with the no-conditional-logic rule.\n\n```python\ndef test_endpoint_rejects_invalid_token(client, dbsession):\n    \"\"\"Verify endpoint rejects requests with an invalid token.\"\"\"\n    resource = ResourceFactory()\n\n    headers = {\"Authorization\": \"Bearer invalid-token-here\"}\n    response = client.get(\n        f\"\u002Fapi\u002Fv1\u002Fresource\u002F{resource.uuid}\",\n        headers=headers,\n    )\n\n    assert response.status_code in (401, 403)\n\n\ndef test_endpoint_rejects_wrong_permission(client, dbsession, auth_headers):\n    \"\"\"Verify endpoint rejects requests with insufficient permissions.\"\"\"\n    resource = ResourceFactory()\n\n    headers = auth_headers([\"wrong::permission::scope\"])\n    response = client.get(\n        f\"\u002Fapi\u002Fv1\u002Fresource\u002F{resource.uuid}\",\n        headers=headers,\n    )\n\n    assert response.status_code == 403\n\n\ndef test_endpoint_rejects_missing_auth(client, dbsession):\n    \"\"\"Verify endpoint rejects unauthenticated requests.\"\"\"\n    resource = ResourceFactory()\n\n    response = client.get(f\"\u002Fapi\u002Fv1\u002Fresource\u002F{resource.uuid}\")\n\n    assert response.status_code in (401, 403)\n```\n\n### `pytest.mark.parametrize` to avoid duplication\n\nWhen multiple tests share the same logic but differ only in input\u002Fexpected output:\n\n```python\n@pytest.mark.parametrize(\n    \"payload,missing_field\",\n    [\n        ({\"name\": \"John Doe\", \"email\": \"john@example.com\"}, \"tax_id\"),\n        ({\"tax_id\": \"12345678901\", \"email\": \"john@example.com\"}, \"name\"),\n        ({\"tax_id\": \"12345678901\", \"name\": \"John Doe\"}, \"email\"),\n    ],\n    ids=[\"missing_tax_id\", \"missing_name\", \"missing_email\"],\n)\ndef test_create_person_rejects_missing_field(client, payload, missing_field):\n    \"\"\"Verify endpoint rejects payload missing a required field.\"\"\"\n    response = client.post(\"\u002Fapi\u002Fv1\u002Fperson\", json=payload)\n\n    assert response.status_code == 400\n```\n\nDo NOT use parametrize when the test logic itself differs between cases.\n\n### Property and stateful invariants with `hypothesis`\n\nWhen the code under test is a validator, parser, numeric calculation, data transformation, or a stateful component, propose hypothesis-based tests. The full guidance — strategies, properties to look for, and `RuleBasedStateMachine` patterns — lives in [invariants.md](invariants.md). Read it during Phase 1 if any of those signals appear.\n\nQuick reach for property invariants:\n\n```python\nfrom hypothesis import given, strategies as st\n\n\n@given(value=st.floats(allow_nan=False, allow_infinity=False))\ndef test_score_normalization_stays_in_range(value):\n    \"\"\"Verify score normalization always produces a value in [0, 1].\"\"\"\n    result = normalize_score(value)\n\n    assert 0.0 \u003C= result \u003C= 1.0\n```\n\nFor stateful systems (caches, queues, in-memory stores) load [invariants.md](invariants.md) and follow the `RuleBasedStateMachine` recipe.\n\n### Reusable setup must be pytest fixtures\n\n- Extract repeated setup into `@pytest.fixture` in `conftest.py`.\n- Place fixtures in the nearest `conftest.py` (directory-level for local, root for project-wide).\n- Fixtures can compose other fixtures and factories.\n\n```python\n@pytest.fixture\ndef verified_person(dbsession):\n    \"\"\"A person that has passed KYC verification.\"\"\"\n    person = PersonFactory(status=\"verified\")\n    dbsession.flush()\n    return person\n```\n\n### Factory-boy patterns\n\nPick the base class that fits the project:\n\n- `factory.Factory` — generic, no ORM\n- `factory.alchemy.SQLAlchemyModelFactory` — SQLAlchemy projects (Pyramid, Flask-SQLAlchemy, plain SQLAlchemy)\n- `factory.django.DjangoModelFactory` — Django projects\n\n```python\nclass CompanyFactory(factory.alchemy.SQLAlchemyModelFactory):\n    class Meta:\n        model = Company\n        sqlalchemy_session_persistence = \"flush\"\n\n    registration_number = factory.LazyFunction(\n        lambda: f\"{random.randint(10000000000000, 99999999999999)}\"\n    )\n    name = factory.Faker(\"company\")\n    revenue = factory.Faker(\"random_int\", min=100000, max=10000000)\n    created_at = factory.Faker(\"date_time\")\n```\n\n- Use `factory.Faker` for realistic data.\n- Use `factory.SubFactory` for relationships.\n- Use `factory.LazyFunction` for computed fields.\n\nFor Pyramid + SQLAlchemy session\u002Ftransaction wiring, see [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md).\n\n### Integration test patterns\n\nExternal HTTP — use `responses`:\n\n```python\n@responses.activate\ndef test_kyc_service_validates_person():\n    \"\"\"Verify KYC service handles person validation response.\"\"\"\n    responses.add(\n        responses.POST,\n        \"https:\u002F\u002Fapi.kyc-provider.com\u002Fv1\u002Fvalidate\",\n        json={\"valid\": True, \"status\": \"verified\", \"confidence\": 0.95},\n        status=200,\n    )\n\n    service = KYCService()\n    result = service.validate_person(person_data)\n\n    assert result[\"valid\"] is True\n    assert result[\"status\"] == \"verified\"\n```\n\ngRPC clients — use `patch` as last resort:\n\n```python\ndef test_legal_entity_grpc_integration():\n    \"\"\"Verify legal entity gRPC client handles validation response.\"\"\"\n    with patch(\"module.clients.legal_entity.LegalEntityClient\") as mock_client:\n        mock_client.return_value.validate_company.return_value = {\n            \"valid\": True,\n            \"company_status\": \"active\",\n        }\n\n        service = LegalEntityService()\n        result = service.validate_company(\"12345678000190\")\n\n        assert result[\"valid\"] is True\n```\n\n---\n\n## Phase 4: Verify\n\n1. Run `pytest \u003Ctest_file> -v` to confirm all tests pass.\n2. If hypothesis tests were added, run once with `--hypothesis-show-statistics` to confirm strategies generate meaningful examples.\n3. Report results to the user: which tests passed, which failed, any issues.\n4. If tests fail, fix and re-run until green.\n\n---\n\n## Error Recovery\n\n**`pytest` collects no tests:**\n- Confirm the file matches the discovery pattern (`test_*.py`) and lives under a path covered by `testpaths` in `pyproject.toml` \u002F `pytest.ini`.\n- Confirm test functions start with `test_`.\n- If using parametrize, confirm `ids=` does not collide with another test's id.\n\n**Fixture not found:**\n- Confirm the fixture is declared in a `conftest.py` at or above the test file.\n- A subdirectory `conftest.py` does not expose fixtures to siblings — move it up if shared.\n- For framework-specific fixtures (`testapp`, `dbsession`, `tm`), follow [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md).\n\n**Hypothesis flaky \u002F `Flaky` exception:**\n- A reproducible counter-example was lost between runs. Pin it with `@example(...)` so it is always tried.\n- If the failure depends on time or random state outside hypothesis, narrow the strategy or move that input to a fixture.\n\n**Hypothesis `HealthCheck` failure (filtering \u002F data generation too slow):**\n- Replace `assume(...)` filters with a more constrained strategy (`st.integers(min_value=..., max_value=...)`, `st.from_regex`).\n- For a single legitimate case, suppress with `@settings(suppress_health_check=[HealthCheck.filter_too_much])` and document why.\n\n**Hypothesis `DeadlineExceeded`:**\n- Increase `@settings(deadline=...)` only when the slowness is intrinsic (e.g., DB-backed test). For pure logic, fix the slow path instead of widening the deadline.\n\n**Factory writes not visible to the code under test:**\n- Confirm `sqlalchemy_session_persistence = \"flush\"` (not `\"commit\"`).\n- For Pyramid: confirm `extra_environ` wires `tm.manager` and `app.dbsession` — see [skills\u002Fpyramid-app\u002Fpyramid-tests.md](..\u002Fpyramid-app\u002Fpyramid-tests.md).\n\n**Test file exceeds ~200 lines:**\n- Split by concern: `test_\u003Cmodule>_api.py`, `test_\u003Cmodule>_service.py`, `test_\u003Cmodule>_integration.py`, `test_\u003Cmodule>_security.py`.\n- Propose the split to the user before moving tests.\n\n**`responses` raises `ConnectionError` on an unmatched call:**\n- The code is hitting an URL not registered with `responses.add(...)`. Either register the URL or, if the call is incidental, use `responses.add_passthru(...)` for the prefix that should bypass mocking.\n",{"name":5,"description":7},"main","ea5172c58cf8fe53f20b59482e62cc45741da12d",".cursor\u002Fskills\u002Fwrite-pytest","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal","https:\u002F\u002Fgithub.com\u002Fcartaorobbin","2026-10-24 04:09:32",{"source":9,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add cartaorobbin\u002Fpyramid-temporal --skill write-pytest",{"tool":60,"command":61},"bunx","bunx skills add cartaorobbin\u002Fpyramid-temporal --skill write-pytest",{"tool":63,"command":64},"pnpm","pnpm dlx skills add cartaorobbin\u002Fpyramid-temporal --skill write-pytest","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fwrite-pytest\u002FSKILL.md",true,[68,74,78,82,86,92,96,100,104,108,112],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},".managed-skill.md","REFERENCE","参考文档",233,"https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fwrite-pytest\u002F.managed-skill.md",{"path":75,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":76,"sourceHtmlUrl":77},"dx-hall-of-fame.md",13858,"https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgstack\u002Fblob\u002Fmain\u002Fplan-devex-review\u002Fdx-hall-of-fame.md",{"path":79,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":80,"sourceHtmlUrl":81},"invariants.md",11939,"https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fwrite-pytest\u002Finvariants.md",{"path":83,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":84,"sourceHtmlUrl":85},"sections\u002Fchecklist.md",1741,"https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgstack\u002Fblob\u002Fmain\u002Fplan-devex-review\u002Fsections\u002Fchecklist.md",{"path":87,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":90,"sourceHtmlUrl":91},"sections\u002Fchecklist.md.tmpl","OTHER","其他",1625,"https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgstack\u002Fblob\u002Fmain\u002Fplan-devex-review\u002Fsections\u002Fchecklist.md.tmpl",{"path":93,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":94,"sourceHtmlUrl":95},"sections\u002Fmanifest.json",1354,"https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgstack\u002Fblob\u002Fmain\u002Fplan-devex-review\u002Fsections\u002Fmanifest.json",{"path":97,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":98,"sourceHtmlUrl":99},"sections\u002Fpreamble.md",22396,"https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgstack\u002Fblob\u002Fmain\u002Fplan-devex-review\u002Fsections\u002Fpreamble.md",{"path":101,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":102,"sourceHtmlUrl":103},"sections\u002Freview-sections.md",64234,"https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgstack\u002Fblob\u002Fmain\u002Fplan-devex-review\u002Fsections\u002Freview-sections.md",{"path":105,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":106,"sourceHtmlUrl":107},"sections\u002Freview-sections.md.tmpl",23704,"https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgstack\u002Fblob\u002Fmain\u002Fplan-devex-review\u002Fsections\u002Freview-sections.md.tmpl",{"path":109,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":110,"sourceHtmlUrl":111},"SKILL.md.tmpl",20728,"https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgstack\u002Fblob\u002Fmain\u002Fplan-devex-review\u002FSKILL.md.tmpl",{"path":113,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":114,"sourceHtmlUrl":115},"templates\u002Ftest-patterns-rule.mdc",3500,"https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fwrite-pytest\u002Ftemplates\u002Ftest-patterns-rule.mdc",[117,137,164,179,196,216],{"skillNo":118,"name":119,"nameZh":120,"description":121,"descriptionZh":122,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":123,"categories":124,"keywords":127,"publishedAt":43},"01M6C1TTVR96XWX68FQY37S2QZ","quality-assurance","会话质量保障检查","Run quality assurance checks on the current chat session — pre-task validation, post-task checklist, and code review. Use when finishing a task, before committing, or when the user asks for a QA review.","对当前聊天会话执行质量保障检查——任务前验证、任务后清单和代码审查。在完成任务时、提交前或用户要求进行 QA 审查时使用。","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fquality-assurance\u002FSKILL.md",[125,126],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[128,129,130,131,132,133,134,135,41,136,42],"quality assurance","quality","code review","review","run","code","validation","qa","session",{"skillNo":138,"name":139,"nameZh":140,"description":141,"descriptionZh":142,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":143,"categories":144,"keywords":151,"publishedAt":43},"01M6C1TR2SWA481C00S2VQ12DW","python-developer","Python 开发规范配置","Python developer umbrella — installs Python coding conventions and bundles companion skills (best practices, testing, dependency management) in a single setup. Use when the user asks to set up Python development conventions, install Python skills, or says \"set up Python development\".","Python 开发者总括技能——一次性安装 Python 编码约定，并捆绑配套技能（最佳实践、测试、依赖管理）完成统一配置。当用户要求建立 Python 开发规范、安装 Python 技能，或说“搭建 Python 开发环境”时使用。","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fpython-developer\u002FSKILL.md",[145,148],{"categoryNo":146,"categoryName":147,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQ6TKQDF2K4KQS863Q79P4","开发参考",{"categoryNo":149,"categoryName":150,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师",[152,153,33,42,154,155,156,157,158,159,160,161,41,162,163],"python developer","developer","testing","python development","setup","development","best practices","SET","coding","management","dependency management","install",{"skillNo":165,"name":166,"nameZh":167,"description":168,"descriptionZh":169,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":170,"categories":171,"keywords":174,"publishedAt":43},"01M6C1TNAANT8RS9XKB2F3JF3E","python-best-practices","Python 编码最佳实践","Comprehensive Python coding conventions and best practices. Use when the user asks about Python conventions, coding patterns, best practices, code style, anti-patterns, or \"how should I write this\" in Python.","全面的 Python 编码约定与最佳实践。当用户询问 Python 约定、编码模式、最佳实践、代码风格、反模式，或“这段 Python 代码应该怎么写”时使用。","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fpython-best-practices\u002FSKILL.md",[172,173],{"categoryNo":146,"categoryName":147,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":149,"categoryName":150,"taxonomyType":23,"taxonomyTypeDesc":24},[158,175,33,176,177,133,178,160,31,41,42],"python best practices","anti-patterns","code style","how",{"skillNo":180,"name":181,"nameZh":182,"description":183,"descriptionZh":184,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":185,"categories":186,"keywords":189,"publishedAt":43},"01M6C1TJEMGMNGNVE4DKWF4TNA","pyramid-library","Pyramid 扩展库开发","Library Developer persona: developing standalone Pyramid extensions (own repo, own package) that expose includeme for external consumers. Use when the user builds a reusable Pyramid library, designs includeme for consumers, registers custom directives\u002Ftweens\u002Frequest methods, or tests a library with a proper app.","库开发者角色：开发独立的 Pyramid 扩展（拥有自己的仓库与包），并向外部使用者暴露 includeme。当用户构建可复用的 Pyramid 库、为使用者设计 includeme、注册自定义指令\u002Ftween\u002F请求方法，或使用规范的应用程序测试库时使用。","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fpyramid-library\u002FSKILL.md",[187,188],{"categoryNo":146,"categoryName":147,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":149,"categoryName":150,"taxonomyType":23,"taxonomyTypeDesc":24},[190,191,192,193,194,153,195,41,42],"pyramid library","library","repo","core","package","persona",{"skillNo":197,"name":198,"nameZh":199,"description":200,"descriptionZh":201,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":202,"categories":203,"keywords":206,"publishedAt":43},"01M6C1TFT8Z6MCBEAQ7S24XQ77","pyramid-developer","Pyramid 框架开发规范","Pyramid framework conventions — configuration\u002Fregistry, module system with includeme, pyramid_services, models, Cornice REST, ACL authorization, and transactions. Use when setting up Pyramid development conventions for a project.","Pyramid 框架开发约定——配置\u002F注册表、基于 includeme 的模块系统、pyramid_services、模型、Cornice REST、ACL 授权以及事务处理。在为一个项目建立 Pyramid 开发规范时使用。","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fpyramid-developer\u002FSKILL.md",[204,205],{"categoryNo":146,"categoryName":147,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":149,"categoryName":150,"taxonomyType":23,"taxonomyTypeDesc":24},[207,153,208,209,210,211,212,42,213,38,214,215,157,33],"pyramid developer","ACL","REST","authorization","transactions","system","micromonolith","services","registry",{"skillNo":217,"name":218,"nameZh":219,"description":220,"descriptionZh":221,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":222,"categories":223,"keywords":226,"publishedAt":43},"01M6C1TD7J0P6CTDVGEJH55W1B","pyramid-core","Pyramid 框架扩展点参考","Pyramid framework features reference — request methods, custom directives, events, tweens, exception views, view predicates, view derivers, callbacks, renderers, and static views. Use when the user asks about any Pyramid framework extension point.","Pyramid 框架特性参考——请求方法、自定义指令、事件、补间（tween）、异常视图、视图谓词、视图派生器、回调、渲染器以及静态视图。当用户询问 Pyramid 框架的任何扩展点时使用。","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fpyramid-core\u002FSKILL.md",[224,225],{"categoryNo":146,"categoryName":147,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":149,"categoryName":150,"taxonomyType":23,"taxonomyTypeDesc":24},[193,227,42,41,228,153,38],"pyramid core","view"]