Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

tuple-nav-composition

БесплатноБез исполняемых скриптовНе проверен

Tuple and product structure navigation with composition

plurigridот plurigrid★ 73 звезды на GitHub

Об этом скилле

Tuple Nav Composition

Core Concept

Navigation through product structures (tuples, named tuples, records) where multiple fields must be accessed and composed in parallel.

A TupleNav is a bundled Navigator that operates on all fields of a product simultaneously, maintaining structural integrity through composition.

Why Tuple Navigation?

Standard Specter navigators work on sequences (ALL, each element). But what about simultaneous access to multiple fields?

# Without TupleNav: Access fields separately, type mismatch risk
person = (name="Alice", age=30, email="[email protected]")

name_nav = @late_nav([INDEX(1)])     # But tuples aren't indexed this way!
age_nav = @late_nav([INDEX(2)])      # Fragile, error-prone

# With TupleNav: Access structurally, type-safe composition
record_nav = @tuple_nav([:name, :age])  # Access both fields as unit

Architecture

TupleNav Structure

struct TupleNav
    fields::Vector{Symbol}           # Field names to navigate
    navigators::Dict{Symbol, Navigator}  # Navigator for each field
    composition_strategy::Symbol      # :parallel, :sequential, :reduce
    output_type::Type                # (Field1Type, Field2Type, ...)
end

Product Types

Type Navigation
(T1, T2, T3) Positional tuple
NamedTuple{(:a, :b, :c)} Named access
@NamedTuple{a::T1, b::T2} Struct-like
Dict{K, V} Key-based dictionary
Record/DataClass Field-based

Composition Strategies

:parallel - Access all fields simultaneously

nav = @tuple_nav([:x, :y, :z], strategy=:parallel)
result = nav_select(nav, (x=1, y=2, z=3), id)
# => ((x=1), (y=2), (z=3))  # All accessed at once

:sequential - Access fields in order, threading results

nav = @tuple_nav([:x, :y, :z], strategy=:sequential)
# Field y receives result from x, z receives from y, etc.

:reduce - Fold/reduce across fields

nav = @tuple_nav([:x, :y, :z], strategy=:reduce)
# Combine results across fields: x + y + z

API

TupleNav Creation

@tuple_nav(fields, strategy=:parallel) Creates a TupleNav for navigating product types.

# Access name and email from person record
nav = @tuple_nav([:name, :email])

person = (name="Alice", email="[email protected]", age=30)
result = nav_select(nav, person, identity)
# => (name="Alice", email="[email protected]")

tuple_nav(fields::Vector{Symbol}, structure_type::Type) Explicitly typed TupleNav.

PersonType = NamedTuple{(:name, :age, :email)}

nav = tuple_nav([:name, :email], PersonType)
# Type-checked at compile time

Composition

compose_tuple_navs(nav1::TupleNav, nav2::TupleNav) :: TupleNav Combines two product navigators.

nav_identity = @tuple_nav([:id, :name])     # Extract identity
nav_contact = @tuple_nav([:email, :phone])  # Extract contact

nav_combined = compose_tuple_navs(nav_identity, nav_contact)
# Result has all 4 fields: id, name, email, phone

Nested Products

nested_tuple_nav(path::Vector, fields::Vector{Symbol}) Navigate to a product, then select fields.

# Navigate to users list, then select name/email from each
nav = nested_tuple_nav([keypath("users"), ALL], [:name, :email])

data = Dict(
  "users" => [
    (name="Alice", age=30, email="[email protected]"),
    (name="Bob", age=25, email="[email protected]")
  ]
)

result = nav_select(nav, data, identity)
# => [
#      (name="Alice", email="[email protected]"),
#      (name="Bob", email="[email protected]")
#    ]

Field Projection

project_tuple_nav(nav::TupleNav, fields::Vector{Symbol}) Extract subset of fields from a TupleNav.

nav_full = @tuple_nav([:id, :name, :age, :email])
nav_subset = project_tuple_nav(nav_full, [:name, :email])
# New navigator accesses only name and email

Structural Composition

Key insight: TupleNav maintains type safety across composition.

# Type 1: Person
Person = NamedTuple{(:name, :age)}

# Type 2: Contact
Contact = NamedTuple{(:email, :phone)}

# Type 3: User (combines both)
User = NamedTuple{(:name, :age, :email, :phone)}

# Composition is type-safe
nav_person = @tuple_nav([:name, :age], Person)
nav_contact = @tuple_nav([:email, :phone], Contact)
nav_user = compose_tuple_navs(nav_person, nav_contact)
# => TupleNav for User type ✓

Parallel Semantics

With :parallel strategy, all fields are accessed in parallel (logically):

nav = @tuple_nav([:x, :y, :z], strategy=:parallel)

# Execution order doesn't matter—all fields see the same input
result1 = nav_select(nav, structure, f)
result2 = nav_select(nav, structure, f)
# => Always identical (deterministic parallel access)

Under the hood, this uses color-aware SplitMix64 seeding to ensure parallel reads remain deterministic (see color-envelope-preserving skill).

Dictionary Projection

TupleNav also works on dictionaries with stru

Полный SKILL.md на GitHub

Установить tuple-nav-composition в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл tuple-nav-composition?

Tuple and product structure navigation with composition

Как установить скилл tuple-nav-composition?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл tuple-nav-composition запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить tuple-nav-composition с