跳到正文
cccskills
免费在 GitHub 公开

typescript-typecheck-fallback

Run TypeScript checks that detect type errors without generating files. When shell execution fails because of environment problems or timeouts, switch to shell_agent to locate tools, address setup issues, and report the check results.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Reliably run TypeScript type-checking (npx tsc --noEmit) by using shell_agent as a fallback when run_shell fails due to environment or timeout issues.

查看安装方法

适用场景

  • Check types after changing TypeScript files
  • Recover checks interrupted by environment errors
  • Add type checks to an automated validation workflow
  • Run checks in a newly created project environment

包含的文件(2)

  • SKILL.md5.0 KB
  • .skill_id43 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

TypeScript Type-Check with shell_agent Fallback

When verifying TypeScript compilation as part of a build or validation workflow, run_shell may fail with unknown errors due to shell environment issues, missing PATH entries, timeout constraints, or other transient problems. This skill describes a two-step pattern: attempt the check with run_shell first, then fall back to shell_agent if it fails.


When to Use

  • After creating or modifying TypeScript source files and you need to confirm there are no type errors.
  • As part of a CI-like verification step inside an autonomous workflow.
  • Any time run_shell returns an unexpected or unclear error for a tsc invocation.

Step-by-Step Pattern

Step 1 — Attempt with run_shell (fast path)

Try the direct command first. This is fast and gives immediate output when the environment is well-configured.

run_shell: npx tsc --noEmit

Evaluate the result:

  • ✅ Exit code 0, no errors → Type-check passed. Done.
  • ❌ Exit code non-zero with TypeScript diagnostics → Real type errors exist; surface them and fix.
  • ⚠️ Unknown error, timeout, or no useful output → Proceed to Step 2.

Step 2 — Fall back to shell_agent (reliable path)

When run_shell fails in an ambiguous or environmental way, delegate to shell_agent with a natural-language task. shell_agent can autonomously:

  • Locate the correct npx/tsc binary
  • Retry on transient failures
  • Navigate PATH or permission issues
  • Return a structured summary of any type errors

Task string to pass to shell_agent:

Run `npx tsc --noEmit` in the project root and report all TypeScript type errors found. If there are no errors, confirm the compilation succeeded. If tsc is not available, attempt to install TypeScript locally with `npm install --save-dev typescript` first.

Evaluate the result:

  • ✅ "No errors found" / exit 0 → Type-check passed.
  • ❌ Type errors listed → Collect and fix the reported diagnostics, then re-run.
  • ⚠️ tsconfig.json missing → Ensure the file exists in the project root before re-running.

Decision Flowchart

run_shell("npx tsc --noEmit")
        │
        ├─ success (exit 0) ──────────────────► ✅ PASS
        │
        ├─ type errors reported ──────────────► ❌ Fix errors, retry
        │
        └─ unknown/env error ─────────────────► shell_agent(natural-language task)
                                                        │
                                                        ├─ success ───► ✅ PASS
                                                        └─ errors  ───► ❌ Fix & retry

Example Implementation

# Pseudo-code for an autonomous agent loop

result = run_shell("npx tsc --noEmit", timeout=60)

if result.exit_code == 0:
    print("TypeScript check passed.")

elif result.exit_code != 0 and result.stderr contains "TS\d+":
    # Real TypeScript diagnostics — surface and fix them
    raise TypeScriptError(result.stderr)

else:
    # Ambiguous failure — delegate to shell_agent
    shell_agent(
        task="Run `npx tsc --noEmit` in the project root and report all TypeScript "
             "type errors found. If there are no errors, confirm compilation succeeded. "
             "If tsc is not available, install it first with `npm install --save-dev typescript`."
    )

Tips

  • Always have a tsconfig.json: tsc --noEmit requires a valid config. If none exists, generate one first with npx tsc --init.
  • Set a reasonable timeout: TypeScript compilation on large projects can take 30–120 seconds. Give run_shell at least timeout=90.
  • Scope to changed files when possible: Use --project tsconfig.json or a path glob to limit what tsc checks if only a subset of files changed.
  • Prefer shell_agent for first-time setups: If the project environment is freshly created and dependencies may not be fully installed, start with shell_agent directly to avoid a predictable run_shell failure.

Generalizing Beyond TypeScript

This same fallback pattern applies to any build/lint/type-check command that may be sensitive to shell environment:

ToolPrimary run_shell commandshell_agent fallback task
TypeScriptnpx tsc --noEmit"Run npx tsc --noEmit and report errors"
ESLintnpx eslint src/"Run npx eslint on the src directory and report lint errors"
Python mypypython -m mypy src/"Run mypy on the src directory and report type errors"
Go buildgo build ./..."Run go build and report compilation errors"

The core principle: run_shell for speed; shell_agent for resilience.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Prepare audio stems, the separate parts of a track, for mixing by matching their durations with silence, loops, or crossfades. Verify each generated and processed file before moving to the next production step.

中文简介正在准备中。当前显示英语简介。

  • Match audio parts with different durations
  • Extend drums and melodic parts using suitable methods
  • Check audio specifications before mixing
HKUDS/OpenSpace77572026年8月13日 更新

Produce audio in separate stems, meaning individual instrument tracks, and verify each output as you go. Align track lengths with silence, loops, or crossfades, then apply effects, mix a master, and package the files.

中文简介正在准备中。当前显示英语简介。

  • Align instrument tracks to a reference audio file
  • Choose how to extend tracks that are too short
  • Verify audio properties after generation and effects
HKUDS/OpenSpace77572026年8月13日 更新

Build serverless endpoints that relay external API requests for a dashboard while keeping API keys on the server. Includes Vercel examples for input checks, caching, cross-origin access, and consistent JSON responses.

中文简介正在准备中。当前显示英语简介。

  • Connect a dashboard to external APIs without exposing API keys
  • Create endpoints for stock quotes and news
  • Standardize API responses and error handling
HKUDS/OpenSpace77572026年8月13日 更新

Produce a master track and separate audio parts through a structured Python workflow. Apply filters and reverb, export WAV files with consistent settings, package them in a ZIP archive, and check that the deliverables meet the requested specifications.

中文简介正在准备中。当前显示英语简介。

  • Export a master track with separate audio parts
  • Apply filters and reverb to audio
  • Check duration and format across deliverables
HKUDS/OpenSpace77572026年8月13日 更新

Keep document creation moving when web searches and page retrieval repeatedly fail. The skill preserves the original task, uses the model’s existing knowledge, and clearly identifies information that could not be checked against external sources.

中文简介正在准备中。当前显示英语简介。

  • Continue drafting after repeated web retrieval failures
  • Preserve task requirements during network errors
  • Mark information that could not be externally verified
HKUDS/OpenSpace77572026年8月13日 更新

When Python execution repeatedly fails in execute_code_sandbox, use a file-based alternative: save the script, run it through the shell, and capture results or errors. The guidance covers paths, imports, timeouts, structured output, and optional cleanup.

中文简介正在准备中。当前显示英语简介。

  • Retry Python work through the shell after repeated sandbox failures
  • Run longer tasks with an adjusted timeout
  • Execute Python work that needs multiple files or system utilities
HKUDS/OpenSpace77572026年8月13日 更新

查看 HKUDS 的全部技能

报告此技能的问题