add-puzzle-type
정보
이 Claude Skill은 jigsawR 패키지의 10개 이상의 모든 통합 지점에 걸쳐 새로운 퍼즐 유형의 기본 구조를 구축합니다. 핵심 모듈 생성, 파이프라인 연결, ggplot 레이어, 설정 업데이트, Shiny 앱 확장, 테스트 스위트 구축을 자동화합니다. 완전히 새로운 퍼즐 유형을 추가할 때 통합 단계가 누락되지 않도록 보장하기 위해 사용하세요.
빠른 설치
Claude Code
추천npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/add-puzzle-typeClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
Add Puzzle Type
Scaffold new puzzle type across pipeline integration points jigsawR.
Use When
- Add new puzzle type to pkg
- Follow 10-point pipeline checklist (CLAUDE.md)
- Nothing missed wiring new type end-to-end
In
- Required: New type name (lowercase, e.g.
"triangular") - Required: Geometry desc (piece shape/arrangement)
- Required: Needs external pkgs? (Suggests)
- Optional: Params beyond standard (grid, size, seed, tabsize, offset)
- Optional: Ref impl or algo source
Do
Step 1: Core Puzzle Module
Create R/<type>_puzzle.R:
#' Generate <type> puzzle pieces (internal)
#' @noRd
generate_<type>_pieces_internal <- function(params, seed) {
# 1. Initialize RNG state
# 2. Generate piece geometries
# 3. Build edge paths (SVG path data)
# 4. Compute adjacency
# 5. Return list: pieces, edges, adjacency, metadata
}
Follow pattern R/voronoi_puzzle.R or R/snic_puzzle.R.
→ Fn returns list: $pieces, $edges, $adjacency, $metadata.
If err: Compare return structure against generate_voronoi_pieces_internal() → missing elements or wrong types.
Step 2: Wire jigsawR_clean.R
Edit R/jigsawR_clean.R:
- Add
"<type>"tovalid_types - Type-specific param extraction
- Valid. logic type-specific constraints
- Filename prefix mapping (e.g.,
"<type>"->"<type>_")
# In valid_types
valid_types <- c("rectangular", "hexagonal", "concentric", "voronoi", "snic", "<type>")
→ generate_puzzle(type = "<type>") accepted, no "unknown type" err.
If err: Verify type string in valid_types exact, param extraction covers required type-specific args.
Step 3: Wire unified_piece_generation.R
Edit R/unified_piece_generation.R:
- Dispatch case
generate_pieces_internal() - Fusion handling if PILES notation
# In the switch/dispatch
"<type>" = generate_<type>_pieces_internal(params, seed)
→ Pieces generated on dispatch.
If err: Confirm dispatch string exact, generate_<type>_pieces_internal defined + exported.
Step 4: Wire piece_positioning.R
Edit R/piece_positioning.R:
Add positioning dispatch. Most use shared, some need custom.
→ apply_piece_positioning() handles new type no err, pieces at correct coords.
If err: Check if needs custom or reuse shared path. Add dispatch if default no apply.
Step 5: Wire unified_renderer.R
Edit R/unified_renderer.R:
- Render case
render_puzzle_svg() - Edge path fn:
get_<type>_edge_paths() - Piece name fn:
get_<type>_piece_name()
→ SVG out generated new type, correct outlines + edge paths.
If err: Verify get_<type>_edge_paths() returns valid SVG path, get_<type>_piece_name() unique IDs.
Step 6: Wire adjacency_api.R
Edit R/adjacency_api.R:
Neighbor dispatch → get_neighbors() + get_adjacency() work.
→ get_neighbors(result, piece_id) returns correct neighbors.
If err: Check dispatch returns correct structure. Test small grid, manually verify against geometry.
Step 7: ggpuzzle Geom Layer
Edit R/geom_puzzle.R:
geom_puzzle_<type>() using make_puzzle_layer():
#' @export
geom_puzzle_<type> <- function(mapping = NULL, data = NULL, ...) {
make_puzzle_layer(type = "<type>", mapping = mapping, data = data, ...)
}
→ ggplot() + geom_puzzle_<type>(aes(...)) renders no err.
If err: Verify make_puzzle_layer() correct type, geom exported via @export.
Step 8: Stat Dispatch
Edit R/stat_puzzle.R:
- Type-specific default params
- Dispatch case
compute_panel()
→ Stat layer computes geometry, produces expected polygons.
If err: compute_panel() dispatch returns df w/ x, y, group, piece_id, defaults sensible.
Step 9: DESCRIPTION
Edit DESCRIPTION:
- New type in Description text
- New pkgs →
Suggests: Collate:include new R file (alphabetical)
→ devtools::document() succeeds. No NOTE unlisted files.
If err: New R file in Collate: alphabetical, new Suggests pkgs spelled correct w/ ver constraints.
Step 10: config.yml
Edit inst/config.yml:
Defaults + constraints:
<type>:
grid:
default: [3, 3]
min: [2, 2]
max: [20, 20]
size:
default: [300, 300]
min: [100, 100]
max: [2000, 2000]
tabsize:
default: 20
min: 5
max: 50
# Add type-specific params here
→ Config valid YAML. Defaults → working puzzle via generate_puzzle().
If err: Validate yaml::yaml.load_file("inst/config.yml"). Defaults sensible (not too small/large).
Step 11: Shiny App
Edit inst/shiny-app/app.R:
- Add type → UI selector
- Conditional UI panels type-specific params
- Server-side generation
→ Shiny shows new type, generates on select.
If err: Type in choices of selector, conditional panel conditionalPanel(condition = "input.type == '<type>'"), server passes correct params.
Step 12: Test Suite
Create tests/testthat/test-<type>-puzzles.R:
test_that("<type> puzzle generates correct piece count", { ... })
test_that("<type> puzzle respects seed reproducibility", { ... })
test_that("<type> adjacency returns valid neighbors", { ... })
test_that("<type> fusion merges pieces correctly", { ... })
test_that("<type> geom layer renders without error", { ... })
test_that("<type> SVG output is well-formed", { ... })
test_that("<type> config constraints are enforced", { ... })
External dep → skip_if_not_installed().
→ All pass. No skips unless dep missing.
If err: Check each point individually. Common: missing dispatch → grep -rn "switch\|valid_types" R/.
Check
-
generate_puzzle(type = "<type>")produces valid out - All 10 points wired
-
devtools::test()passes new tests -
devtools::check()→ 0 err, 0 warn - Shiny renders new type
- Config constraints enforced (min/max valid.)
- Adjacency + fusion work
- ggpuzzle geom renders no err
-
devtools::document()succeeds (NAMESPACE updated)
Traps
- Missing dispatch: One of 10+ files forgotten → silent fail or "unknown type"
- strsplit neg nums:
paste(a, b, sep = "-")→"1--1". Use"|"+ split"\\|". cat()for out: Alwaysclilogging wrappers (log_info,log_warn, etc.)- Collate order: alphabetical or dep-ordered
- config.yml format: Valid YAML; test
yaml::yaml.load_file("inst/config.yml")
→
generate-puzzle— test new type after scaffoldrun-puzzle-tests— full suite verify integrationvalidate-piles-notation— test fusion w/ new typewrite-testthat-tests— general test patternswrite-roxygen-docs— document new geom fn
GitHub 저장소
연관 스킬
content-collections
메타이 스킬은 콘텐츠 콜렉션(Content Collections)을 위한 프로덕션 검증된 설정을 제공합니다. 콘텐츠 콜렉션은 Markdown/MDX 파일을 Zod 검증이 포함된 타입 안전한 데이터 콜렉션으로 변환해주는 TypeScript 최우선 도구입니다. 블로그, 문서 사이트 또는 콘텐츠 중심의 Vite + React 애플리케이션을 구축할 때 타입 안전성과 자동 콘텐츠 검증을 보장하기 위해 사용하세요. Vite 플러그인 구성과 MDX 컴파일부터 배포 최적화 및 스키마 검증에 이르기까지 모든 것을 다룹니다.
polymarket
메타이 스킬은 개발자들이 Polymarket 예측 시장 플랫폼을 활용한 애플리케이션을 구축할 수 있도록 지원하며, 거래 및 시장 데이터를 위한 API 통합 기능을 포함합니다. 또한 WebSocket을 통한 실시간 데이터 스트리밍을 제공하여 실시간 거래와 시장 활동을 모니터링할 수 있습니다. 이를 통해 거래 전략을 구현하거나 실시간 시장 업데이트를 처리하는 도구를 생성하는 데 활용할 수 있습니다.
creating-opencode-plugins
메타이 스킬은 개발자들이 명령어, 파일, LSP 작업 등 25개 이상의 이벤트 유형에 연결되는 OpenCode 플러그인을 만들 수 있도록 돕습니다. JavaScript/TypeScript 모듈을 위한 플러그인 구조, 이벤트 API 명세, 구현 패턴을 제공합니다. OpenCode AI 어시스턴트의 라이프사이클을 사용자 정의 이벤트 기반 로직으로 가로채거나, 모니터링하거나, 확장해야 할 때 사용하세요.
sglang
메타SGLang은 RadixAttention 프리픽스 캐싱을 활용하여 JSON, 정규식, 에이전트 워크플로우를 위한 고속 구조화 생성에 특화된 고성능 LLM 서빙 프레임워크입니다. 특히 반복되는 프리픽스가 있는 작업에서 상당히 빠른 추론 속도를 제공하여 복잡한 구조화 출력 및 다중 턴 대화에 이상적입니다. 제약 디코딩이 필요하거나 광범위한 프리픽스 공유가 있는 애플리케이션을 구축할 때는 vLLM과 같은 대안보다 SGLang을 선택하십시오.
