Agent skill
sequence-diagram
This skill should be used when the user asks to "create a sequence diagram", "update a sequence diagram", "draw a sequence diagram", "visualize component interactions", or needs to represent time-ordered interactions between actors or system components using Mermaid.
Install this agent skill to your Project
npx add-skill https://github.com/hhk7734/hhk7734/tree/main/skills/sequence-diagram
SKILL.md
Update Sequence Diagram
When to use this skill
Use this skill when creating a new Mermaid sequence diagram or updating an existing one. This covers syntax for participants, messages, activations, notes, loops, alternative paths, and parallel actions.
Instructions
- Start with
sequenceDiagram: Every sequence diagram must start with this keyword. - Define Participants (Optional):
- Implicit:
Alice->>Bob: Hello John, how are you? - Explicit:
participant Aliceorparticipant A as Alice - Participant Types:
actor Alice(Stick figure)participant Alice @{ "type": "boundary" }participant Alice @{ "type": "control" }participant Alice @{ "type": "entity" }participant Alice @{ "type": "database" }participant Alice @{ "type": "collections" }participant Alice @{ "type": "queue" }- Note: Do not use
asalias and@{ "type": ... }simultaneously.
- Implicit:
- Actor Creation and Destruction:
- Create: Add
create participant <Name>before the message that creates it.mermaidcreate participant B A->>B: Hello - Destroy: Add
destroy <Name>before the message that destroys it.mermaiddestroy B A->>B: Delete
- Create: Add
- Use Correct Message Syntax:
->Solid line without arrow-->Dotted line without arrow->>Solid line with arrowhead-->>Dotted line with arrowhead-xSolid line with a cross at the end--xDotted line with a cross at the end-)Solid line with an open arrow at the end (async)--)Dotted line with an open arrow at the end (async)
- Manage Activations:
- Explicit:
activate Alice...deactivate Alice - Shorthand:
Alice->>+Bob: Hello(activate Bob),Bob-->>-Alice: Hi(deactivate Bob)
- Explicit:
- Add Notes:
Note right of Alice: TextNote left of Alice: TextNote over Alice: TextNote over Alice,Bob: Text spanning both
- Control Flow:
- Loop:
loop Loop text ... end - Alt:
alt Describing text ... else ... end - Opt:
opt Describing text ... end - Par:
par [Action 1] ... and [Action 2] ... end - Critical:
critical [Action] ... option [Circumstance] ... end - Break:
break [something happened] ... end
- Loop:
- Multi-line Text: Use
<br/>instead of\nfor line breaks in messages and notes. - Background Highlighting:
rect rgb(0, 255, 0) ... endrect rgba(0, 0, 255, .1) ... end
- Sequence Numbers:
- Add
autonumberto the beginning of the diagram to automatically number messages.
- Add
Example
sequenceDiagram
autonumber
actor U as User
participant C as Client
participant S@{ "type": "control" }
participant Database@{ "type": "database" }
U->>C: Request Data
activate C
create participant T as Task
C->>T: Start Task
T-->>C: Task Started
destroy T
C->>T: Stop Task
C->>S: API Call
activate S
S->>Database: Query
activate Database
Database-->>S: Result
deactivate Database
S-->>C: Response
deactivate S
C-->>U: Display Data
deactivate C
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
flowchart
This skill should be used when the user asks to "create a flowchart", "update a flowchart", "draw a flowchart", "visualize a workflow", "diagram a process or algorithm", or needs to represent decision trees, state transitions, or workflows using Mermaid.
using-git-worktrees
This skill should be used when the user asks to "create a worktree", "set up an isolated workspace", "use git worktrees", or is starting feature work that needs isolation from the current workspace. Also use this before executing any implementation plan that requires a clean branch baseline.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
setup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
scaffold-exercises
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
Didn't find tool you were looking for?