myscript/iinkts/symbol-system
Claude Code and agent skill by myscript/iinkts
- community
Checking that the SKILL.md file is still in the repository.
Deep guide to the iinkTS symbol system: TSymbol union, type guards, the Ops/Util two-layer pattern, SymbolFactory, symbolRegistry. Use when writing type-safe symbol code, adding symbol behavior, or debugging type confusion between variants.
Install
npx vskill@latest install myscript/iinkts/symbol-systemSKILL.md
Symbol System
Hierarchy
Not in `TSymbol`: TEraser (separate), legacy Stroke/CanvasSymbol (deprecated v1, src/symbol/legacy/), TPoint/TBox/OBB (primitives).
Two layers of per-type logic
- `*Ops` — pure functions/objects co-located with the type definition in
src/symbol/{type}/{Type}.ts:StrokeOps,TextOps,MathOps,DecoratorOps,EraserOps,BoxOps,ShapeOps,EdgeOps. This is wherecreate/update/overlap logic actually lives — usable standalone, no registry dependency. - `*Util` — adapter classes in
src/symbol-utils/{type}/{Type}Util.ts(StrokeUtil,TextUtil,MathUtil,ShapeUtil,EdgeUtil,DecoratorUtil), extending abstractSymbolUtil. Mostly delegate to the matching*Ops, plus implementgetSVGElement()for rendering. All 6 register intosymbolRegistryviaregisterBuiltinSymbolUtils().
SVGRenderer dispatches rendering with symbolRegistry.getUtil(symbol.type).getSVGElement(symbol) — no switch on SymbolType in the renderer.
Type Guards
Co-located with each type, not centralized:
If a type guard you need doesn't exist, add it next to the type definition — never inline symbol.type === "..." checks.
Note: src/symbol/SymbolHelpers.ts is NOT a dispatcher — it only exports cloneSymbol() (via structuredClone). The real per-type dispatch is symbolRegistry in src/symbol-utils/.
IIModel Interactions
IIModel stores symbols in a Map<string, TSymbol> (keyed by symbol.id):
Cache invalidation: IIModel caches bounding boxes. After bulk mutations, call model.resetBoundingBox().
SymbolFactory
Use SymbolFactory (src/symbol-utils/SymbolFactory.ts) to create symbols — never construct a type literal directly:
Creating symbols by hand bypasses ID generation and default style merging.
Common Mistakes
| Mistake | Fix | |
|---|---|---|
symbol.type === "stroke" inline check | Use isStroke(symbol) from @/symbol/stroke/Stroke | |
Assuming SymbolHelpers dispatches by type | It only has cloneSymbol() — use symbolRegistry | |
Branching on SymbolType in a manager/renderer | Add/extend the type's *Ops/*Util pair instead | |
Mutating model.symbols array directly | Use model.addSymbol() / model.removeSymbol() | |
Looking for per-type logic in src/symbol/ only | Rendering + capability flags live in src/symbol-utils/ |
Adding a New Symbol Type
See the add-symbol-type skill for the full step-by-step (enum → type+Ops → Util adapter → registry → renderer → tests).
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/symbol-system/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/myscript/iinkts/symbol-system)