typescript-compile-check-resilient-fallback
Fungsinya
Skill ini menjelaskan cara memeriksa kode TypeScript untuk error saat perintah biasa rusak. Skill ini menjelaskan jalur cadangan dan cara membedakan error kode yang sebenarnya dari masalah pengaturan. Skill ini ditujukan untuk pengembang yang bekerja pada proyek TypeScript.
Kapan dipakai
- βSaat perintah pemeriksaan TypeScript biasa mengembalikan error yang bukan tentang kode Anda.
- βSaat Anda perlu mengetahui apakah perubahan Anda dapat dikompilasi sebelum selesai.
- βSaat Anda ingin memisahkan error tipe yang sebenarnya dari masalah alat atau lingkungan.
Link skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-compile-check-resilient-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 memeriksa bahwa perubahan TypeScript saya dapat dikompilasi, meskipun perintah pemeriksaan biasa tidak berfungsi?β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent pertama-tama menjalankan pemeriksaan standar. Jika alatnya sendiri gagal, agent memakai metode cadangan, lalu memisahkan error kode yang nyata dari masalah pengaturan.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
TypeScript Compile-Check Resilient Fallback
Use this workflow whenever you need to verify that TypeScript files compile
cleanly after creating or modifying them, especially in environments where
npx or direct ./node_modules/.bin/tsc invocations may return unexpected
errors.
Step 1 β Attempt Primary Invocation
Run the compile check with run_shell using the standard approach:
npx tsc --noEmit
or, if you already know the project root:
./node_modules/.bin/tsc --noEmit
Evaluate the result:
- If it exits cleanly (exit code 0, no unexpected output) β done.
- If it exits with TypeScript diagnostic errors β proceed to Step 3.
- If it exits with an unknown / tool-level error (e.g.,
npxnot found, permission denied, spawn error, unclear non-zero exit unrelated to TS diagnostics) β proceed to Step 2.
Step 2 β Fallback via shell_agent
When the primary invocation fails with an unknown error, delegate to
shell_agent so it can resolve environment issues automatically:
Task: "From the project directory
<PROJECT_DIR>, runnode node_modules/typescript/bin/tsc --noEmitand report all TypeScript diagnostic errors."
Example shell_agent task string:
From /path/to/project, run:
node node_modules/typescript/bin/tsc --noEmit
Capture the full stdout/stderr output and return it.
shell_agent will handle PATH issues, working-directory changes, and
retry on transient failures automatically.
Step 3 β Filter Pre-Existing Errors
TypeScript projects frequently have pre-existing errors in files you did not touch. To avoid false regressions:
- Identify the baseline error count for the project (e.g., determined at task start or documented in task context). A common baseline is 11 pre-existing errors in unrelated files.
- Collect the full diagnostic list from tsc output.
- Filter to keep only errors whose file path matches a file you created or modified in this task.
- Evaluate:
- Zero errors in your new/modified files β β no regression introduced.
- One or more errors in your new/modified files β β fix them before proceeding.
Filtering heuristic (pseudocode)
all_errors = parse_tsc_output(tsc_stdout)
my_files = [list of files created/modified in this task]
new_errors = [e for e in all_errors if e.file in my_files]
if len(new_errors) == 0:
print("β
No new TypeScript errors introduced.")
else:
for err in new_errors:
print(f"β {err.file}:{err.line} β {err.message}")
raise Exception("Fix TypeScript errors before continuing.")
Step 4 β Fix and Re-Run
If new errors are found:
- Fix the errors in your file(s).
- Repeat from Step 1.
Decision Tree Summary
run_shell: npx tsc --noEmit
β
ββ clean exit βββββββββββββββββββββββββββββββΊ β
Done
β
ββ TS diagnostic errors βββββββββββββββββββββΊ Step 3 (filter)
β
ββ unknown/tool error
β
ββ shell_agent: node .../tsc --noEmit
β
ββ TS diagnostic errors βββββΊ Step 3 (filter)
ββ clean exit βββββββββββββββΊ β
Done
Notes
- Always run tsc from the project root (where
tsconfig.jsonlives). - The
node node_modules/typescript/bin/tscinvocation is the most portable fallback because it bypassesnpx, shell PATH lookups, and binary permission issues entirely. - When the baseline error count is unknown, run tsc before making any changes and record the count; that becomes your baseline.
- Only report/act on errors in files you own; never attempt to fix pre-existing errors in third-party or unrelated project files unless explicitly asked.
Pertanyaan umum
Apa cadangannya?
Jika perintah biasa gagal karena alasan yang tidak terkait kode, agent meminta pembantu menjalankan pemeriksaan dengan cara lain.
Bagaimana agent tahu error itu nyata?
Error nyata disertai pesan diagnostik TypeScript, sedangkan kegagalan alat tidak.
Apakah ini mengubah kode saya?
Tidak. Pemeriksaan hanya membaca kode dan melaporkan error.
Detail
Deskripsi asli dari pembuat
A resilient workflow for running TypeScript compile checks (tsc --noEmit) that falls back gracefully when npx or direct binary invocations fail, and distinguishes pre-existing errors from newly introduced ones.
repo: HKUDS/AgentPilot
Popularitas
- Bintang GitHub
- 7.8k
- Peringkat
- #13083
- 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.