k-skill/examples
설코딩 -SeolCoding 4ba9876a57
feat: 국가데이터처 KOSIS 통계 조회(kosis-stats) 스킬 추가 (#216)
* feat: 국가데이터처 KOSIS 통계 조회(kosis-stats) 스킬 추가

KOSIS Open API 4개 endpoint(statisticsSearch / statisticsData getMeta /
statisticsParameterData / statisticsBigData) read-only 호출을 단일 Python
helper로 묶었다. 인증키는 KSKILL_KOSIS_API_KEY 환경변수(또는 기본
secrets.env)로 사용자별 발급한다 — proxy 미사용.

- kosis-stats/SKILL.md, scripts/run_kosis_stats.py: stdlib only,
  search/meta/data/bigdata 서브커맨드, --json/--text/--dry-run
- kosis-stats/references/kosis-openapi-guide.md: 인증키 발급, 호출 한도
  (분당 1000건/40k cells), 에러 코드, HTTPS 전용 정책 정리
- kosis-stats/tests/: stdlib unittest 36개, mock 기반 (네트워크 X) +
  KSKILL_KOSIS_API_KEY 가 있을 때만 도는 라이브 smoke 1개
- docs/features/kosis-stats.md, README, install/setup/security-and-secrets/
  sources, examples/secrets.env.example, package.json lint/test 등록

* fix(kosis-stats): 사용자 시나리오 e2e 검증 기반 UX 보강

4개 sonnet 서브에이전트 병렬 시나리오(단일수치/시계열/지역비교/실패회복)
검증에서 발견된 P1/P2 UX 부족함 보강. 4개 회복 시나리오 친절도 평균 2.75
→ 4.5 (S4c 코드 20 막힘 P1 해결).

- ERROR_CODE_HINTS: 코드 20/21/30/31 모두 next-step 명령 예시 포함
  (코드 20은 ITM 메타 우선 안내 — 실제 표 다수에서 OBJ 비어 있음)
- render_search_text: Next 액션 흐름 안내 추가
- render_meta_text: 빈 결과 시 다른 --meta-type 시도 안내
- render_data_text: 빈 결과 시 필터/meta 재확인 안내,
  새 [summary] 라인(rows/period/unit, UNIT_NM 누락 명시)
- SKILL.md Workflow: 코드 20 회복 절차, 행정구역 코드(시도 2자리/시군구
  5자리) 관례 명시
- SKILL.md Failure modes: 코드 20 추가, meta 30 분기, UNIT_NM 누락 처리,
  코드 20/31 회복 시나리오 예시
- docs/features/kosis-stats.md "흔한 문제 해결"에 코드 20 회복 절차 추가
- tests: 8개 회귀 테스트 추가 (hint 키워드/render 메시지/[summary] 라인)

* fix(kosis-stats): drop xls bigdata format and detect json error envelope in non-json formats

Reviewer follow-up on PR #216:

- Removes `xls` from bigdata --format choices. KOSIS returns xls as a
  binary Excel payload, but the helper streams text-only output, which
  would corrupt the file. json/sdmx/csv (text) remain supported.
- Detects KOSIS `{err, errMsg}` envelopes even when --format is csv/sdmx,
  so non-json bigdata responses surface auth/limit errors instead of
  printing a misleading error envelope as raw success output.
- Updates SKILL.md, references/kosis-openapi-guide.md, and
  docs/features/kosis-stats.md so the advertised contract matches the
  helper's actual capabilities.
- Adds 3 unit tests: xls rejection, json error envelope detection in csv
  mode, and clean csv passthrough when no error envelope is present.

---------

Co-authored-by: Jeffrey (Dongkyu) Kim <vkehfdl1@gmail.com>
2026-05-08 23:06:19 +09:00
..
secrets.env.example feat: 국가데이터처 KOSIS 통계 조회(kosis-stats) 스킬 추가 (#216) 2026-05-08 23:06:19 +09:00