AgentSkillsCN

provision-project

适用于新项目搭建,或当用户请求加载/配置工作流时使用。会将精选的工作流模板复制到项目的 .agent/workflows/ 目录下。

SKILL.md
--- frontmatter
name: provision-project
description: Use when setting up a new project or when user asks to load/provision workflows. Copies curated workflow templates into the project's .agent/workflows/ directory.

Provision Project

Overview

Copies curated Antigravity workflow templates into the current project's .agent/workflows/ directory. Templates are maintained in the global template library and synced via daily-maintenance.

When to Use

  • User says "provision this project", "set up workflows", "load workflows", "add workflows"
  • Starting work on a new project that has no .agent/workflows/ directory
  • User asks "what workflows are available?"

Portable Paths

All steps use these variables — never hardcode user-specific paths:

powershell
$ANTIGRAVITY_HOME = Join-Path $HOME ".gemini/antigravity"
$TEMPLATE_DIR     = Join-Path $ANTIGRAVITY_HOME "skills/provision-project/templates"

[!IMPORTANT] Never hardcode user paths. Always derive from $HOME. This ensures portability across machines.

How to Provision

Default: PowerShell (fast — ~1 second)

Run this single PowerShell command via run_command. It copies all templates, respects # LOCKED files, and prunes orphans:

powershell
$TEMPLATE_DIR = Join-Path $HOME ".gemini/antigravity/skills/provision-project/templates"
$DEST_DIR = Join-Path $PWD ".agent/workflows"
if (!(Test-Path $DEST_DIR)) { New-Item -ItemType Directory -Path $DEST_DIR -Force | Out-Null }
$added = 0; $refreshed = 0; $skipped = 0; $removed = 0
# Copy all templates, respecting LOCKED files
Get-ChildItem $TEMPLATE_DIR -Filter "*.md" | ForEach-Object {
  $dest = Join-Path $DEST_DIR $_.Name
  if (Test-Path $dest) {
    $firstLine = Get-Content $dest -TotalCount 1
    if ($firstLine -match '^# LOCKED') { $skipped++; return }
    $refreshed++
  } else { $added++ }
  Copy-Item $_.FullName $dest -Force
}
# Remove orphaned workflows that no longer exist in templates
$templateNames = (Get-ChildItem $TEMPLATE_DIR -Filter "*.md").Name
Get-ChildItem $DEST_DIR -Filter "*.md" | Where-Object { $_.Name -notin $templateNames } | ForEach-Object {
  $firstLine = Get-Content $_.FullName -TotalCount 1
  if ($firstLine -notmatch '^# LOCKED') { Remove-Item $_.FullName -Force; $removed++ }
}
Write-Output "Provisioned: $added added, $refreshed refreshed, $skipped skipped (LOCKED), $removed removed"
# Seed .upstream-workflows.txt if missing (enables daily-maintenance orphan pruning)
$manifestPath = Join-Path $TEMPLATE_DIR ".upstream-workflows.txt"
if (!(Test-Path $manifestPath)) { $templateNames | Set-Content $manifestPath }
# Create .gemini/workflows junction for VS Code / Gemini Code Assist discovery
$geminiWf = Join-Path $PWD ".gemini/workflows"
if (!(Test-Path $geminiWf)) {
  try {
    $geminiDir = Join-Path $PWD ".gemini"
    if (!(Test-Path $geminiDir)) { New-Item -ItemType Directory -Path $geminiDir -Force | Out-Null }
    New-Item -ItemType Junction -Path $geminiWf -Target (Resolve-Path $DEST_DIR).Path -ErrorAction Stop | Out-Null
    Write-Output "Created .gemini/workflows junction for VS Code discovery"
  } catch {
    Write-Output "⚠️ Junction creation failed: $($_.Exception.Message) — workflows still available via .agent/workflows"
  }
}

[!TIP] Set SafeToAutoRun: true on this command — it only copies files within the project and is non-destructive.

Fallback: Internal File Tools (slow — for restricted environments)

If PowerShell is unavailable, use view_file + write_to_file to read each template and write it to .agent/workflows/:

  1. List templates: list_dir or find_by_name on $TEMPLATE_DIR
  2. Read each: view_file (batch 10–15 in parallel)
  3. Write each: write_to_file with Overwrite: true (check first line for # LOCKED before overwriting)
  4. Prune orphans: Delete any project workflow files that don't exist in the template library (respecting LOCKED files)
  5. Seed manifest: Write .upstream-workflows.txt in the template dir if it doesn't exist
  6. Report: How many added, refreshed, skipped, removed

Workflow Catalog

Available workflows (12): brainstorm, create, debug, deploy, enhance, execute-plan, orchestrate, plan, preview, status, test, ui-ux-pro-max

Key Rules

  • PowerShell first — use the PowerShell script by default for speed; fall back to view_file/write_to_file only if shell is unavailable
  • Never overwrite LOCKED files — if first line is # LOCKED, skip it
  • Always create .agent/workflows/ if missingwrite_to_file handles this automatically
  • Prune orphans — remove project workflows that no longer exist in the template library (respecting LOCKED files)
  • Report changes — tell user what was added, refreshed, skipped, and removed
  • No hardcoded paths — all paths derive from $HOME; portable across machines
  • Idempotent — safe to run multiple times