add-puzzle-type
정보
이 Claude Skill은 jigsawR의 10개 이상의 통합 포인트로 구성된 전체 파이프라인에 걸쳐 새로운 퍼즐 유형의 포괄적인 스캐폴딩을 자동화합니다. 핵심 모듈을 생성하고, 이를 생성, 렌더링, UI 컴포넌트와 통합하며, 설정 파일과 테스트 파일을 업데이트합니다. 완전히 새로운 퍼즐 유형을 추가할 때 사용하여 어떤 통합 포인트도 누락되지 않도록 보장합니다.
빠른 설치
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 all pipeline integration points in jigsawR.
When Use
- Adding completely new puzzle type to package
- Following established integration checklist (CLAUDE.md 10-point pipeline)
- Ensuring nothing missed when wiring new type end-to-end
Inputs
- Required: New type name (lowercase, e.g.
"triangular") - Required: Geometry description (how pieces shaped/arranged)
- Required: Whether type needs external packages (add to Suggests)
- Optional: Parameter list beyond standard (grid, size, seed, tabsize, offset)
- Optional: Reference implementation or algorithm source
Steps
Step 1: Create Core Puzzle Module
Create R/<type>_puzzle.R with internal generation function:
#' 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 in R/voronoi_puzzle.R or R/snic_puzzle.R for structure.
Got: Function returns list with $pieces, $edges, $adjacency, $metadata.
If fail: Compare return structure against generate_voronoi_pieces_internal() to identify missing list elements or incorrect types.
Step 2: Wire into jigsawR_clean.R
Edit R/jigsawR_clean.R:
- Add
"<type>"tovalid_typesvector - Add type-specific parameter extraction in params section
- Add validation logic for type-specific constraints
- Add filename prefix mapping (e.g.,
"<type>"->"<type>_")
# In valid_types
valid_types <- c("rectangular", "hexagonal", "concentric", "voronoi", "snic", "<type>")
Got: generate_puzzle(type = "<type>") accepted without "unknown type" error.
If fail: Verify type string added to valid_types exactly as spelled, parameter extraction covers all required type-specific arguments.
Step 3: Wire into unified_piece_generation.R
Edit R/unified_piece_generation.R:
- Add dispatch case in
generate_pieces_internal() - Add fusion handling if type supports PILES notation
# In the switch/dispatch
"<type>" = generate_<type>_pieces_internal(params, seed)
Got: Pieces generated when type dispatched.
If fail: Confirm dispatch case string matches type name exactly. generate_<type>_pieces_internal defined and exported from puzzle module.
Step 4: Wire into piece_positioning.R
Edit R/piece_positioning.R:
Add positioning dispatch for new type. Most types use shared positioning logic. Some need custom handling.
Got: apply_piece_positioning() handles new type without errors. Pieces placed at correct coordinates.
If fail: Check whether new type needs custom positioning logic or can reuse shared positioning path. Add dispatch case if default path does not apply.
Step 5: Wire into unified_renderer.R
Edit R/unified_renderer.R:
- Add rendering case in
render_puzzle_svg() - Add edge path function:
get_<type>_edge_paths() - Add piece name function:
get_<type>_piece_name()
Got: SVG output generated for new type with correct piece outlines and edge paths.
If fail: Verify get_<type>_edge_paths() returns valid SVG path data. get_<type>_piece_name() produces unique identifiers for each piece.
Step 6: Wire into adjacency_api.R
Edit R/adjacency_api.R:
Add neighbor dispatch so get_neighbors() and get_adjacency() work for new type.
Got: get_neighbors(result, piece_id) returns correct neighbors for any piece in puzzle.
If fail: Check adjacency dispatch returns correct data structure. Test with small grid and manually verify neighbor relationships against geometry.
Step 7: Add ggpuzzle Geom Layer
Edit R/geom_puzzle.R:
Create geom_puzzle_<type>() using make_puzzle_layer() factory:
#' @export
geom_puzzle_<type> <- function(mapping = NULL, data = NULL, ...) {
make_puzzle_layer(type = "<type>", mapping = mapping, data = data, ...)
}
Got: ggplot() + geom_puzzle_<type>(aes(...)) renders without error.
If fail: Verify make_puzzle_layer() receives correct type string. Geom function exported in NAMESPACE via @export.
Step 8: Add Stat Dispatch
Edit R/stat_puzzle.R:
- Add type-specific default parameters
- Add dispatch case in
compute_panel()
Got: Stat layer computes puzzle geometry correctly. Produces expected number of polygons.
If fail: Check compute_panel() dispatch case returns data frame with required columns (x, y, group, piece_id). Default parameters sensible for new type.
Step 9: Update DESCRIPTION
Edit DESCRIPTION:
- Add new type to Description field text
- Add any new packages to
Suggests:(if external dependency) - Update
Collate:to include new R file (alphabetical order)
Got: devtools::document() succeeds. No NOTE about unlisted files.
If fail: Check new R file listed in Collate: field in alphabetical order. Any new Suggests packages spelled correctly with version constraints.
Step 10: Update config.yml
Edit inst/config.yml:
Add defaults and constraints for new type:
<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
Got: Config valid YAML. Defaults produce working puzzle when used by generate_puzzle().
If fail: Validate YAML with yaml::yaml.load_file("inst/config.yml"). Ensure default grid and size values produce sensible puzzle (not too small or too large).
Step 11: Extend Shiny App
Edit inst/shiny-app/app.R:
- Add new type to UI type selector
- Add conditional UI panels for type-specific parameters
- Add server-side generation logic
Got: Shiny app shows new type in dropdown. Generates puzzles when selected.
If fail: Check type added to choices argument of UI selector. Conditional panel for type-specific parameters uses conditionalPanel(condition = "input.type == '<type>'"). Server-side handler passes correct parameters.
Step 12: Create 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", { ... })
Type requires external package? Wrap tests with skip_if_not_installed().
Got: All tests pass. No skips unless external dependency missing.
If fail: Check each integration point individually. Most common issue: missing dispatch cases — run grep -rn "switch\|valid_types" R/ to find all dispatch locations.
Checks
-
generate_puzzle(type = "<type>")produces valid output - All 10 integration points wired correctly
-
devtools::test()passes with new tests -
devtools::check()returns 0 errors, 0 warnings - Shiny app renders new type
- Config constraints enforced (min/max validation)
- Adjacency and fusion work correctly
- ggpuzzle geom layer renders without error
-
devtools::document()succeeds (NAMESPACE updated)
Pitfalls
- Missing dispatch case: Forgetting one of 10+ files causes silent failure or "unknown type" errors
- strsplit with negative numbers: Creating adjacency keys with
paste(a, b, sep = "-")? Negative piece labels produce keys like"1--1". Use"|"separator instead. Split with"\\|". - Using
cat()for output: Always useclipackage logging wrappers (log_info,log_warn, etc.) - Collate order: DESCRIPTION Collate field must be alphabetical or dependency-ordered
- Config.yml format: Ensure YAML valid; test with
yaml::yaml.load_file("inst/config.yml")
See Also
generate-puzzle— test new type after scaffoldingrun-puzzle-tests— run full test suite to verify integrationvalidate-piles-notation— test fusion with new typewrite-testthat-tests— general test-writing patternswrite-roxygen-docs— document new geom function
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을 선택하십시오.
