C.W.K.
Stream
Lesson 02 of 10 · published

Schema-first prompting

~14 min · outputs, schema, design

Level 0수련생
0 XP0/100 lessons0/14 achievements
0/120 XP to next level120 XP to go0% complete

프롬프트 전에 output 디자인

가장 깨끗한 프롬프트는 consumer의 데이터 shape 알고 난 다음에 작성됐어. 다음 pipeline step이 {verdict, reason_codes, sla_tier} 기대하면 schema 먼저 쓰고 그걸 만들 프롬프트 써. 작성자 생각엔 helpful한 걸 만들지만 parser가 못 쓰는 흔한 버그 방지.

Schema가 source of truth

  • Schema가 source control에 프롬프트랑 같이 살아.
  • Schema가 프롬프트, validator, consumer (TypeScript type, Python pydantic 등) 사이 공유.
  • Schema 변경이 프롬프트 변경 force — feature, 버그 아니야.
  • Optional field가 explicit, implied X. 모델이 어느 거 omit 가능한지 알아야 해.

Schema에서 프롬프트로

각 field마다 프롬프트가 의미, 허용 값, absence 행동 설명. Schema의 enum이 이름만으로 모델이 학습 못 할 semantics 들고 다니게 두지 마.

Code

Schema → 프롬프트 매핑·markdown
## Output schema (verdict_v3)
- verdict: string, one of [approve, reject, hold]
- reason_codes: array of strings, 1–3 entries from the enum below
- sla_tier: string, one of [silver, gold, platinum]
- notes: string, optional, ≤ 200 chars

## Field semantics
- approve = full approval. reason_codes must include 'ok'.
- reject = denied. reason_codes must include the policy that triggered.
- hold = needs human review. reason_codes must explain what info is missing.
- sla_tier = take from the customer record; do not infer.
- notes = optional human-readable summary; omit if no value to add.

External links

Exercise

현재 output shape inline 박힌 프롬프트 골라. Pydantic이나 Zod schema로 externalize. JSON Schema 생성하고 response_format으로 사용. migration이 surface한 mismatch 하나 메모.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.