plugins/ai-registry/common/workflow-bundle/skills/test-healer/SKILL.md
Use when: (1) "테스트 검증해줘", (2) "테스트 실행하고 고쳐줘", (3) "test heal", (4) after test-generator creates tests, (5) tests are failing and need fixing.
npx skillsauth add onejaejae/skills test-healerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Review, execute, and repair test code to ensure quality and all tests pass.
테스트 품질 보증 전문가로서:
이 스킬은 특정 feature의 테스트 파일을 대상으로 합니다.
research_favorite)tests/services/test_research_favorite_service.py)tests/controllers/test_{feature}_controller.py
tests/services/test_{feature}_service.py
tests/repositories/test_{feature}_repository.py
tests/conftest.py - 전역 fixture 정의tests/utils/helpers.py - assert_success_response, assert_error_responsetests/factories/ - Factory 클래스들tests/CLAUDE.md - 프로젝트 테스트 컨벤션테스트 실행 전 반드시 확인:
export ENV=test # 필수! 없으면 bootstrap.py에서 sys.exit(1) 발생
┌─────────────────┐
│ 1. Review │ 테스트 코드 품질 검토
└────────┬────────┘
▼
┌─────────────────┐
│ 2. Execute │ ENV=test pytest 실행
└────────┬────────┘
▼
┌────┴────┐
│ Pass? │
└────┬────┘
Yes │ No
▼ ▼
┌──────┐ ┌─────────────────┐
│ Done │ │ 3. Analyze │ 실패 원인 분석
└──────┘ └────────┬────────┘
▼
┌───────────────────┐
│ Test code issue? │
└────────┬──────────┘
Yes │ No
▼ ▼
┌─────────────┐ ┌─────────────────┐
│ 4. Repair │ │ Report impl bug │
└──────┬──────┘ └─────────────────┘
│
└──────► (pytest 재실행, 최대 3회)
테스트 코드 품질 검토 체크리스트:
test_{method}_{case})수정 전에 동일 layer의 기존 통과 테스트를 먼저 읽어서 프로젝트 패턴 파악:
# 같은 layer의 다른 테스트 파일 참조
tests/controllers/test_research_favorite_controller.py
tests/services/test_research_favorite_service.py
# 반드시 ENV=test 포함
ENV=test pytest tests/{layer}/test_{feature}_{layer}.py -v
# 실패한 테스트만 재실행
ENV=test pytest tests/{layer}/test_{feature}_{layer}.py -v --ff
# 첫 번째 실패에서 중단
ENV=test pytest tests/{layer}/test_{feature}_{layer}.py -v -x
실패 원인 분류:
@pytest.mark.asyncio 누락 등)1. Factory 메서드 혼동 (Model vs Schema)
# WRONG: Controller 테스트에서 Model 반환
mock_service.get.return_value = ResearchDesignFactory.build() # SQLAlchemy Model
# CORRECT: Controller 테스트는 Response 스키마 필요
mock_service.get.return_value = ResearchDesignFactory.build_response() # Pydantic Schema
2. mock_services fixture 추출 누락
# WRONG: fixture 미정의 상태에서 사용 시 "fixture not found" 에러
def test_get(self, mock_research_design_service): # fixture가 없음!
# CORRECT: mock_services에서 추출하는 fixture 정의
@pytest.fixture
def mock_research_design_service(self, mock_services):
return mock_services["research_design_service"]
3. model_validate에 MagicMock 사용
# WRONG: Service가 model_validate 사용 시 MagicMock은 실패
mock_repo.get.return_value = MagicMock(spec=ResearchDesign)
# CORRECT: 실제 Model 인스턴스 사용
mock_repo.get.return_value = ResearchDesignFactory.build(id=1)
4. assert_success_response datetime 직렬화
# WRONG: model_dump 없이 list 비교 시 datetime 직렬화 불일치
assert_success_response(response=response, expected_data=mock_items)
# CORRECT: model_dump(mode="json")으로 datetime을 ISO string으로 변환
assert_success_response(
response=response,
expected_data=[item.model_dump(mode="json") for item in mock_items],
)
5. PATCH partial update None 전파 실패
# WRONG: Factory 기본값이 None을 덮어씀
mock_updated = ResearchDesignFactory.build() # cohorts에 기본값 들어감
# call_kwargs["cohorts"] is None → FAIL (Factory 기본값이 들어있음)
# CORRECT: 서비스 파라미터 기본값이 None이므로 call_args로 검증
call_kwargs = mock_repo.update.call_args.kwargs
assert call_kwargs["cohorts"] is None # 미전달 필드는 None
6. Async 데코레이터 추가
# Before
async def test_create_success(self, ...):
# After
@pytest.mark.asyncio
async def test_create_success(self, ...):
7. Exception type 수정
# Before - 범용 Exception
with pytest.raises(Exception):
# After - 구체적인 Exception
with pytest.raises(ResearchDesignNotFoundException):
## Test Heal Report: {Feature}
### Review Summary
- Convention 준수: OK / (issues)
- 커버리지: OK / (missing cases)
- Mock 설정: OK / (issues)
### Execution Result
- Total: {n} tests
- Passed: {n}
- Failed: {n}
### Failures Analysis
| Test | Error Type | Root Cause | Action |
|------|------------|------------|--------|
| test_xxx | AssertionError | Factory build() 대신 build_response() 필요 | 수정함 |
| test_yyy | FixtureError | mock_services 추출 fixture 누락 | 수정함 |
### Repairs Made
1. `test_create_success`: Factory.build() → Factory.build_response()
2. `test_get_not_found`: mock_services 추출 fixture 추가
### Implementation Issues (보고)
1. `ResearchService.create`: 반환 타입이 None이 아님 - 확인 필요
### Final Status
All tests passing / {n} tests still failing (구현 코드 수정 필요)
testing
CLAUDE.md 기반 환경 안전 체크. 작업 시작 전에 프로젝트의 안전 규칙, 컨벤션, 환경 설정을 자동 검증하여 CLEAR/WARNING/BLOCKED 상태를 보고한다. /check가 "변경 후 검증"이라면, /pre-flight는 "작업 전 환경 검증"이다. Use PROACTIVELY before starting work, especially after switching branches, pulling changes, or resuming a session. Also use when explicitly asked: "/pre-flight", "프리플라이트", "환경 체크", "작업 전 점검", "안전 체크", "environment check", "pre-flight check", "시작해도 돼?", "환경 괜찮아?", "safety check", "DB 확인", "설정 확인", "config check".
tools
PR 리뷰 워크플로우와 체크리스트를 제공하는 스킬. "PR 리뷰해줘", "코드 리뷰 해줘", "이 PR 봐줘", "review this PR" 등 PR 리뷰 요청 시 사용. GitHub/GitLab PR URL 또는 로컬 브랜치 diff를 기반으로 체계적이고 일관된 리뷰를 수행. 코드 품질, 안정성/보안, 성능, 테스트, 문서화 관점에서 건설적인 피드백 제공.
documentation
PR review comments를 체계적으로 처리하는 skill. Use when: (1) PR에 동료의 리뷰가 달렸을 때, (2) 여러 리뷰를 한 번에 처리하고 싶을 때, (3) 수정 후 commit 링크가 포함된 reply를 자동으로 추가하고 싶을 때
tools
PR diff를 받아 코드 리뷰 자동 요약을 생성하는 스킬. 핵심 변경점을 3줄로 요약하고, 변경 파일별로 what changed / why it matters / risk level을 정리. Use when: "PR 요약", "diff 요약", "PR 변경점 정리", "코드 변경 요약", "summarize PR", "PR summary", "diff summary", "what changed in this PR", "변경점 요약해줘", "PR 핵심 정리", "리뷰 요약"