MCP HubMCP Hub
스킬 목록으로 돌아가기

generate-puzzle

pjt222
업데이트됨 2 days ago
6 조회
17
2
17
GitHub에서 보기
메타wordaitestingdesign

정보

이 스킬은 `generate_puzzle()` 또는 `geom_puzzle_*()` 함수를 통해 직소 퍼즐 SVG와 ggplot2 시각화를 생성합니다. 직사각형, 육각형, 보로노이 등 다양한 퍼즐 유형을 지원하며, 설정 파일에 따라 그리드, 크기, 시드 등의 매개변수를 검증합니다. 퍼즐 파일 생성, 설정 테스트, 데모 및 문서용 샘플 생성에 활용할 수 있습니다.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/generate-puzzle

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Generate Puzzle

Generate jigsaw puzzles using the jigsawR package's unified API.

When to Use

  • Creating puzzle SVG files for a specific type and configuration
  • Testing puzzle generation with different parameters
  • Generating sample output for documentation or demos
  • Creating ggplot2 puzzle visualizations with geom_puzzle_*()

Inputs

  • Required: Puzzle type ("rectangular", "hexagonal", "concentric", "voronoi", "random", "snic")
  • Required: Grid dimensions (type-dependent: c(cols, rows) or c(rings))
  • Optional: Size in mm (default varies by type)
  • Optional: Seed for reproducibility (default: 42)
  • Optional: Offset (0 = interlocked, >0 = separated pieces)
  • Optional: Layout ("grid" or "repel" for rectangular)
  • Optional: Fusion groups (PILES notation string)

Procedure

Step 1: Read Config Constraints

R_EXE="/mnt/c/Program Files/R/R-4.5.0/bin/Rscript.exe"
"$R_EXE" -e "cat(yaml::yaml.load_file('inst/config.yml')[['{TYPE}']]$grid$max)"

Or read inst/config.yml directly to check valid ranges for the chosen type.

Got: The min/max values for grid, size, tabsize, and other parameters are known for the chosen puzzle type.

If fail: If config.yml is missing or the type key doesn't exist, check that you are in the jigsawR project root and the package has been built at least once.

Step 2: Determine Type and Parameters

Map the user's request to valid generate_puzzle() arguments:

TypegridsizeExtra params
rectangularc(cols, rows)c(width, height) mmoffset, layout, tabsize
hexagonalc(rings)c(diameter) mmdo_warp, do_trunc, tabsize
concentricc(rings)c(diameter) mmcenter_shape, tabsize
voronoic(cols, rows)c(width, height) mmn_interior, tabsize
randomc(cols, rows)c(width, height) mmn_interior, tabsize
snicc(cols, rows)c(width, height) mmn_interior, compactness, tabsize

Got: User request mapped to valid generate_puzzle() arguments with correct type, grid dimensions, and size values within the ranges from config.yml.

If fail: If unsure which parameter format to use, refer to the table above. Rectangular and voronoi types use c(cols, rows) for grid; hexagonal and concentric use c(rings).

Step 3: Create R Script

Write a script file (preferred over -e for complex commands):

library(jigsawR)

result <- generate_puzzle(
  type = "rectangular",
  seed = 42,
  grid = c(3, 4),
  size = c(400, 300),
  offset = 0,
  layout = "grid"
)

cat("Pieces:", length(result$pieces), "\n")
cat("SVG length:", nchar(result$svg_content), "\n")
cat("Files:", paste(result$files, collapse = ", "), "\n")

Save to a temporary script file.

Got: An R script file saved to a temporary location containing library(jigsawR), a generate_puzzle() call with all parameters, and diagnostic output lines.

If fail: If the script has syntax errors, verify that all string arguments are quoted and numeric vectors use c(). Avoid complex shell escaping by always using script files.

Step 4: Execute via WSL R

R_EXE="/mnt/c/Program Files/R/R-4.5.0/bin/Rscript.exe"
"$R_EXE" /path/to/script.R

Got: Script completes without errors. SVG file(s) written to output/.

If fail: Check that renv is restored (renv::restore()). Verify package is loaded (devtools::load_all()). Do NOT use --vanilla flag (renv needs .Rprofile).

Step 5: Verify Output

  • SVG file exists in output/ directory
  • SVG content starts with <?xml or <svg
  • Piece count matches expected: cols * rows (rectangular), ring formula (hex/concentric)
  • For ggplot2 approach, verify the plot object renders without error

Got: SVG file exists in output/, content starts with <?xml or <svg, and piece count matches the grid specification (cols * rows for rectangular, ring formula for hex/concentric).

If fail: If SVG file is missing, check the output/ directory exists. If piece count is wrong, verify grid dimensions match the puzzle type's expected formula. For ggplot2 output, check that the plot renders without error by wrapping in tryCatch().

Step 6: Save Output

Generated files are saved to output/ by default. The result object contains:

  • $svg_content — raw SVG string
  • $pieces — list of piece data
  • $canvas_size — dimensions
  • $files — paths to written files

Got: The result object contains $svg_content, $pieces, $canvas_size, and $files fields. Files listed in $files exist on disk.

If fail: If $files is empty, the puzzle may have generated in-memory only. Explicitly save with writeLines(result$svg_content, "output/puzzle.svg").

Validation

  • Script executes without errors
  • SVG file is well-formed XML
  • Piece count matches grid specification
  • Same seed produces identical output (reproducibility)
  • Parameters are within config.yml constraints

Pitfalls

  • Using --vanilla flag: Breaks renv activation. Never use it.
  • Complex -e commands: Use script files instead; shell escaping causes Exit code 5.
  • Grid vs size confusion: Grid is piece count, size is physical dimensions in mm.
  • Offset semantics: 0 = assembled puzzle, positive = exploded/separated pieces.
  • SNIC without package: snic type requires the snic package installed.

Related Skills

  • add-puzzle-type — scaffold a new puzzle type end-to-end
  • validate-piles-notation — validate fusion group strings before passing to generate_puzzle()
  • run-puzzle-tests — run the test suite after generation changes
  • write-testthat-tests — add tests for new generation scenarios

GitHub 저장소

pjt222/agent-almanac
경로: i18n/caveman-lite/skills/generate-puzzle
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

연관 스킬

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을 선택하십시오.

스킬 보기