typescript-compile-check-resilient
하는 일
이 스킬은 TypeScript 컴파일러를 직접 실행하고, 방금 만들었거나 수정한 파일의 오류만 보여 주는 방법을 설명합니다. 오래된 오류가 있는 큰 TypeScript 프로젝트에서 일하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓프로젝트 환경에서 npx나 TypeScript 명령이 실패할 때.
- ✓프로젝트에 내 변경과 무관한 오래된 타입 오류가 이미 있을 때.
- ✓새로 만든 파일만 깔끔하게 컴파일되는지 확인하고 싶을 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-compile-check-resilient/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“방금 쓴 파일이 컴파일되는지 확인해 주실 수 있나요? 프로젝트의 나머지 오래된 오류는 무시해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 TypeScript 컴파일러를 Node 파일로 직접 실행한 다음, 출력을 걸러 새 파일이나 변경된 파일의 오류만 보여 줍니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
TypeScript Compile-Check (Resilient) with File-Scoped Error Filtering
Use this workflow when you need to validate TypeScript changes in a project but the standard npx tsc or node_modules/.bin/tsc invocations fail due to broken symlinks, missing PATH entries, or environment issues.
When to Use This Skill
npx tscfails with "command not found" or permission errorsnode_modules/.bin/tscsymlink is broken or unresolvable- You need to validate only newly-created or task-specific files without being blocked by pre-existing compile errors in the broader codebase
Step 1 — Invoke tsc Directly via node_modules
Bypass npx and symlinks entirely by calling the TypeScript binary directly:
node_modules/typescript/bin/tsc --noEmit 2>&1; echo EXIT:$?
Why this works: The tsc CLI entry point is a plain Node.js script at node_modules/typescript/bin/tsc. It does not depend on symlinks or PATH resolution. The --noEmit flag checks types without writing output files. Capturing EXIT:$? lets you programmatically detect success (EXIT:0) vs failure (EXIT:1 or higher).
If the project uses a custom tsconfig, specify it explicitly:
node_modules/typescript/bin/tsc --noEmit --project tsconfig.json 2>&1; echo EXIT:$?
Step 2 — Filter Output to Task-Specific Files Only
When a legacy codebase has pre-existing errors, the full tsc output will be noisy and may cause false negatives. Pipe through grep to isolate errors from only the files you created or modified:
node_modules/typescript/bin/tsc --noEmit 2>&1 \
| grep -E "(file-pattern)" ; echo EXIT:${PIPESTATUS[0]}
Examples
Single new file:
node_modules/typescript/bin/tsc --noEmit 2>&1 \
| grep -E "settings-store\.ts"
Multiple new files (pipe-delimited pattern):
node_modules/typescript/bin/tsc --noEmit 2>&1 \
| grep -E "(settings-keys|settings-store|preferences|SettingsModal)"
All files in a specific directory:
node_modules/typescript/bin/tsc --noEmit 2>&1 \
| grep -E "src/features/my-feature/"
Check: no output = no errors in your files (success).
Step 3 — Capture Exit Code Correctly Through a Pipe
When grepping, the shell exit code reflects grep, not tsc. Use ${PIPESTATUS[0]} (bash) to recover the original tsc exit code:
node_modules/typescript/bin/tsc --noEmit 2>&1 \
| grep -E "(my-file-pattern)"; echo "TSC_EXIT:${PIPESTATUS[0]}"
Or store errors explicitly:
TSC_OUTPUT=$(node_modules/typescript/bin/tsc --noEmit 2>&1)
TSC_EXIT=$?
echo "$TSC_OUTPUT" | grep -E "(settings-keys|settings-store|preferences|SettingsModal)"
echo "TSC_EXIT:$TSC_EXIT"
The second approach (storing output in a variable) is the most reliable since $? is captured before the pipe.
Step 4 — Interpret Results
| Condition | Meaning |
|---|---|
TSC_EXIT:0, no grep output |
✅ Full project clean, your files are fine |
TSC_EXIT:1, no grep output |
✅ Your files are fine; pre-existing errors elsewhere (acceptable) |
TSC_EXIT:1, grep output present |
❌ Your files have errors — fix them |
TSC_EXIT:2 |
❌ tsc configuration error (bad tsconfig, missing typescript package) |
Fallback: Verify TypeScript Is Installed
If node_modules/typescript/bin/tsc does not exist:
# Check if typescript is installed
ls node_modules/typescript/bin/tsc 2>/dev/null || echo "TypeScript not installed"
# Install if needed
npm install --save-dev typescript
# or
yarn add --dev typescript
Full Example
# Store full tsc output and exit code
TSC_OUTPUT=$(node_modules/typescript/bin/tsc --noEmit 2>&1)
TSC_EXIT=$?
# Show only errors in newly-created files
NEW_FILE_ERRORS=$(echo "$TSC_OUTPUT" | grep -E "(settings-keys|settings-store|preferences|SettingsModal)")
if [ -z "$NEW_FILE_ERRORS" ]; then
echo "✅ No TypeScript errors in new files (TSC_EXIT:$TSC_EXIT)"
else
echo "❌ TypeScript errors in new files:"
echo "$NEW_FILE_ERRORS"
exit 1
fi
Notes
- This technique is safe for CI and local environments alike.
- The direct
node_modules/typescript/bin/tscpath works on macOS, Linux, and Windows (vianode node_modules/typescript/bin/tscon Windows CMD). - On Windows, replace the bash script with:
node node_modules/typescript/bin/tsc --noEmit - Always prefer
--noEmitfor validation-only checks to avoid side effects.
자주 묻는 질문
컴파일러를 직접 실행하는 이유는 무엇인가요?
일반 명령을 깨뜨릴 수 있는 링크와 명령 경로 문제를 피하기 위해서입니다.
특정 설정 파일을 쓸 수 있나요?
네. 검사가 프로젝트 설정 파일을 가리켜 올바른 옵션을 사용하도록 할 수 있습니다.
검사가 통과했는지 어떻게 알 수 있나요?
명령은 종료 코드를 출력하며, 오류가 없으면 0입니다.
상세 정보
작성자의 원본 설명
TypeScript compile-checking in projects where npx and node_modules/.bin symlinks fail, with a filtering technique to isolate errors from only newly-created or task-specific files — ignoring pre-existing legacy errors.
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #13084
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.