{
  "schemaVersion": "1.0",
  "item": {
    "slug": "python",
    "name": "Python Coding Guidelines",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/adarshdigievo/python",
    "canonicalUrl": "https://clawhub.ai/adarshdigievo/python",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/python",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=python",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "slug": "python",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T15:55:00.593Z",
      "expiresAt": "2026-05-14T15:55:00.593Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=python",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=python",
        "contentDisposition": "attachment; filename=\"python-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "python"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/python"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/python",
    "agentPageUrl": "https://openagent3.xyz/skills/python/agent",
    "manifestUrl": "https://openagent3.xyz/skills/python/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/python/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Code Style (PEP 8)",
        "body": "4 spaces for indentation (never tabs)\nMax line length: 88 chars (Black default) or 79 (strict PEP 8)\nTwo blank lines before top-level definitions, one within classes\nImports: stdlib → third-party → local, alphabetized within groups\nSnake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants"
      },
      {
        "title": "Before Committing",
        "body": "# Syntax check (always)\npython -m py_compile *.py\n\n# Run tests if present\npython -m pytest tests/ -v 2>/dev/null || python -m unittest discover -v 2>/dev/null || echo \"No tests found\"\n\n# Format check (if available)\nruff check . --fix 2>/dev/null || python -m black --check . 2>/dev/null"
      },
      {
        "title": "Python Version",
        "body": "Minimum: Python 3.10+ (3.9 EOL Oct 2025)\nTarget: Python 3.11-3.13 for new projects\nNever use Python 2 syntax or patterns\nUse modern features: match statements, walrus operator, type hints"
      },
      {
        "title": "Dependency Management",
        "body": "Check for uv first, fall back to pip:\n\n# Prefer uv if available\nif command -v uv &>/dev/null; then\n    uv pip install <package>\n    uv pip compile requirements.in -o requirements.txt\nelse\n    pip install <package>\nfi\n\nFor new projects with uv: uv init or uv venv && source .venv/bin/activate"
      },
      {
        "title": "Pythonic Patterns",
        "body": "# ✅ List/dict comprehensions over loops\nsquares = [x**2 for x in range(10)]\nlookup = {item.id: item for item in items}\n\n# ✅ Context managers for resources\nwith open(\"file.txt\") as f:\n    data = f.read()\n\n# ✅ Unpacking\nfirst, *rest = items\na, b = b, a  # swap\n\n# ✅ EAFP over LBYL\ntry:\n    value = d[key]\nexcept KeyError:\n    value = default\n\n# ✅ f-strings for formatting\nmsg = f\"Hello {name}, you have {count} items\"\n\n# ✅ Type hints\ndef process(items: list[str]) -> dict[str, int]:\n    ...\n\n# ✅ dataclasses/attrs for data containers\nfrom dataclasses import dataclass\n\n@dataclass\nclass User:\n    name: str\n    email: str\n    active: bool = True\n\n# ✅ pathlib over os.path\nfrom pathlib import Path\nconfig = Path.home() / \".config\" / \"app.json\"\n\n# ✅ enumerate, zip, itertools\nfor i, item in enumerate(items):\n    ...\nfor a, b in zip(list1, list2, strict=True):\n    ..."
      },
      {
        "title": "Anti-patterns to Avoid",
        "body": "# ❌ Mutable default arguments\ndef bad(items=[]):  # Bug: shared across calls\n    ...\ndef good(items=None):\n    items = items or []\n\n# ❌ Bare except\ntry:\n    ...\nexcept:  # Catches SystemExit, KeyboardInterrupt\n    ...\nexcept Exception:  # Better\n    ...\n\n# ❌ Global state\n# ❌ from module import * \n# ❌ String concatenation in loops (use join)\n# ❌ == None (use `is None`)\n# ❌ len(x) == 0 (use `not x`)"
      },
      {
        "title": "Testing",
        "body": "Use pytest (preferred) or unittest\nName test files test_*.py, test functions test_*\nAim for focused unit tests, mock external dependencies\nRun before every commit: python -m pytest -v"
      },
      {
        "title": "Docstrings",
        "body": "def fetch_user(user_id: int, include_deleted: bool = False) -> User | None:\n    \"\"\"Fetch a user by ID from the database.\n    \n    Args:\n        user_id: The unique user identifier.\n        include_deleted: If True, include soft-deleted users.\n    \n    Returns:\n        User object if found, None otherwise.\n    \n    Raises:\n        DatabaseError: If connection fails.\n    \"\"\""
      },
      {
        "title": "Quick Checklist",
        "body": "Syntax valid (py_compile)\n Tests pass (pytest)\n Type hints on public functions\n No hardcoded secrets\n f-strings, not .format() or %\n pathlib for file paths\n Context managers for I/O\n No mutable default args"
      }
    ],
    "body": "Python Coding Guidelines\nCode Style (PEP 8)\n4 spaces for indentation (never tabs)\nMax line length: 88 chars (Black default) or 79 (strict PEP 8)\nTwo blank lines before top-level definitions, one within classes\nImports: stdlib → third-party → local, alphabetized within groups\nSnake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants\nBefore Committing\n# Syntax check (always)\npython -m py_compile *.py\n\n# Run tests if present\npython -m pytest tests/ -v 2>/dev/null || python -m unittest discover -v 2>/dev/null || echo \"No tests found\"\n\n# Format check (if available)\nruff check . --fix 2>/dev/null || python -m black --check . 2>/dev/null\n\nPython Version\nMinimum: Python 3.10+ (3.9 EOL Oct 2025)\nTarget: Python 3.11-3.13 for new projects\nNever use Python 2 syntax or patterns\nUse modern features: match statements, walrus operator, type hints\nDependency Management\n\nCheck for uv first, fall back to pip:\n\n# Prefer uv if available\nif command -v uv &>/dev/null; then\n    uv pip install <package>\n    uv pip compile requirements.in -o requirements.txt\nelse\n    pip install <package>\nfi\n\n\nFor new projects with uv: uv init or uv venv && source .venv/bin/activate\n\nPythonic Patterns\n# ✅ List/dict comprehensions over loops\nsquares = [x**2 for x in range(10)]\nlookup = {item.id: item for item in items}\n\n# ✅ Context managers for resources\nwith open(\"file.txt\") as f:\n    data = f.read()\n\n# ✅ Unpacking\nfirst, *rest = items\na, b = b, a  # swap\n\n# ✅ EAFP over LBYL\ntry:\n    value = d[key]\nexcept KeyError:\n    value = default\n\n# ✅ f-strings for formatting\nmsg = f\"Hello {name}, you have {count} items\"\n\n# ✅ Type hints\ndef process(items: list[str]) -> dict[str, int]:\n    ...\n\n# ✅ dataclasses/attrs for data containers\nfrom dataclasses import dataclass\n\n@dataclass\nclass User:\n    name: str\n    email: str\n    active: bool = True\n\n# ✅ pathlib over os.path\nfrom pathlib import Path\nconfig = Path.home() / \".config\" / \"app.json\"\n\n# ✅ enumerate, zip, itertools\nfor i, item in enumerate(items):\n    ...\nfor a, b in zip(list1, list2, strict=True):\n    ...\n\nAnti-patterns to Avoid\n# ❌ Mutable default arguments\ndef bad(items=[]):  # Bug: shared across calls\n    ...\ndef good(items=None):\n    items = items or []\n\n# ❌ Bare except\ntry:\n    ...\nexcept:  # Catches SystemExit, KeyboardInterrupt\n    ...\nexcept Exception:  # Better\n    ...\n\n# ❌ Global state\n# ❌ from module import * \n# ❌ String concatenation in loops (use join)\n# ❌ == None (use `is None`)\n# ❌ len(x) == 0 (use `not x`)\n\nTesting\nUse pytest (preferred) or unittest\nName test files test_*.py, test functions test_*\nAim for focused unit tests, mock external dependencies\nRun before every commit: python -m pytest -v\nDocstrings\ndef fetch_user(user_id: int, include_deleted: bool = False) -> User | None:\n    \"\"\"Fetch a user by ID from the database.\n    \n    Args:\n        user_id: The unique user identifier.\n        include_deleted: If True, include soft-deleted users.\n    \n    Returns:\n        User object if found, None otherwise.\n    \n    Raises:\n        DatabaseError: If connection fails.\n    \"\"\"\n\nQuick Checklist\n Syntax valid (py_compile)\n Tests pass (pytest)\n Type hints on public functions\n No hardcoded secrets\n f-strings, not .format() or %\n pathlib for file paths\n Context managers for I/O\n No mutable default args"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/adarshdigievo/python",
    "publisherUrl": "https://clawhub.ai/adarshdigievo/python",
    "owner": "adarshdigievo",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/python",
    "downloadUrl": "https://openagent3.xyz/downloads/python",
    "agentUrl": "https://openagent3.xyz/skills/python/agent",
    "manifestUrl": "https://openagent3.xyz/skills/python/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/python/agent.md"
  }
}