用途:确保一个 Scrapy 项目存在,并正确配置 web-poet 页面对象与 Zyte API 支持。输入为两个以空格分隔的位置参数:project_dir(项目目录,如 ./books-project)和 project_name(Python 包名,如 books_project)。
主要能力:若 {project_dir}/pyproject.toml 已存在,则视为已有项目,进入依赖校验;否则用内置 cookiecutter 模板从零创建项目。创建命令为:uvx cookiecutter --no-input ${CLAUDE_SKILL_DIR}/assets/project-template -o PARENT_DIR project_name=PROJECT_NAME。生成内容包含:带依赖(scrapy、scrapy-poet、scrapy-zyte-api、web-poet)的 pyproject.toml、含部署设置的 scrapy.cfg、已配置 scrapy-poet 与 Zyte API 插件的 settings.py,以及 pages/、spiders/、fixtures/ 目录和空的 items.py。随后执行 cd PROJECT_DIR && uv sync 安装依赖。
已有项目校验:读取 pyproject.toml,检查依赖中是否包含 scrapy、scrapy-poet、web-poet、extruct、price-parser、pytest;缺失时列出并询问是否添加,未经确认不修改项目。同时检查 fixtures/ 目录,缺失则创建。
限制:仅依据资料描述执行上述流程;未提供模板细节、版本要求或 Zyte API 凭据配置说明。