본문으로 건너뛰기
Skillpedia
일반 코딩7.8k · #13086

typescript-typecheck-fallback

하는 일

이 스킬은 실패하면 백업이 있는 TypeScript 코드 검사 방법을 두 단계로 설명합니다. 빌드나 검토의 일부로 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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-typecheck-fallback/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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_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:

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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬