본문으로 건너뛰기
Skillpedia
테스트15k · #10997

statechart

하는 일

스킬은 제품 흐름, 프로토콜, 서비스의 형식 모델을 만들어 규칙과 대조합니다. 버그를 상태들을 거치는 경로로 보고 싶은 사람을 위한 스킬입니다.

사용하는 경우

  • ✓버그가 여러 단계나 화면의 순서에 달려 있을 때.
  • ✓시스템이 상태 사이를 어떻게 옮겨 가는지 다이어그램으로 보고 싶을 때.
  • ✓규칙이 성립하는지 증명하거나, 그 규칙을 깨는 경로가 필요한 경우.

스킬 링크

https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/statechart/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/statechart/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“결제 흐름의 상태 차트를 보여 주고, 이중 결제로 이어지는 가장 짧은 경로를 알려 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 시스템의 TLA+ 명세를 작성하고, 모델 검사기를 실행하며, 상태를 Mermaid 차트로 그립니다. 규칙이 깨지면 보고서에는 그 원인이 되는 가장 짧은 단계 순서가 제시됩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Statechart

The chart shows how a system moves between states, in the words of the person who reads it. That person, the reader, decides whether the behavior is right.

Run

Work in a scratch folder outside the repo. Write a TLA+ spec and its config. Then run:

<skill dir>/scripts/statechart SPEC.tla [--config FILE] [--view FILE] [--out DIR]

scripts/statechart.ts is TypeScript, so run it with a runtime that can execute TypeScript.

The first run installs TLC and Java with mise and needs the network.

Write the spec

  • Write each rule that the reader agrees to as an INVARIANT. A rule can be about a screen, a result, a stored value, or a message. If the model has no variable for a rule, add the variable. Never weaken a rule to make it hold.
  • Write Next as a disjunction of the actions, such as YouPressPlay \/ YouPressStop. If you do not, TLC names every step Next.
  • A state with no step out breaks NoDeadlock, also when it is a correct end state. When an INVARIANT or a PROPERTY already has that name, the rule is CHECK_DEADLOCK. Add to Next an action that is true only in the end states and changes nothing, such as Done == phase \in {"paid", "failed"} /\ UNCHANGED vars, and give it a label in step().

Pick the chart

You do the work that needs judgment: the words on each state and arrow, the phases and their colors, the title, and the report to the reader. Put your work in a view module, and give it with --view.

To show the reader's words, the view exports state(vars). The value that state() returns picks the form:

  • A string gives a flat chart: export const state = (v) => (v.paid ? "Paid" : "Paying");
  • An array gives parent states: export const state = (v) => v.main.split(".");
  • An object gives one parallel region for each key: export const state = (v) => ({ Playback: v.playback, Volume: v.volume });

Label each state with what the reader can see or cares about, such as "Paying" or "Lease held, write pending". Keep variable names out of labels. In vars, a TLA+ sequence is an object with keys from 1, so v.pc[1] is pc[1]. A set is an array.

The view can also export step(action, from, to). It gets the TLC action name and the values before and after the step, and it returns the label of the arrow. Write each step label as the user sees it happen, such as "you press play" or "the connect fails". Do not name the code or the TLA+ action. Two actions that end the same in the chart get the same label, so that they share one arrow.

When a step can occur only in some conditions, end its label with the condition in brackets, in the reader's words, such as you press play [while the file loads]. In a regions chart, the command writes the condition on the other regions on the arrow, in the words of their labels, such as [when Offline]. Your brackets replace it, and two arrows from one state can then look the same. So in a regions chart, do not write brackets for a condition on another region. When a value that no label shows decides where a step goes, name the result in the label, such as "the roster read fails".

The view can also export these:

  • group(vars) returns the name of a phase. Each chart state gets the color of its group. When the model states behind one chart state are in different groups, that state gets no color.
  • colors gives each group name a color class.
  • title is a string that the chart shows at the top.

The command calls state() and group() at most once for each model state, and step() at most once for each step. The chart and the report both use those answers. So make each function depend only on its arguments.

The chart does not draw a step that stays in one label. Split a label when the reader must see such a step.

Aim for about 20 arrows or fewer, because a busier chart is hard to read. First return coarser labels from state(). Give one label to values that act the same, and leave out a detail that the reader does not need, such as a call in flight whose return changes nothing. Keep each state of a bug path, and keep each mark. When a merge changes a breaks state to mayBreak, it hides where a rule breaks. Do not merge two states that break different rules, because the reader then cannot see which rule breaks where. If the chart is still too busy, return null from step() for the steps that the reader does not need, such as a reset that every state has, or a step whose arrow repeats what other arrows show. Obey these r

자주 묻는 질문

TLA+를 알아야 하나요?

아니요. 명세는 에이전트가 쓰지만, 시스템이 따라야 할 규칙에는 사용자가 동의해야 합니다.

처음 실행에 인터넷이 필요한가요?

네. 처음 실행하면 모델 검사기와 Java를 설치하므로 네트워크 연결이 필요합니다.

검사를 통과하려고 규칙을 약화할 수 있나요?

아니요. 이 스킬은 규칙을 약화해서 성립시키는 일을 결코 하지 말라고 말합니다.

상세 정보

작성자의 원본 설명

Check a TLA+ model of a system that moves between states, such as a product flow, a protocol, or a service, and draw it as a Mermaid statechart. The report gives the shortest path to each state that breaks a rule. Use for /statechart, or to show a bug as a path through states.

repo: cursor/plugins

인기도

GitHub 스타
15k
순위
#10997
라이선스
—
업데이트
2026. 10. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬