typescript-typecheck-fallback
Fungsinya
Skill ini menjelaskan cara memeriksa kode TypeScript dalam dua langkah, dengan cadangan jika percobaan pertama gagal. Skill ini ditujukan untuk pengembang yang memeriksa TypeScript sebagai bagian dari build atau tinjauan.
Kapan dipakai
- βSaat Anda telah mengubah file TypeScript dan ingin memastikan tidak ada error tipe.
- βSaat perintah pemeriksaan tipe kehabisan waktu atau mengembalikan error yang tidak jelas.
- βSaat Anda menginginkan pemeriksaan yang berjalan sebagai bagian dari tinjauan sebelum selesai.
Link skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-typecheck-fallback/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βBisakah Anda menjalankan pemeriksaan tipe pada file TypeScript saya dan memberi tahu saya tentang error yang ada?β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent pertama-tama mencoba pemeriksaan cepat. Jika itu gagal dengan cara yang tidak jelas, agent menyerahkan pemeriksaan kepada helper cadangan yang dapat mengatasi masalah tersebut.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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 |
Pertanyaan umum
Bagaimana jika pemeriksaan cepat berhasil?
Maka agent selesai, dan error yang dilaporkannya adalah masalah nyata yang harus diperbaiki.
Bisakah cadangan mengubah kode saya?
Pemeriksaan itu sendiri hanya melaporkan error. Perbaikan adalah langkah terpisah.
Mengapa ada cadangan?
Beberapa lingkungan memiliki timeout atau masalah path yang menghentikan pemeriksaan cepat untuk berjalan.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 7.8k
- Peringkat
- #13086
- Lisensi
- MIT
- Diperbarui
- 1/11/2026
Komentar
- β¦
Skill lain dari repositori ini
agentpilot
7.8kMembantu agent Anda meningkatkan proyek langkah demi langkah dengan menyiapkan tugas dan menjalankan loop AgentPilot yang mengusulkan, menguji, dan memberi skor pada perubahan.
openspace
7.8kMembantu agent Anda menyiapkan OpenSpace, alat yang menyimpan dan mengambil skill agent, lalu menghubungkannya ke aplikasi AI Anda melalui MCP.
rsi-arena
7.8kMembantu agent Anda menyiapkan dan menjalankan tes benchmark AI standar, seperti AIME dan Terminal-Bench, untuk membandingkan berbagai metode perbaikan.
experiment-guide
7.8kMembantu agent Anda merencanakan eksperimen kecil, membaca hasilnya, dan mencatat temuan saat menyelidiki cara memperbaiki sebuah program.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.