typescript-typecheck-fallback
できること
このスキルは、TypeScriptのコードを確認する2段階の方法を説明します。最初の試行が失敗したときのバックアップも含みます。ビルドやレビューの一部としてTypeScriptを確認する開発者向けです。
使う場面
- ✓TypeScriptのファイルを変更し、型のエラーがないことを確認したいとき。
- ✓型チェックのコマンドがタイムアウトしたり、分かりにくいエラーを返したりするとき。
- ✓作業を終える前に、レビューの一部として確認を実行したいとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-typecheck-fallback/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“TypeScriptのファイルの型チェックを実行して、エラーがあれば教えてもらえますか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、まず手早い確認を試します。その確認が分かりにくい形で失敗したら、問題を回避できるバックアップのヘルパーに確認を任せます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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_shellreturns an unexpected or unclear error for atscinvocation.
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/tscbinary - 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.jsonmissing → 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 --noEmitrequires a valid config. If none exists, generate one first withnpx tsc --init. - Set a reasonable timeout: TypeScript compilation on large projects can take 30–120 seconds. Give
run_shellat leasttimeout=90. - Scope to changed files when possible: Use
--project tsconfig.jsonor a path glob to limit what tsc checks if only a subset of files changed. - Prefer
shell_agentfor first-time setups: If the project environment is freshly created and dependencies may not be fully installed, start withshell_agentdirectly to avoid a predictablerun_shellfailure.
Generalizing Beyond TypeScript
This same fallback pattern applies to any build/lint/type-check command that may be sensitive to shell environment:
| Tool | Primary run_shell command |
shell_agent fallback task |
|---|---|---|
| TypeScript | npx tsc --noEmit |
"Run npx tsc --noEmit and report errors" |
| ESLint | npx eslint src/ |
"Run npx eslint on the src directory and report lint errors" |
| Python mypy | python -m mypy src/ |
"Run mypy on the sr |
よくある質問
手早い確認がうまくいったらどうなりますか?
エージェントの作業は完了です。報告されたエラーは、直すべき本物の問題です。
バックアップがコードを変えることはありますか?
確認はエラーを報告するだけです。修正は別の手順になります。
なぜバックアップがあるのですか?
一部の環境では、タイムアウトやパスの問題で、手早い確認が実行できないことがあるからです。
詳細
作者による元の説明
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.
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #13086
- ライセンス
- MIT
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
agentpilot
7.8kエージェントが、作業を準備し、変更案を提案してテストし、評価するAgentPilotのループを実行することで、プロジェクトを段階的に改善できるよう支援します。
openspace
7.8kエージェントが、スキルを保存し取り出すツールであるOpenSpaceをセットアップし、MCPを通じてAIアプリに接続できるよう支援します。
rsi-arena
7.8kエージェントが、AIMEやTerminal-Benchなどの標準的なAIベンチマークテストをセットアップして実行し、異なる改善方法を比較できるよう支援します。
experiment-guide
7.8kエージェントが、プログラムを改善する方法を調べる間に、小さな実験を計画し、その結果を読み、発見を記録できるよう支援します。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。