ワンクリックで
autospec-worktree-setup
Generate project-specific worktree setup script based on project analysis.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Generate project-specific worktree setup script based on project analysis.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Generate YAML feature specification from natural language description.
Generate YAML task breakdown from implementation plan.
Analyze cross-artifact consistency and quality in YAML format.
Generate YAML checklist for feature quality validation.
Identify underspecified areas in YAML spec and encode clarifications back into the spec.
Generate or update project constitution in YAML format.
| name | autospec-worktree-setup |
| description | Generate project-specific worktree setup script based on project analysis. |
This Agent Skill is generated from autospec.worktree-setup. When the user invokes "$autospec-worktree-setup" or "/autospec.worktree-setup", load and follow these instructions directly. Treat the text after the skill or command name as "$ARGUMENTS". Do not route back through "autospec worktree-setup"; this skill is the prompt for the stage.
Project specs directory: ./specs
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
You are generating a project-specific setup script that will be run when creating new git worktrees. This script handles copying essential configuration files and running package manager install commands instead of copying large dependency directories.
Follow this execution flow:
Analyze project structure:
Identify package managers by checking for lockfiles:
package-lock.json -> npmyarn.lock -> yarnpnpm-lock.yaml -> pnpmbun.lockb -> bungo.sum or go.mod -> gorequirements.txt or Pipfile.lock -> pip/pipenvpoetry.lock or pyproject.toml with [tool.poetry] -> poetryCargo.lock -> cargoGemfile.lock -> bundlercomposer.lock -> composerIdentify essential directories/files to copy:
Autospec-related (REQUIRED for autospec workflows):
.autospec/ - Contains constitution, config, memory, and generated scripts. The constitution.yaml is REQUIRED for all workflow stages (specify, plan, tasks, implement)..agents/skills/ (if exists) - Shared autospec skills for Codex and OpenCode skill-aware sessions..claude/skills/ (if exists) - Claude Code project skills. Required if using agent_preset: claude.opencode.json (if exists) - OpenCode configuration file with permissions and model settings. Located at project root, not inside .opencode/.IDE/Editor configuration:
.vscode/ (if exists).idea/ (if exists)Identify files/directories to EXCLUDE:
node_modules/, vendor/, __pycache__/, .venv/, venv/, target/, dist/, build/, .bundle/*.log, *.tmp, .cache/, coverage/Handle secrets:
.env* (.env, .env.local, .env.production, etc.)credentials.*secrets.**.pem*.key*.p12*token* files.ssh/--include-env was specified in the user input, include .env* files but still exclude other secret patternsGenerate the setup script:
Create a POSIX-compatible bash script at .autospec/scripts/setup-worktree.sh with the following structure:
#!/bin/bash
# setup-worktree.sh - Project-specific worktree setup script
# Generated by autospec worktree gen-script
#
# Usage: Called automatically by 'autospec worktree create' or run manually:
# ./setup-worktree.sh <worktree_path>
#
# Environment variables (set by worktree create command):
# WORKTREE_PATH - Path to the new worktree
# WORKTREE_NAME - Name of the worktree
# WORKTREE_BRANCH - Branch checked out in worktree
# SOURCE_REPO - Path to source repository
set -euo pipefail
# Get worktree path from argument or environment
WORKTREE_PATH="${1:-${WORKTREE_PATH:-}}"
SOURCE_REPO="${SOURCE_REPO:-$(git rev-parse --show-toplevel)}"
if [ -z "$WORKTREE_PATH" ]; then
echo "Error: Worktree path required. Usage: $0 <worktree_path>"
exit 1
fi
echo "Setting up worktree at: $WORKTREE_PATH"
echo "Source repository: $SOURCE_REPO"
# Function to copy directory if it exists
copy_if_exists() {
local src="$SOURCE_REPO/$1"
local dst="$WORKTREE_PATH/$1"
if [ -d "$src" ]; then
echo "Copying $1..."
mkdir -p "$(dirname "$dst")"
cp -r "$src" "$dst"
fi
}
# Copy essential configuration directories
# Autospec-related (REQUIRED for autospec workflows)
copy_if_exists ".autospec" # Constitution, config, memory, scripts
copy_if_exists ".agents/skills" # Shared Codex/OpenCode skills
copy_if_exists ".claude/skills" # Claude Code project skills
# Copy OpenCode config file if it exists
if [ -f "$SOURCE_REPO/opencode.json" ]; then
echo "Copying opencode.json..."
cp "$SOURCE_REPO/opencode.json" "$WORKTREE_PATH/opencode.json"
fi
# IDE/Editor configuration (if detected)
# copy_if_exists ".vscode"
# copy_if_exists ".idea"
# Run package manager install commands
cd "$WORKTREE_PATH"
# (Include detected package manager commands)
echo "Worktree setup complete!"
Ensure the script:
Create output directory:
.autospec/scripts/ directory exists.autospec/scripts/setup-worktree.shReport results:
--include-env was used, warn about security implicationsThe generated script MUST be written to: .autospec/scripts/setup-worktree.sh
autospec worktree create command