Back to Skills

validate-piles-notation

pjt222
Updated Yesterday
17
2
17
View on GitHub
Metaaitesting

About

This skill parses and validates PILES notation strings used to define piece fusion groups in jigsawR. It performs syntax validation, converts notation into structured group lists, and can generate plain-language explanations. Developers should use it to validate user input before `generate_puzzle()`, debug fusion group issues, or verify round-trip serialization fidelity.

Quick Install

Claude Code

Recommended
Primary
npx skills add pjt222/agent-almanac -a claude-code
Plugin CommandAlternative
/plugin add https://github.com/pjt222/agent-almanac
Git CloneAlternative
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/validate-piles-notation

Copy and paste this command in Claude Code to install this skill

Documentation

驗 PILES 之記

於 jigsawR 中析驗 PILES 之記之串,以指片融之群。

用時

  • 用者所予之 PILES 串入 generate_puzzle() 前驗之
  • 排融群之疾(誤合之片、意外之果)
  • 以淺辭述 PILES 之記於用者
  • 試往返之忠:析 -> 群 -> 序 -> 析

  • 必要:PILES 之記之串(如 "1-2-3,4-5"
  • 可選:拼圖果之物(為鄰之驗與關鍵字之解)
  • 可選:拼圖之類(為關鍵字之支如 "center""ring1""R1"

第一步:語法之驗

library(jigsawR)
result <- validate_piles_syntax("1-2-3,4-5")
# Returns TRUE if valid, error message if invalid

察常見語法之訛:

  • 括不對:"1-2(-3)-4"() 不配
  • 字非允:唯數、-,:() 與關鍵字
  • 空群:"1-2,,3-4"(雙逗)

得:有效語法返 TRUE,無效返述訛之辭。

敗則:印 PILES 之串與驗訛之辭。

第二步:析為群

groups <- parse_piles("1-2-3,4-5")
# Returns: list(c(1, 2, 3), c(4, 5))

含範之串:

groups <- parse_piles("1:6,7-8")
# Returns: list(c(1, 2, 3, 4, 5, 6), c(7, 8))

得:整向之列,每融群一向,含正片 ID 與群之界。

敗則:先確 PILES 串已過第一步之語法驗。析返意外之群者,驗 - 分群內片、, 分群、範記(:)展為含端。

第三步:以淺辭述之

為用者述各群:

  • "1-2-3,4-5" -> 「群一:合片 1、2、3。群二:合片 4 與 5。」
  • "1:6" -> 「群一:合片 1 至 6(六片)。」
  • "center,ring1" -> 「群一:中心片。群二:環一之諸片。」

得:每融群以淺辭述,含片數與識,使非技用者能解。

敗則:關鍵字不能述(如 "ring1" 無明意)者,記或需拼圖果之物為脈絡。囑用者予拼圖類或用數片 ID。

第四步:對拼圖果之驗(可選)

若拼圖果之物可得,驗:

# Generate the puzzle first
puzzle <- generate_puzzle(type = "hexagonal", grid = c(3), size = c(200))

# Parse with puzzle context (resolves keywords)
groups <- parse_fusion("center,ring1", puzzle)

察:

  • 諸片 ID 存於拼圖
  • 關鍵字解為有效片集
  • 合之片實鄰(否則警)

得:諸片 ID 有效。鄰片合而清。

敗則:列無效片 ID 或非鄰之對。

第五步:往返序之驗

驗析/序之忠:

original <- "1-2-3,4-5"
groups <- parse_piles(original)
roundtrip <- to_piles(groups)
# roundtrip should equal original (or canonical equivalent)

groups2 <- parse_piles(roundtrip)
identical(groups, groups2)  # Must be TRUE

得:往返生同群列,確 parse_piles()to_piles() 為逆。

敗則:往返異者,察序者是否規範化記(如片 ID 排序或範化為顯列)。範差可受,唯 identical(groups, groups2) 須返 TRUE

PILES 速參

# Basic syntax
"1-2"           # Fuse pieces 1 and 2
"1-2-3,4-5"     # Two groups: (1,2,3) and (4,5)
"1:6"           # Range: pieces 1 through 6

# Keywords (require puzzle_result)
"center"        # Center piece (hex/concentric)
"ring1"         # All pieces in ring 1
"R1"            # Row 1 (rectangular)
"boundary"      # All boundary pieces

# Functions
parse_piles("1-2-3,4-5")                    # Parse PILES string
parse_fusion("1-2-3", puzzle)               # Auto-detect format
to_piles(list(c(1,2), c(3,4)))              # Convert to PILES
validate_piles_syntax("1-2(-3)-4")          # Validate syntax

  • validate_piles_syntax() 對有效串返 TRUE
  • parse_piles() 返正群列
  • 往返序保群
  • 關鍵字以拼圖脈絡正解
  • 無效語法生明訛辭

  • 關鍵字無拼圖脈絡:如 "center" 之關鍵字需拼圖果物。傳於 parse_fusion(),非 parse_piles()
  • 片始於一:片 ID 始於 1,非 0。
  • 鄰與非鄰之合:合非鄰片可行而生意外之視果。可時驗鄰。
  • 範之記"1:6" 含兩端(1, 2, 3, 4, 5, 6)。

  • generate-puzzle — 生含融群之拼圖
  • add-puzzle-type — 新類需 PILES/融之支
  • run-puzzle-tests — 全套試 PILES 之析

GitHub Repository

pjt222/agent-almanac
Path: i18n/wenyan/skills/validate-piles-notation
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

Related Skills

content-collections

Meta

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

View skill

polymarket

Meta

This skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.

View skill

creating-opencode-plugins

Meta

This skill helps developers create OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It provides the plugin structure, event API specifications, and implementation patterns for JavaScript/TypeScript modules. Use it when you need to intercept, monitor, or extend the OpenCode AI assistant's lifecycle with custom event-driven logic.

View skill

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill