| name | env-deploy-for-trae |
| description | Use in Trae when asked to automatically deploy a local or cloned Linux code project's runtime environment, including project detection, dependency planning, optional command execution, build, unit-test verification, reproducible setup script generation, deployment logging, and final reporting. Supports C++, Python, Go, Java, and Docker projects. Must pause for driver conflicts, unresolved test failures, credentials, and ambiguous project or build-tool choices. |
| metadata | {"version":"1.0.0","category":"devops","tags":["trae","environment","deployment","automation"],"compatibility":["trae"]} |
env-deploy-for-trae
Use this Skill in Trae to deploy a project's Linux runtime environment and produce reproducible artifacts. Prefer the bundled scripts for repeatable detection, dry-run planning, optional execution, logging, setup.sh generation, and deployment reporting.
Trae Usage
- Install or copy this directory to
.trae/skills/env-deploy-for-trae/ when using workspace-local Trae Skills.
- You can also reference this repository-local folder directly as context while iterating on the Skill.
- Before deployment, let Trae finish building the project index so
#Workspace and #Folder references are reliable.
- Use Trae context tools intentionally:
#File for build files such as pyproject.toml, go.mod, pom.xml, Dockerfile, or CMakeLists.txt.
#Folder for project roots, tests/, deployment docs, or component directories.
#Workspace when identifying a new repository's structure.
Scope
Use this Skill for Linux projects that are C++, Python, Go, Java, Docker, or a clear combination of those types. Do not use it for Windows, macOS, remote SSH deployment, conda-based environment management, unsupported project types, or running C++/Python/Go/Java deployment inside Docker unless the user explicitly changes scope.
Resolve Skill Directory
Before running scripts, resolve the Skill directory:
if [ -n "${TRAE_SKILL_ROOT:-}" ]; then
SKILL_DIR="$TRAE_SKILL_ROOT"
elif [ -f "skills/env-deploy-for-trae/SKILL.md" ]; then
SKILL_DIR="$PWD/skills/env-deploy-for-trae"
elif [ -f ".trae/skill/env-deploy-for-trae/SKILL.md" ]; then
SKILL_DIR="$PWD/.trae/skill/env-deploy-for-trae"
elif [ -f ".trae/skills/env-deploy-for-trae/SKILL.md" ]; then
SKILL_DIR="$PWD/.trae/skills/env-deploy-for-trae"
elif [ -f "$HOME/.trae/skills/env-deploy-for-trae/SKILL.md" ]; then
SKILL_DIR="$HOME/.trae/skills/env-deploy-for-trae"
elif [ -f "$HOME/.trae/skills/env_deploy_for_trae/SKILL.md" ]; then
SKILL_DIR="$HOME/.trae/skills/env_deploy_for_trae"
else
echo "Cannot find env-deploy-for-trae skill directory" >&2
exit 1
fi
Use "$SKILL_DIR/scripts/env_deploy.py" and "$SKILL_DIR/scripts/detect_project.py" after this.
Core Workflow
-
Initialize planning files
- For multi-step deployment, create or update
task_plan.md, findings.md, and progress.md in the active workspace.
- Capture the target project path, source type, dry-run/apply mode, confirmation gates, and known constraints.
-
Confirm project source
- For a local absolute path, work in that project directly.
- For a Git URL, let automation clone only when
--apply is provided.
- If source location is missing or inaccessible, ask the user for the project path or repository URL.
-
Run automated detection
python3 "$SKILL_DIR/scripts/detect_project.py" /path/to/project --pretty
If output reports ambiguous project type or Java build tool ambiguity, ask the user unless the prompt already gives the choice.
-
Plan deployment
python3 "$SKILL_DIR/scripts/env_deploy.py" --project /path/to/project
Dry-run is the default. It plans commands and writes deploy.log, setup.sh, and deploy-report.md to the target project root.
-
Apply deployment when appropriate
python3 "$SKILL_DIR/scripts/env_deploy.py" --project /path/to/project --apply
Add --install-system-packages only after reviewing package-manager commands. Use --component-type and --java-tool to resolve ambiguity explicitly.
-
Handle failures and pause points
- For missing tools, dependency failures, or test failures, inspect
deploy.log and use references/safety-and-interaction.md.
- Try one narrow environment fix when safe.
- Pause for user confirmation when the rule says to pause.
-
Deliver artifacts
- Confirm the target project contains , , and .
Automation Commands
python3 "$SKILL_DIR/scripts/detect_project.py" /path/to/project --pretty
python3 "$SKILL_DIR/scripts/env_deploy.py" --project /path/to/project
python3 "$SKILL_DIR/scripts/env_deploy.py" --project /path/to/project --apply
python3 "$SKILL_DIR/scripts/env_deploy.py" --project /path/to/project --apply --install-system-packages
python3 "$SKILL_DIR/scripts/env_deploy.py" --project /path/to/project --component-type python --apply
python3 "$SKILL_DIR/scripts/env_deploy.py" --project /path/to/project --component-type java --java-tool maven --apply
Required Pause Points
Pause and ask the user before proceeding when:
- Driver or system-level component versions conflict and cannot safely coexist.
- Unit tests fail and the failure cannot be automatically repaired with a narrow environment fix.
- Project type detection is ambiguous.
- A Java project contains both Maven and Gradle markers and no clear preference.
- A credential, token, private package repository setting, or manual runtime installation is missing.
When pausing, show the current state, requested state, risk or impact, and available choices. Continue only after an explicit user decision.
Reference Loading
- Read
references/automation.md before using or extending bundled scripts.
- Read
references/project-detection.md when interpreting project type, build tool, or unit-test triggers.
- Read
references/dependency-and-runtime.md before installing dependencies, drivers, language runtimes, or Docker.
- Read
references/safety-and-interaction.md before high-risk changes or unresolved failures.
- Read
references/outputs.md before reviewing deploy.log, setup.sh, or the final report.
Output Discipline
Generated deployment artifacts go in the target project root, not in the Skill directory. The generated setup.sh must contain only repeatable commands. Redact credentials from logs, reports, planning files, and final answers.