agentleFS
rainoftimerainoftime/pl-skills/gradual-typing-implementer/SKILL.md

gradual-typing-implementer

Skill17 starsChanged 9 months agoApache-2.0View on GitHub

Implements gradual typing for dynamically-typed languages. Use when:

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Start with simple gradual system

    line 61
  2. Distinctive:

    Use "any" as bottom for gradual

    line 62
  3. Distinctive:

    Test with mixed static/dynamic code

    line 65

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Gradual Typing Implementer

Implements gradual typing systems that bridge static and dynamic typing.

When to Use

  • Adding type checking to dynamic languages
  • Supporting migration to static types
  • Building hybrid type systems
  • Implementing TypeScript-like systems
  • Creating typed dialects of Python/Ruby

What This Skill Does

  1. Defines gradual types - Static + dynamic + ? types
  2. Implements type checking - Consistent with gradual guarantee
  3. Handles casts - Runtime type checks
  4. Manages errors - Type mismatch reporting

Key Concepts

ConceptDescription
Gradual guaranteeAdding static types doesn't change behavior
Consistent-withFlexible type matching (★)
Unknown typeExplicitly unknown ('?')
Type precisionDynamic < Unknown < Static

The ★ Relation

Type AType BA consistent B?
intint✓
intdynamic✓
dynamicint✓
intstring✗
(int → int)(dynamic → int)✓

Tips

  • Start with simple gradual system
  • Use "any" as bottom for gradual
  • Preserve dynamic behavior
  • Good error messages are crucial
  • Test with mixed static/dynamic code

Related Skills

  • type-checker-generator - Static type checking
  • type-inference-engine - Type inference
  • refinement-type-checker - Refinement types

Canonical References

ReferenceWhy It Matters
Siek & Taha, "Gradual Typing for Functional Languages" (2006)Original gradual typing
Siek et al., "Gradual Typing in Practice"Practical gradual typing
TypeScript Language SpecificationProduction gradual typing
Typed RacketGradual typing in practice

Tradeoffs and Limitations

Design Tradeoffs

ApproachProsCons
ErasureSimple, fastRuntime overhead
ReifiedType info at runtimeMemory
BlameClear error responsibilityComplexity

Limitations

  • Runtime overhead for checks
  • Cannot fully verify static properties
  • Type inference is harder
  • Error messages can be confusing
  • Performance tuning is complex

Research Tools & Artifacts

Gradual typing in practice:

ToolLanguageWhat to Learn
TypeScriptJavaScriptProduction gradual
Typed RacketRacketAcademic
PyrightPythonGradual

Research Frontiers

1. Blame Tracking

  • Goal: Error localization

Implementation Pitfalls

PitfallReal ConsequenceSolution
Runtime overheadSlow checksOptimize

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.