type-inference-validation
Static type inference and validation for navigation paths
Best use case
type-inference-validation is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Static type inference and validation for navigation paths
Teams using type-inference-validation should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/type-inference-validation/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How type-inference-validation Compares
| Feature / Agent | type-inference-validation | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Static type inference and validation for navigation paths
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Type Inference Validation
## Core Concept
Static type validation that **rejects invalid path compositions before caching**. Every Navigator path must prove type compatibility with its input structure—this skill enforces that proof.
Works alongside Möbius filtering as a second line of defense: Möbius eliminates topological impossibilities, Type Inference eliminates structural impossibilities.
## Why Type Validation?
Consider this dangerous scenario:
```julia
data_numbers = [1, 2, 3, 4, 5]
data_dict = Dict("x" => 10, "y" => 20)
# This path makes sense for numbers
nav1 = @late_nav([ALL, pred(iseven)]) # Type ✓: Vector → Numbers → Numbers
# But what if someone mistakenly uses it on the dict?
nav_select(nav1, data_dict, x -> [x])
# => IndexError! (dicts don't support ALL enumeration this way)
```
**Type Inference Validation prevents this at compile time**, not runtime.
## Architecture
### Type System
Each Navigator carries a **type signature**:
```
Navigator{InputType, OutputType, PathSteps}
```
Examples:
```julia
nav_vector = Navigator{Vector, Vector, [ALL, pred(f)]}
nav_dict = Navigator{Dict, Vector, [keypath(k), ALL]}
nav_sexp = Navigator{SExpression, Symbol, [sexp_nth(2), SEXP_HEAD]}
```
### Type Refinement Pipeline
```
Input Type
↓
@late_nav(path_expr) triggers validation
↓
Type each step in path:
[ALL] : Vector{T} → T
[keypath(k)] : Dict{K,V} → V
[pred(f)] : T → T (preserves type)
[INDEX(i)] : Vector{T} → T
[SEXP_HEAD] : SExpr → Symbol
↓
Unify step outputs with next step inputs
↓
Final output type computed
↓
Cache with type signature
↓
Accept or Reject
```
### Type Incompatibility Detection
| Step | Input Type | Output Type | Valid? |
|------|-----------|------------|--------|
| `[ALL]` | Vector{T} | T | ✓ |
| `[ALL]` | Dict{K,V} | ⚠️ (ambiguous) | ✗ |
| `[keypath(k)]` | Dict{K,V} | V | ✓ |
| `[keypath(k)]` | Vector{T} | ✗ | ✗ |
| `[pred(f)]` | T | T | ✓ |
| `[INDEX(i)]` | Vector{T} | T | ✓ |
| `[INDEX(i)]` | Dict | ✗ | ✗ |
## API
### Type Inference
**`infer_type(path_expr, input_type) :: Result{OutputType, Error}`**
Computes the output type of a path given an input type.
```julia
infer_type([ALL, pred(iseven)], Vector{Int})
# => Result(Int) # outputs Int values
infer_type([keypath("x"), ALL], Dict{String, Vector{Int}})
# => Result(Int) # navigates to x, then enumerates integers
infer_type([keypath("x")], Vector{Int})
# => Result(TypeError("Cannot apply keypath to Vector"))
```
**`validate_path(navigator::Navigator, input_type) :: Bool`**
Checks if a Navigator is compatible with a given input type.
```julia
nav = @late_nav([ALL, pred(f)])
validate_path(nav, Vector{Int}) # => true
validate_path(nav, Dict{String, Int}) # => false ✗
# Causes @late_nav to reject the Navigator before caching
```
### Type Signatures
**`navigator_signature(nav::Navigator) :: TypeSignature`**
Returns the full type signature of a cached Navigator.
```julia
nav = @late_nav([ALL, pred(iseven)])
sig = navigator_signature(nav)
# => TypeSignature(
# input: Vector{T},
# output: T,
# constraints: [iseven(T)],
# steps: [[ALL], [pred(iseven)]],
# valid_for: Vector{Int}, Vector{BigInt}, ...
# )
```
### Polymorphic Inference
**`polymorphic_infer(path_expr) :: PolymorphicType`**
Infers the most general type for a path (before knowing input type).
```julia
polymorphic_infer([ALL, pred(iseven)])
# => ∀T. (T ∈ Enumerable, T ∈ HasEven) → T
# This means: works for ANY type T that:
# - Can be enumerated (Vector, Set, List, etc.)
# - Has an iseven() method defined
```
## Integration with Caching
Cache keys now include type information:
```julia
cache_key = hash((path_expr, inferred_type))
# Different input types → different cache entries
nav_vec = @late_nav([ALL, pred(f)]) # cache for Vector
nav_set = @late_nav([ALL, pred(f)]) # cache for Set (if compatible)
# => Different NavigatorObjects, despite same path!
```
## Refinement Types
Supports **refinement types** for predicates:
```julia
# pred(iseven) refines Int → EvenInt
# pred(x -> x > 5) refines Int → IntGt5
nav = @late_nav([ALL, pred(x -> x > 5)])
# Type: Vector{Int} → IntGt5
# (output is proven to be > 5)
```
Refinement types enable:
- **Automatic constraint propagation** downstream
- **Proof that outputs satisfy predicates** without re-checking
- **Composition of constraints** with type safety
## Type Mismatch Examples
### ❌ INVALID: Wrong container type
```julia
nav = @late_nav([keypath("name"), ALL])
# Type error: keypath returns a string, ALL requires enumerable
# KeyPath{Dict, String} → String
# ALL{String} → ✗ (String not enumerable in that way)
```
### ❌ INVALID: Incompatible predicate
```julia
nav = @late_nav([ALL, pred(x -> x > 5)])
# If input is Vector{String}, predicate fails
# Type error: `(String > 5)` is nonsense
```
### ✓ VALID: Polymorphic path
```julia
nav = @late_nav([ALL, pred(identity)]) # identity always works
# Type: ∀T. Vector{T} → T
# Works for ANY vector type
```
## Error Messages
**Type validation errors are clear**:
```
TypeError: Path composition invalid
Step 1: [ALL]
Input: Vector{Int}
Output: Int
✓ Type check passed
Step 2: [keypath("x")]
Input: Int
Output: ???
✗ TypeError: Cannot apply keypath to Int
keypath requires Dict or record type
Got: Int
Suggestion: Remove [keypath("x")] or ensure input is Dict/Struct
```
## Performance
All type checking happens at **compile time** (during `@late_nav` expansion):
| Operation | Complexity | Notes |
|-----------|-----------|-------|
| infer_type | O(\|path\|) | Single pass through steps |
| validate_path | O(1) | Cached signature lookup |
| polymorphic_infer | O(\|path\|) | Compute most general type |
| **Runtime overhead** | O(0) | Zero cost—all checks are static |
## Composition with Other Skills
**Works with Möbius Filtering**:
1. Möbius filters topological impossibilities
2. Type Inference filters structural impossibilities
3. Both must pass for path to compile
**Works with Color Envelopes**:
Type signatures include color trit information:
```julia
nav = @late_nav([ALL, pred(f)]) # trit = -1 (filtering)
sig = navigator_signature(nav)
# => TypeSignature(..., trit: -1)
# Type system respects color: composition must balance trits AND types
```
**Enables Constraint Generalization** (next skill):
Once types are proven, constraints can be composed and generalized safely.
## Related Skills
- **möbius-path-filtering** - Topological validation (works alongside this)
- **tuple-nav-composition** - Uses type signatures to compose products
- **constraint-generalization** - Builds on type-proven constraints
- **specter-navigator-gadget** - Uses validated types for safe composition
## References
- Gradual typing: "Gradual Typing for Functional Languages" - Siek & Taha
- Refinement types: "Liquid Haskell: Haskell as a Theorem Prover" - Jhala et al.
- Type inference: "Algorithm W: Inference of Data Types" - Damas & MilnerRelated Skills
write-data-type-ref
Write a reference documentation page for a specific data type in ZIO Blocks. Use when the user asks to document a data type, write an API reference for a type, or create a reference page for a class/trait/object.
typespec-m365-copilot-typespec-create-agent
Generate a complete TypeSpec declarative agent with instructions, capabilities, and conversation starters for Microsoft 365 Copilot Use when: the task directly matches typespec create agent responsibilities within plugin typespec-m365-copilot. Do not use when: a more specific framework or task-focused skill is clearly a better match.
typespec-create-agent
Generate a complete TypeSpec declarative agent with instructions, capabilities, and conversation starters for Microsoft 365 Copilot
inference-smoke-tests
Run repeatable inference smoke tests using geppetto/pinocchio example binaries (single-pass, streaming, tool-loop, OpenAI Responses thinking) including tmux-driven TUI tests. Use when refactors touch InferenceState/Session/EngineBuilder, tool calling loop, event sinks, provider request formatting, or when you need a quick 'does inference still work?' checklist.
chromatin-state-inference
This skill should be used when users need to infer chromatin states from histone modification ChIP-seq data using chromHMM. It provides workflows for chromatin state segmentation, model training, state annotation.
bio-alignment-validation
Validate alignment quality with insert size distribution, proper pairing rates, GC bias, strand balance, and other post-alignment metrics. Use when verifying alignment data quality before variant calling or quantification.
awesome-copilot-root-typespec-create-agent
Generate a complete TypeSpec declarative agent with instructions, capabilities, and conversation starters for Microsoft 365 Copilot Use when: the task directly matches typespec create agent responsibilities within plugin awesome-copilot-root. Do not use when: a more specific framework or task-focused skill is clearly a better match.
upstash/workflow TypeScript SDK Skill
Lightweight guidance for using the Upstash Workflow SDK to define, trigger, and manage workflows. Use this Skill whenever a user wants to create workflow endpoints, run steps, or interact with the Upstash Workflow client.
upstash/search TypeScript SDK
Entry point for documentation skills covering Upstash Search quick starts, core concepts, and TypeScript SDK usage. Use when a user asks how to get started, how indexing works, or how to use the TS client.
typescript
TypeScript. Proyecto usa este skill; contenido canónico en .ai-system.
typescript-pro
Master TypeScript with advanced types, generics, and strict type safety. Handles complex type systems, decorators, and enterprise-grade patterns. Use PROACTIVELY for TypeScript architecture, type inference optimization, or advanced typing patterns.
typescript-expert
TypeScript and JavaScript expert with deep knowledge of type-level programming, performance optimization, monorepo management, migration strategies, and modern tooling.