synergycodes/ng-diagram/ng-diagram-groups
Claude Code and agent skill by synergycodes/ng-diagram
- community
- ext:[{"type":"template","description":"Custom templates for code generation"}]
Checking that the SKILL.md file is still in the repository.
Use when grouping ng-diagram nodes (isGroup, groupId) - containers, swimlanes, custom group templates, membership by drag and drop or code (canGroup, NgDiagramGroupsService), resizing or deleting groups, or children that move, vanish or overflow.
Install
npx vskill@latest install synergycodes/ng-diagram/ng-diagram-groupsSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Groups
Group nodes and their children: model wiring, custom group templates, membership by drag and drop and from code, resizing, deleting, moving and fitting groups. Collapse/expand is in ng-diagram-visibility, z-order in ng-diagram-layering, copy/paste in ng-diagram-selection-clipboard.
Rules
- A group is a node with `isGroup: true`; children point to it with `groupId`. A custom template alone gives no group behavior —
typeonly picks the template. - All positions are global (diagram coordinates), for groups and children alike. Joining or leaving a group never changes a position. Dragging a group moves all its descendants, but moving from code moves only what you pass:
updateNode(groupId, { position })andmoveNodesBy([group], …)leave the children in place. - Give groups `size` and `autoSize: false`. Otherwise the default group template is a fixed 9.0625rem square (145 × 145 px at the default font size), and a custom group template takes the size of its content.
- Change membership through `NgDiagramGroupsService`. It applies
grouping.canGroup, prevents cycles and firesgroupMembershipChanged. WritinggroupIdyourself skips the first two. - Deleting a group deletes its whole subtree — with
deleteSelectionalways, withNgDiagramModelService.deleteNodessince 1.4.0. To keep the children, remove them from the group first, in a separate awaited call. - Groups never resize themselves. Children can stick out after a move or a group resize; only
resize.allowResizeBelowChildrenBounds: falsestops a resize below the children.
Model shape
Custom group template and config
- Register the component in the same
NgDiagramNodeTemplateMapas node templates, set thattypeon the group node, and keepisGroup: true. - Build callback sections with their own type (
Partial<GroupingConfig>,Partial<ResizeConfig>) as above:NgDiagramConfigdrops callback signatures, so inline parameters are TS7006 understrict, and annotated ones still let a wrong return type compile (seeng-diagram-config). ngDiagramGroupHighlighted [node]adds the classng-diagram-group-highlightwhilenode.highlightedistrue(a drag hovers the group). The global styles then draw a highlight border and inset shadow:--ngd-group-border-color-highlight,--ngd-group-box-shadow-color-highlight,--ngd-group-highlight-size.- The default group template shows no text (it does not read
data). Use a custom template for a title. Its look:--ngd-group-border-color,--ngd-group-border-color-hover,--ngd-group-border-radius.
Membership by drag and drop
- On drop, the topmost unselected group under the pointer receives the dragged (visible, selected) nodes. When no group is under the pointer, the dropped nodes leave their group, unless their group is part of the drag. How much the node overlaps the group does not matter.
- While dragging, the group under the pointer gets
highlighted: truewhencanGroupaccepts at least one dragged node. grouping.canGroup(node, group)gets the candidate node first, then the group (default() => true). A node rejected on drop keeps its oldgroupId.- A palette drop never joins a group by itself — see the
onPaletteDroprecipe below.
Membership and group operations from code
NgDiagramGroupsService:addToGroup(groupId, nodeIds),removeFromGroup(groupId, nodeIds),highlightGroup(groupId, nodes),highlightGroupClear(). All return aPromise<void>(since 1.3.0).addToGroupskips nodes already in that group, nodes that would create a cycle (a group into itself or into its own descendant) and nodes rejected bycanGroup. It does not check that the target hasisGroup: true.removeFromGroupchanges only nodes whosegroupIdis the given id.ungroupabove makes the children top-level. For a nested group,addToGroup(parentId, childIds)keeps them in the outer group instead (canGroupapplies, and a rejected child would be deleted with the group).groupMembershipChanged({ grouped: { nodes, targetGroup }[], ungrouped }) fires for drag and drop,addToGroup/removeFromGroupandupdateNodesthat changegroupId— not for a singleupdateNode(id, { groupId }).- Queries:
getChildren(direct),getChildrenNested(all descendants),getParentHierarchy(nodeId)(closest parent first),isNestedChild(nodeId, groupId). fitToChildrenrelies oncomputePartsBounds(children, []), which uses the children'smeasuredBounds. The filter keeps a collapsed or not yet measured group where it is (without it the group would move to the origin). Before 1.4.0 an empty edge list also pulled the result to the point (0, 0).
Resizing groups
- With
resize.allowResizeBelowChildrenBounds: falsea group cannot be resized smaller than the box around its visible children. Children count with theirmeasuredBounds, so their ports and rotation count too. - Effectively hidden children never limit the resize (since 1.4.0), so a collapsed group can be resized freely.
- Since 1.3.0: with resize snapping, a group resized from the bottom/right no longer jumps, and a snapped size that would cut children rounds up to the next snap value that still contains them.
NgDiagramNodeService.resizeNodeapplies the same rules and works on an unselected group since 1.3.0. A resize gesture, orresizeNodeon a group with visible children, setsautoSize: false; for an empty (or collapsed) group passdisableAutoSize: true. Handles and snapping:ng-diagram-resize-rotate-snap.
Deleting, copying, hiding and layering
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ng-diagram-groups/SKILL.md
Popularity
- Repository stars
- 583
- Repository forks
- 41
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
templateCustom templates for code generation
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/synergycodes/ng-diagram/ng-diagram-groups)