Agent skill
yfiles-nodestyle-basic
Creates basic custom node styles by extending NodeStyleBase and implementing createVisual/updateVisual methods. Handles SVG rendering, visual caching, and performance optimization. Use when creating custom node visualizations, implementing custom shapes, or when user mentions "custom node style", "NodeStyleBase", "createVisual", "updateVisual", or "custom rendering".
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/yfiles-nodestyle-basic
SKILL.md
Basic Custom Node Styles
Create custom node visualizations using NodeStyleBase.
Quick Start
import { NodeStyleBase, SvgVisual, type IRenderContext, type INode } from '@yfiles/yfiles'
export class CustomNodeStyle extends NodeStyleBase {
protected createVisual(context: IRenderContext, node: INode): SvgVisual {
const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect')
const { x, y, width, height } = node.layout
rect.setAttribute('x', String(x))
rect.setAttribute('y', String(y))
rect.setAttribute('width', String(width))
rect.setAttribute('height', String(height))
rect.setAttribute('fill', '#0b7189')
return new SvgVisual(rect)
}
}
Before Creating
Always query yFiles MCP for current API:
yfiles:yfiles_get_symbol_details(name="NodeStyleBase")
yfiles:yfiles_list_members(name="NodeStyleBase")
yfiles:yfiles_search_documentation(query="custom node style")
Core Concepts
- createVisual(): Creates SVG visual (required)
- updateVisual(): Optimizes rerendering (highly recommended)
- Caching: Store render state in visual.tag for efficient updates
- SvgVisual: Wrapper for SVG elements
Implementation Steps
- Extend NodeStyleBase
- Implement createVisual() to create SVG
- Implement updateVisual() for performance
- Use visual caching to avoid unnecessary DOM updates
Note: When implementing yFiles interfaces, always use BaseClass() wrapper instead of TypeScript implements. The @yfiles/eslint-plugin rule @yfiles/fix-implements-using-baseclass enforces this pattern.
Code Examples
See examples.md for:
- Basic rectangle style
- Custom shape with path
- Optimized style with updateVisual
- Caching patterns
Reference
See reference.md for:
- NodeStyleBase API details
- SVG manipulation patterns
- Performance best practices
- Visual caching strategies
Related Skills
After mastering basics, explore:
/yfiles-nodestyle-configure- Make styles configurable and data-driven/yfiles-nodestyle-interaction- Add hit testing and edge cropping/yfiles-nodestyle-advanced- Viewport culling and group nodes
MCP Tools
yfiles:yfiles_get_symbol_details(name="NodeStyleBase")- Base class APIyfiles:yfiles_get_symbol_details(name="SvgVisual")- Visual wrapperyfiles:yfiles_search_documentation(query="custom node style")- Tutorials
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?