Back to list
mthangtr

diagram-maker

by mthangtr

My curated prompt library — organized for every workflow, idea, and experiment.

0🍴 0📅 Jan 15, 2026

SKILL.md


name: diagram-maker description: >- Create state machine diagrams of existing components to map out all code paths and verify system understanding. Use when analyzing user flows, authentication, multi-step processes, or any stateful logic to ensure comprehensive coverage of all transitions, edge cases, and error paths.

Diagram Maker

Create state machine diagrams using Mermaid syntax. This forces comprehensive analysis of ALL code paths, preventing lazy AI behavior that skips edge cases and error handling.

Why State Machines?

  1. Forces complete path mapping - Must scan ALL if-else branches, switch-case, error states
  2. Prevents lazy "happy path only" thinking - Must answer: "If in CHECKING state and timeout occurs, where does it go?"
  3. Reveals true system logic - States are the soul of the system. Wrong state understanding = wrong business logic

When to Use

  • Analyzing existing components with complex state logic
  • Verifying AI understands all state transitions correctly
  • Finding missing error paths or race conditions
  • Before implementing state-heavy features
  • Documenting complex multi-step processes

State Machine Template

stateDiagram-v2
    [*] --> InitialState: trigger
    
    InitialState --> NextState: action/condition
    InitialState --> ErrorState: error condition
    InitialState --> [*]: exit condition
    
    NextState --> FinalState: completion
    
    note right of InitialState
        Additional context or
        implementation details
    end note
    
    note right of NextState
        API calls, validations,
        or business logic
    end note

Conventions

  • State names: PascalCase (e.g., LoadingData, RequestPending)
  • Separate concerns:
    • UI states: Selecting, Loading, Entering
    • Backend states: Pending, Confirmed, Completed
  • Always show error paths: Timeout, API failure, validation errors
  • Add notes for:
    • API endpoints: POST /api/resource
    • DB mutations: status="pending"
    • Race conditions: Double-check logic
    • Validations: Format checks, conflicts
    • Business logic: Conditional flows, auto-actions

Critical: Map ALL Paths

Don't be lazy! For each state, ask:

  • ✅ What if API fails?
  • ✅ What if timeout?
  • ✅ What if validation error?
  • ✅ What if user goes back?
  • ✅ What if race condition?

If you can't answer = you don't understand the system = read more code.

Workflow

  1. Read code thoroughly - Component, API routes, queries
  2. List ALL states - UI states + DB status values
  3. Map transitions - Include error paths, not just success
  4. Verify completeness - Every state must have exit conditions
  5. Add notes - API calls, validations, business rules

Score

Total Score

45/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon