Execute shell or PowerShell commands in the sandbox
npx skills add https://github.com/testdriverai/testdriverai --skill testdriver:exec
<!-- Generated from exec.mdx. DO NOT EDIT. -->
Execute shell commands (Linux) or PowerShell commands (Windows) in the sandbox environment.
await testdriver.exec(language, code, timeout, silent)
<ParamField path="language" type="string" required>
Language to execute: 'sh' (Shell/Linux) or 'pwsh' (PowerShell/Windows)
</ParamField>
<ParamField path="code" type="string" required>
Code or command to execute
</ParamField>
<ParamField path="timeout" type="number" required>
Timeout in milliseconds
</ParamField>
<ParamField path="silent" type="boolean" default="false">
Suppress output if true
</ParamField>
Promise<string> - Command output
Execute shell commands in the Linux sandbox.
// List files
const files = await testdriver.exec('sh', 'ls -la', 5000);
// Check current directory
const pwd = await testdriver.exec('sh', 'pwd', 5000);
// Run a script
await testdriver.exec('sh', './setup.sh', 60000);
// Create a file
await testdriver.exec('sh', 'echo "Hello World" > test.txt', 5000);
// Read a file
const content = await testdriver.exec('sh', 'cat test.txt', 5000);
// Copy files
await testdriver.exec('sh', 'cp source.txt dest.txt', 5000);
// Delete files
await testdriver.exec('sh', 'rm test.txt', 5000);
Execute PowerShell commands in the Windows sandbox.
// Install npm package globally
await testdriver.exec('pwsh', 'npm install -g http-server', 30000);
// Install via Chocolatey
await testdriver.exec('pwsh', 'choco install firefox -y', 60000);
// Download and run installer
await testdriver.exec('pwsh', `
Invoke-WebRequest -Uri "https://example.com/setup.exe" -OutFile "C:\\setup.exe"
Start-Process -FilePath "C:\\setup.exe" -ArgumentList "/S" -Wait
`, 120000);
// Create a file
await testdriver.exec('pwsh', `
Set-Content -Path "C:\\test.txt" -Value "Hello World"
`, 5000);
// Read a file
const content = await testdriver.exec('pwsh',
'Get-Content -Path "C:\\test.txt"',
5000
);
// Copy files
await testdriver.exec('pwsh',
'Copy-Item -Path "C:\\source.txt" -Destination "C:\\dest.txt"',
5000
);
// Delete files
await testdriver.exec('pwsh',
'Remove-Item -Path "C:\\test.txt"',
5000
);
// List directory
const files = await testdriver.exec('pwsh',
'Get-ChildItem -Path "C:\\Users\\testdriver\\Documents"',
5000
);
// List running processes
const processes = await testdriver.exec('pwsh', 'Get-Process', 5000);
// Start application
await testdriver.exec('pwsh', `
Start-Process "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" -ArgumentList "--start-maximized", "https://example.com"
`, 5000);
// Kill a process
await testdriver.exec('pwsh', 'Stop-Process -Name "chrome" -Force', 5000);
// Wait for process
await testdriver.exec('pwsh', 'Start-Process notepad -Wait', 30000);
// Set environment variable (session)
await testdriver.exec('pwsh', '$env:MY_VAR = "value"', 5000);
// Get environment variable
const value = await testdriver.exec('pwsh', '$env:MY_VAR', 5000);
// Set persistent environment variable
await testdriver.exec('pwsh', `
[Environment]::SetEnvironmentVariable("MY_VAR", "value", "User")
`, 5000);
// Test connectivity
const pingResult = await testdriver.exec('pwsh',
'Test-NetConnection google.com',
10000
);
// Download file
await testdriver.exec('pwsh', `
Invoke-WebRequest -Uri "https://example.com/file.zip" -OutFile "C:\\Downloads\\file.zip"
`, 30000);
// Check if port is open
const portOpen = await testdriver.exec('pwsh',
'Test-NetConnection -ComputerName localhost -Port 3000',
5000
);
Suppress output for background operations:
// Silent installation
await testdriver.exec('pwsh', 'npm install -g some-package', 30000, true);
// Start background process
await testdriver.exec('pwsh', 'Start-Process notepad', 5000, true);
// Run setup script silently
await testdriver.exec('pwsh', '.\\setup.ps1', 60000, true);
<Check>
Use appropriate timeouts
// Quick operations: 5000ms
await testdriver.exec('sh', 'ls -la', 5000);
// Installations: 30000-60000ms
await testdriver.exec('pwsh', 'npm install -g package', 30000);
// Downloads or complex operations: 60000-120000ms
await testdriver.exec('pwsh', 'Install-Module Something', 120000);
</Check>
<Check>
Handle errors gracefully
try {
await testdriver.exec('pwsh', 'Some-Command', 5000);
} catch (error) {
console.error('Command failed:', error.message);
// Fallback or retry logic
}
</Check>
<Check>
Use silent mode for background tasks
// Silent install
await testdriver.exec('pwsh', 'npm install -g tool', 30000, true);
// Background service
await testdriver.exec('pwsh', 'Start-Service MyService', 5000, true);
</Check>
<Warning>
Escape strings properly in PowerShell
Use proper escaping for special characters:
// Use backticks for newlines
await testdriver.exec('pwsh', `
Write-Host "Line 1\`nLine 2"
`, 5000);
// Use single quotes to avoid variable expansion
await testdriver.exec('pwsh',
"Write-Host 'Text with $special chars'",
5000
);
</Warning>
import { beforeAll, afterAll, describe, it } from 'vitest';
import TestDriver from 'testdriverai';
describe('Code Execution', () => {
let testdriver;
beforeAll(async () => {
client = new TestDriver(process.env.TD_API_KEY);
await testdriver.auth();
await testdriver.connect();
});
afterAll(async () => {
await testdriver.disconnect();
});
it('should execute shell commands on Linux', async () => {
// List directory
const files = await testdriver.exec('sh', 'ls -la', 5000);
console.log('Files:', files);
// Create a file
await testdriver.exec('sh', 'echo "Hello World" > test.txt', 5000);
// Read the file
const content = await testdriver.exec('sh', 'cat test.txt', 5000);
expect(content).toContain('Hello World');
});
it('should install and use tools on Windows', async () => {
// Install tool
await testdriver.exec('pwsh', 'npm install -g http-server', 30000, true);
// Create HTML file
await testdriver.exec('pwsh', `
Set-Content -Path "C:\\index.html" -Value "<h1>Test Page</h1>"
`, 5000);
// Start server in background
await testdriver.exec('pwsh', `
Start-Process pwsh -ArgumentList "-Command", "http-server C:\\ -p 8080"
`, 5000, true);
await new Promise(r => setTimeout(r, 3000));
// Launch browser
await testdriver.exec('pwsh', `
Start-Process chrome -ArgumentList "http://localhost:8080"
`, 5000);
await testdriver.focusApplication('Google Chrome');
});
});
focusApplication() - Focus apps before execfind() - Locate elements visuallytype() - Type text into inputsIntegration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.
Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances
Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.
Build and distribute Expo development clients locally or via TestFlight
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.
Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.
Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.
Take testdriverai/testdriver:exec from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm.
Without those the skill loads but fails at the first command.