Agent skill
splitting-cards
카드 분할 로직, LLM 기반 Split, nid 승계 전략, 텍스트 파서, 비용 추정, 배치 분할 등 카드 분할의 모든 측면을 다룬다. Triggers: "Split 결과가 이상해", "파서 버그", "분할 미리보기", "nid 승계", "Cloze 번호 리셋", "컨테이너 파서", "카드 분할", "atomic card", "분할 비용", "split cost", "배치 분할", "batch split", "분할 적용", "split apply", "분할 검증", "스타일 보존". Covers Split logic, nid inheritance strategy, text parsers, cost estimation, batch split, and split validation.
Install this agent skill to your Project
npx add-skill https://github.com/greenheadHQ/awesome-anki/tree/main/.claude/skills/splitting-cards
SKILL.md
카드 분할
분할 전략 개요
멀티 LLM(Gemini/OpenAI) 기반 단일 분할 모드. Cloze가 3개 초과인 정보 밀도 높은 카드를 원자적 단위로 분할.
| 조건 | 방식 | 비용 |
|---|---|---|
| Cloze > 3개 | LLM API (Gemini or OpenAI) | API 호출 |
Split
- 선택된 LLM 모델에 분할 제안 요청 (기본: gemini-3-flash-preview)
- 현재 5개 후보만 분석 (API 비용 고려)
- "분석 요청" 버튼 클릭 시에만 API 호출 (자동 호출 방지 -- 비용 발생 사전 고지)
- 프롬프트 버전 선택 가능 --
managing-prompts스킬 참조 - 모델 선택: 클라이언트에서
provider/model파라미터로 지정 가능, 미지정 시 서버 기본값 사용
비용 추정 (estimateSplitCost())
분할 전 예상 비용 계산:
- 입력 토큰:
countTokens(systemPrompt + userPrompt)로 실제 프롬프트 기반 계산 - 출력 토큰:
입력 * ESTIMATED_OUTPUT_INPUT_RATIO(0.7), 상한SPLIT_MAX_OUTPUT_TOKENS(8192) - worst-case: 출력이 maxOutputTokens까지 나오는 경우의 비용 (예산 검사용)
checkBudget(): 서버 예산 상한 + 클라이언트 예산을 비교
배치 분할 (requestBatchCardSplit())
다수 카드를 한번에 분할:
BATCH_SIZE = 10: 배치당 10개 카드 병렬 처리 (Promise.allSettled)DELAY_MS = 1000: 배치 간 1초 딜레이 (rate limit 대응)onProgress콜백으로 진행 상황 보고- 개별 카드 실패 시 건너뛰고 나머지 계속 처리
프롬프트 빌더 (packages/core/src/gemini/prompts.ts)
| 함수 | 용도 |
|---|---|
buildSplitPrompt(noteId, text) |
기본 분할 프롬프트 생성 |
buildSplitPromptFromTemplate(template, noteId, text, tags) |
버전별 템플릿 변수 치환 ({{noteId}}, {{text}}, {{tags}}) |
buildAnalysisPrompt(noteId, text) |
분할 필요성 분석 전용 프롬프트 |
nid 승계 전략
- 메인 카드 (
mainCardIndex):updateNoteFields로 기존 nid 유지 - 서브 카드:
addSplitCards()로 새 nid 생성 + 원본으로의 역링크 삽입 (addNotes는 내부 구현) - 기존 nid 링크가 깨지지 않도록 보장
Cloze 번호 처리
- 결정: 분할 후 모든 카드는
{{c1::}}로 리셋 - 이유: 1 Note = 1 Atomic Card 원칙
파서 모듈 (packages/core/src/parser/)
| 파서 | 역할 | 패턴 |
|---|---|---|
| container-parser | ::: type [title] 구문 |
상태 머신 (스택 기반 depth 추적) |
| nid-parser | [제목|nid{13자리}] 링크 |
NID_LINK_REGEX |
| cloze-parser | {{c숫자::내용::힌트?}} |
CLOZE_REGEX |
설계 결정: 컨테이너 파서
- 정규식만으로는 중첩
::: toggle처리 불가 -- 상태 머신 채택 - 스택 기반으로 depth 추적, 중첩된 컨테이너 정확히 파싱
유틸리티
| 파일 | 역할 |
|---|---|
packages/core/src/utils/formatters.ts |
스타일 보존 검증 (validateStylePreservation), HTML 엔티티, 카드 제목 정규화, 이미지 경로 추출 |
packages/core/src/gemini/validator.ts |
zod 스키마 검증 (validateSplitResponse), Cloze 존재 검증, 스타일 보존 검증 |
분할 제외 규칙
::: toggle todo블록은 분할 대상에서 제외 (미완성 상태)- purple 플래그 카드도 주의 필요
스타일 보존
반드시 보존해야 하는 HTML 태그:
<span style="color:...">,<font color>,<b>,<u>,<sup>formatters.ts의validateStylePreservation(): 원본과 결과의 스타일 비교validator.ts의validateStylePreservation(): 원본과 결과의 HTML 태그 수 비교
자주 발생하는 문제
- 분할 후보 수 불일치: 대시보드와 SplitWorkspace 간 필터링 로직 확인
상세 참조
references/split.md-- LLM 기반 Split 상세, 비용/예산 가드, 배치 분할references/nid-inheritance.md-- mainCardIndex 전략, 역링크 형식references/parsers.md-- container/nid/cloze 파서 타입 정의references/troubleshooting.md-- 파서 설계 시행착오
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
validating-cards
USE THIS SKILL for card content validation — fact-checking, freshness, similarity, context consistency, or anything about duplicate detection and card quality. Triggers: "팩트 체크 결과가", "유사한 카드 찾아줘", "문맥 검증", "검증 캐시", "최신성 검사", "중복 카드", "검증 상태 아이콘", "validate/all", "Jaccard", "임베딩 유사도", "중복 판정", "useValidateCard", "useBatchValidate", "검증 4종", "일괄 검증", "context-checker", "fact-checker", "freshness-checker", "similarity-checker", "findSimilarGroups", "analyzeCardGroup", "검증 폴백". Covers the 4 validation types: fact-check, freshness, similarity, context.
developing-web-ui
React 프론트엔드의 컴포넌트, 훅, 렌더링, 스타일 관련 작업이면 반드시 이 스킬을 먼저 확인할 것. Triggers: "React 컴포넌트 추가", "ContentRenderer 수정", "TanStack Query", "CSS 충돌", "웹 UI 버그", "페이지 추가", "Tailwind 스타일", "렌더링 문제", "shadcn", "shadcn 컴포넌트", "shadcn 마이그레이션", "variant API", "UI 마이그레이션", "마이그레이션", "toast", "sonner", "Toaster", "DiffViewer", "ContentPreview", "BottomSheet", "CompactSelector", "markdown 렌더링", "모바일 반응형", "useMediaQuery", "useIsMobile", "훅 추가", "query hook", "캐시 무효화", "staleTime", "분할 미리보기 UI", "분할 반려 UI", "카드 브라우저", "어려운 카드". Covers the React frontend, components, hooks, query patterns, rendering pipeline, and UI troubleshooting.
managing-embeddings
USE THIS SKILL for anything related to embeddings, vector similarity, or semantic search. Triggers: "임베딩 생성", "코사인 유사도", "캐시 어디에", "임베딩 상태", "의미 유사도", "text-embedding-3-large", "openai embedding", "벡터 차원", "3072", "임베딩 캐시", "embedding 마이그레이션", "레거시 캐시", "embedding fallback", "유사도 검사 임베딩 모드", "임베딩 배치", "rate limit 429". Covers OpenAI embedding API, file-based cache with migration, and text preprocessing.
understanding-project
프로젝트 구조, 아키텍처, 기술 스택, 패키지 역할 등 전반적인 이해가 필요할 때 사용. 코드가 어디에 있는지, 패키지 간 의존성이 어떤지, 왜 이 구조인지 궁금하면 이 스킬. Triggers: "모노레포 구조가 어떻게 돼", "기술 스택", "export 충돌", "패키지 간 의존성", "프로젝트 구조", "어떤 패키지에 있어", "파일 어디에 있어", "아키텍처", "디렉터리 구조", "코드 위치", "모듈 역할", "어떤 기술 쓰고 있어", "스택", "의존성". Covers the monorepo architecture, package roles, tech stack, and coding conventions.
managing-llm
LLM 추상화 계층, 프로바이더 어댑터, 가격표, 예산 가드 등 LLM 관련 작업이면 무조건 이 스킬. 모델 변경, 프로바이더 추가, 비용 계산, 토큰 카운트 등 모든 LLM 인프라를 다룬다. Triggers: "LLM 모델 변경", "프로바이더 추가", "비용 추정", "예산 가드", "pricing table", "모델 비교", "LLM 비용", "토큰 사용량", "모델 추가", "LLM 설정", "Gemini", "OpenAI", "API key", "model pricing", "budget cap", "token count", "adapter", "factory".
working-with-anki
AnkiConnect 연결, 카드/덱/모델 조회, 학습 데이터 복제, 백업/롤백, 어려운 카드 탐지, 커스텀 config 액션 등 Anki와의 모든 상호작용을 다룬다. Triggers: "AnkiConnect 연결", "test 프로필", "ease factor 복제", "카드 정보 조회", "학습 데이터", "AnkiConnect API", "Anki 프로필", "카드 모델", "어려운 카드", "난이도 탐지", "difficulty", "백업", "롤백", "분할 적용", "scheduling", "스케줄링", "getConfig", "setConfig", "커스텀 액션". Covers AnkiConnect API wrapper, scheduling clone, backup/rollback, difficulty detection, and custom config actions.
Didn't find tool you were looking for?