agentleFS
Ron-daliRon-dali/vibe-coding-rules/safe-terminal-executor/SKILL.md

safe-terminal-executor

Skill4 starsChanged 4 months agoApache-2.0View on GitHub

Safe terminal executor. Triggers when executing HTTP API tests, backend endpoint verification, curl/wget requests. Forces all network commands to be wrapped as Node.js scripts with timeout protection, guaranteed process exit, and log output.

  • Pipes a download into a shell
  • Installs packages

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check if it contains network requests.

    line 50
  2. Very specific:

    Must include: timeout guard, step logs, explicit process.exit

    line 55
  3. Very specific:

    Run node {{pipeline.paths.tests}}test-xxx.cjs, report results.

    line 69
  4. Distinctive:

    Delete one-off scripts after execution.

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Safe Terminal Executor / 安全终端执行器

Core Rule: No Bare Commands — Everything Through Scripts / 核心规则:禁止裸命令——所有操作通过脚本执行

安全包装所有网络请求(curl/wget),强制带超时保护 + 进程退出保证 + 日志输出,防止命令卡死。

Safe wrapper for all network requests (curl/wget). Enforces timeout protection + guaranteed process exit + log output to prevent hung commands.

Command TypeHandling
HTTP API calls (curl/wget)Forbidden to execute directly — generate .cjs script
File ops (mkdir/copy/rm) without networkExecute directly
Node.js scripts (node xxx.cjs)Execute directly
npm/pip installExecute directly, add --no-progress
Commands estimated >30sForbidden — split or generate script
git add/commit/pushExecute directly

Lightweight Fast Track / 轻量快速通道(V2.6)

Commands meeting ALL of the following can run directly — no .cjs script needed / 满足以下全部条件的命令可直接运行,无需生成脚本:

  • Single-line curl/wget with built-in timeout (--connect-timeout N --max-time N) / 单行命令且自带超时参数
  • No pipe (|) or redirect (>) / 无管道或重定向
  • Response expected < 10 lines / 预期响应少于10行
  • NOT writing to a file (no -o or >) / 不写入文件
# ✅ Allowed(自带超时 + 无管道 + 只读)
curl --connect-timeout 5 --max-time 10 https://example.com/api/health

# ❌ Still forbidden(无超时 / 有管道 / 写文件)
curl https://example.com          # missing timeout
curl ... | bash                   # dangerous pipe
curl -o output.txt ...            # writes to file

Why: For quick health checks, generating a full .cjs script adds unnecessary friction. But timeout is non-negotiable. / 快速健康检查不必每次都生成完整脚本,但超时保护不可妥协。

5-Step Workflow

1 — Classify Command Type

Check if it contains network requests. Yes → continue. No → judge per table above.

2 — Generate Test Script

Convert command to .cjs script, store in project {{pipeline.paths.tests}} directory:

  • Naming: {{pipeline.paths.tests}}test-{feature}-{date}.cjs
  • Must include: timeout guard, step logs, explicit process.exit
const TIMEOUT = setTimeout(() => {
  console.error('FAIL: Request timed out');
  process.exit(1);
}, 10000);
console.log('[1/3] Sending request...');

3 — Display Script and Confirm

Show full script, brief explanation, wait for confirmation before execution.

4 — Execute + Report

Run node {{pipeline.paths.tests}}test-xxx.cjs, report results.

5 — Clean Up

Delete one-off scripts after execution. Keep reusable scripts.

POST Request Template

const http = require('http');
const TIMEOUT = setTimeout(() => { console.error('FAIL: Request timed out'); process.exit(1); }, 10000);

const body = JSON.stringify({ /* request params */ });
const options = {
  hostname: '{{pipeline.project.host}}',
  port: {{pipeline.project.port}},
  path: '/your-endpoint',
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) }
};

console.log(`[1/3] POST ${options.hostname}:${options.port}${options.path}`);
const req = http.request(options, res => {
  clearTimeout(TIMEOUT);
  let data = '';
  res.on('data', c => data += c);
  res.on('end', () => {
    console.log(`[3/3] HTTP ${res.statusCode}: ${data.substring(0, 300)}`);
    process.exit(res.statusCode >= 400 ? 1 : 0);
  });
});
req.on('error', e => { clearTimeout(TIMEOUT); console.error(`FAIL: ${e.message}`); process.exit(1); });
req.write(body);
req.end();

GET Request Template

const http = require('http');
const TIMEOUT = setTimeout(() => { console.error('FAIL: Request timed out'); process.exit(1); }, 10000);

const options = {
  hostname: '{{pipeline.project.host}}',
  port: {{pipeline.project.port}},
  path: '/your-endpoint',
  method: 'GET'
};

console.log(`[1/2] GET ${options.hostname}:${options.port}${options.path}`);
const req = http.request(options, res => {
  clearTimeout(TIMEOUT);
  let data = '';
  res.on('data', c => data += c);
  res.on('end', () => {
    console.log(`[2/2] HTTP ${res.statusCode}: ${data.substring(0, 300)}`);
    process.exit(res.statusCode >= 400 ? 1 : 0);
  });
});
req.on('error', e => { clearTimeout(TIMEOUT); console.error(`FAIL: ${e.message}`); process.exit(1); });
req.end();

Division of Labor with web-testing

safe-terminal-executorweb-testing
TestsBackend APIs, CLI commandsWeb UI rendering, DOM, interaction
ToolsNode.js http modulePlaywright + tesseract.js
Outputconsole.log + exit codeScreenshots + DOM assertions + OCR

The two Skills are complementary, not overlapping.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.