Init Deps Install 标志

Init Deps Install

社区
NatsuFox
init-deps-install

当 Tapestry 在新环境中首次启动或缺少依赖项时自动触发。智能检测环境,并在获得用户确认后安装 Tapestry 依赖项。

Add to TypingMind

概览

发布者NatsuFox
代码仓库Tapestry
技能名称init-deps-install
星标数
64
复刻数
5
附带文件
8
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 8 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 NatsuFox 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Init Deps Install AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/NatsuFox/Tapestry/tree/main/skills/tapestry/init-deps-install
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/NatsuFox/Tapestry.git /tmp/Tapestry
mkdir -p .claude/skills
cp -r /tmp/Tapestry/skills/tapestry/init-deps-install .claude/skills/init-deps-install
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Init Deps Install,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Init Deps Install。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Init Deps Install 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

📦 Tapestry Init Deps Install

Automatic Dependency Installation with Environment Detection

This skill is automatically triggered when Tapestry is first launched on a new environment or when dependencies are missing. It detects the user's Python environment (venv, conda, system Python, etc.) and provides a comprehensive installation plan for all project dependencies, including both Python packages and system-level tools.

When This Skill is Triggered

This skill is automatically invoked when:

  • Tapestry is first launched on a new environment (one-time auto-trigger)
  • Required dependencies are missing or cannot be imported
  • The user explicitly asks to "install dependencies" or "set up the project"
  • After creating a new project that requires dependencies

Important: The automatic trigger only occurs the first time Tapestry runs in a new environment. After successful initialization, the skill will not auto-trigger on subsequent runs to avoid wasting tokens. Manual invocation is always available if needed.

How This Skill Works

  1. Configuration Setup: Checks for user configuration and creates it if missing:

    • Detects if tapestry.config.json exists
    • If not, copies from tapestry.config.example.json
    • Determines the real project root path
    • Updates paths.project_root in the config with the actual path
  2. Environment Detection: Analyzes the current environment to determine:

    • Python version and location
    • Virtual environment status (venv, virtualenv, conda)
    • Package manager availability (pip, conda, poetry, uv)
    • Existing installed packages
  3. Dependency Analysis: Scans for dependency files:

    • pyproject.toml (preferred)
    • requirements.txt
    • setup.py
    • environment.yml (conda)
  4. Plan Generation: Creates a comprehensive installation plan including:

    • Configuration file setup (if needed)
    • Python package installation commands
    • System-level dependencies (e.g., playwright install chromium)
    • Optional dependencies and recommendations
    • Environment-specific considerations
  5. User Confirmation: Presents the plan and asks for approval before executing

  6. Installation: Executes the approved plan and reports results

Usage

This skill is automatically triggered when dependencies are missing. It can also be manually invoked:

bash
# Manually trigger from the project root
/init-deps-install

# Or specify a project path
/init-deps-install /path/to/project

Implementation

When this skill is invoked:

  1. Check and setup configuration if needed
  2. Detect the environment by running the detection script
  3. Analyze dependencies from project files
  4. Generate an installation plan with clear steps
  5. Present the plan to the user with AskUserQuestion
  6. Execute approved steps and report results

Step 0: Configuration Setup

Before installing dependencies, check if this is the first run:

bash
# Check if already initialized
python init-deps-install/_scripts/check_initialized.py
# Exit code 0 = already initialized, 1 = needs initialization

# If not initialized, setup configuration
python init-deps-install/_scripts/setup_config.py [project-root]

The setup script will:

  1. Check if tapestry.config.json exists
  2. If not, copy from tapestry.config.example.json
  3. Determine the project root path (argument or CWD)
  4. Update paths.project_root in the config

Project Root Detection:

  • If invoked with an argument, use that path as project root
  • Otherwise, use the current working directory
  • Convert to absolute path
  • Update the paths.project_root field in tapestry.config.json

Example Output:

json
{
  "config_existed": false,
  "config_path": "/path/to/skills/tapestry/config/tapestry.config.json",
  "project_root": "/home/user/my-tapestry-project",
  "created": true,
  "updated": true
}

Initialization Marker: After successful setup and installation, create a marker file:

bash
# Create .tapestry_initialized marker
python init-deps-install/_scripts/mark_initialized.py

This marker file indicates that Tapestry has been successfully initialized and prevents the skill from auto-triggering on future runs, saving tokens.

Step 1: Environment Detection

Run the environment detection script:

bash
python init-deps-install/_scripts/detect_env.py

This outputs JSON with:

  • python_version: Python version string
  • python_path: Path to Python executable
  • env_type: "venv", "conda", "system", or "unknown"
  • env_name: Name of the environment (if applicable)
  • env_path: Path to the environment (if applicable)
  • package_manager: "pip", "conda", "poetry", "uv", or "pip" (default)
  • installed_packages: List of currently installed packages

Step 2: Dependency Analysis

Read and parse dependency files in order of preference:

  1. pyproject.toml - Parse [project.dependencies] and [project.optional-dependencies]
  2. requirements.txt - Parse line by line
  3. setup.py - Look for install_requires

Identify:

  • Core dependencies (required)
  • Optional dependencies (browser support, dev tools, etc.)
  • Post-install commands (e.g., playwright install chromium)

Step 3: Generate Installation Plan

Create a structured plan with:

Environment Summary:

  • Current Python version and path
  • Environment type and name
  • Package manager to use

Installation Steps:

  1. Core dependencies installation command
  2. Optional dependencies (with recommendations)
  3. Post-install commands (system-level tools)
  4. Verification steps

Example Plan:

Configuration:
✓ Created tapestry.config.json from example
✓ Set project_root to: /home/user/my-project

Environment: Python 3.11.5 in conda environment 'myenv'
Package Manager: conda (with pip fallback)

Installation Steps:
1. Install core dependencies:
   conda install httpx pydantic selectolax readability-lxml chardet

2. Install browser support (recommended for JavaScript-heavy sites):
   pip install playwright>=1.40.0
   playwright install chromium

3. [Optional] Install development tools:
   pip install pytest pytest-asyncio pytest-cov black ruff mypy

Step 4: User Confirmation

Use AskUserQuestion to present the plan:

json
{
  "questions": [{
    "question": "I've detected your environment and prepared an installation plan. Would you like to proceed?",
    "header": "Install",
    "multiSelect": false,
    "options": [
      {
        "label": "Install all (recommended)",
        "description": "Install core dependencies, browser support, and post-install tools"
      },
      {
        "label": "Core only",
        "description": "Install only required dependencies, skip optional packages"
      },
      {
        "label": "Custom selection",
        "description": "Let me choose which components to install"
      }
    ]
  }]
}

If user selects "Custom selection", present a second multi-select question with individual components.

Step 5: Execute Installation

Based on user selection, execute the appropriate commands:

bash
# Example for pip in venv
pip install -e .  # If pyproject.toml exists
# OR
pip install -r requirements.txt

# Post-install commands
playwright install chromium

Monitor output and report:

  • ✅ Successfully installed packages
  • ⚠️ Warnings or issues
  • ❌ Failed installations with error messages

Step 6: Verification

After installation, verify:

bash
python init-deps-install/_scripts/verify_install.py

This checks:

  • All required packages are importable
  • Versions meet requirements
  • System tools are available (e.g., chromium for playwright)

Report verification results to the user.

Error Handling

Common issues and solutions:

Issue: No package manager detected Solution: Recommend installing pip or conda

Issue: Permission denied Solution: Suggest using virtual environment or --user flag

Issue: Conflicting dependencies Solution: Show conflict details and suggest resolution strategies

Issue: Network errors Solution: Suggest checking internet connection or using mirrors

Important Notes

  • Never install without confirmation: Always present the plan first
  • Respect user environment: Don't modify system Python without explicit permission
  • Handle failures gracefully: If one package fails, continue with others and report at the end
  • Provide context: Explain why certain dependencies are needed
  • Support multiple package managers: Detect and use the appropriate tool for the environment

Directory Structure

skills/tapestry/init-deps-install/
├── SKILL.md                    # This file
├── README.md                   # Developer documentation
├── _scripts/
│   ├── check_initialized.py   # Check if Tapestry is initialized
│   ├── setup_config.py        # Configuration setup from example
│   ├── mark_initialized.py    # Create initialization marker
│   ├── detect_env.py          # Environment detection
│   ├── parse_deps.py          # Dependency parsing utilities
│   ├── verify_install.py      # Post-install verification
│   └── install_deps.py        # Installation orchestrator
└── _specs/
    └── env_detection.md       # Environment detection specification

Example Workflows

Workflow 1: Fresh Project Setup

User: "Set up this project"

Actions:
1. Check for tapestry.config.json, create from example if missing
2. Detect project root and update config
3. Detect environment (conda with Python 3.11)
4. Find pyproject.toml with dependencies
5. Generate plan:
   - Configuration setup
   - pip install -e .
   - playwright install chromium
6. Ask user for confirmation
7. Execute approved steps
8. Verify installation
9. Create .tapestry_initialized marker
10. Report: "✅ Installed 8 packages successfully. Project ready!"

Workflow 2: Missing Dependencies

User: "Install the missing dependencies"

Actions:
1. Detect environment (venv with Python 3.10)
2. Compare installed vs required packages
3. Generate plan for missing packages only
4. Ask user for confirmation
5. Execute: pip install <missing-packages>
6. Verify installation
7. Report: "✅ Installed 3 missing packages"

Workflow 3: System Python (Risky)

User: "Install dependencies"

Actions:
1. Detect environment (system Python, no venv)
2. Generate plan with WARNING
3. Ask user: "⚠️ You're using system Python. Recommend creating a virtual environment first. Proceed anyway?"
4. If user confirms, install with --user flag
5. Report results with reminder to use venv

Key Principle: Be transparent about what will be installed and why. Never surprise the user with unexpected system modifications.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Init Deps Install AI 技能有什么作用?

当 Tapestry 在新环境中首次启动或缺少依赖项时自动触发。智能检测环境,并在获得用户确认后安装 Tapestry 依赖项。

为什么在 TypingMind 中使用 Init Deps Install?

因为您只需安装一次,就能搭配任何模型使用。Init Deps Install 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Init Deps Install?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/NatsuFox/Tapestry/tree/main/skills/tapestry/init-deps-install。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Init Deps Install?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Init Deps Install 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Init Deps Install 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Init Deps Install AI 技能免费吗?

是的。NatsuFox 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇