sandgardenhq/sgai/stpa-step2-control-structure
Claude Code and agent skill by sandgardenhq/sgai
- community
Checking that the SKILL.md file is still in the repository.
STPA Step 2 - Model the control structure using hierarchical control-feedback diagrams in Graphviz/DOT format; After completing STPA Step 1. When you need to understand how control flows through a system. When identifying controllers, control actions, and feedback paths.
Install
npx vskill@latest install sandgardenhq/sgai/stpa-step2-control-structureSKILL.md
STPA Step 2: Model the Control Structure
Objective
Create a hierarchical model showing:
- Controllers (humans, software, hardware that make decisions)
- Control Actions (commands sent to controlled processes)
- Feedback (information returned to controllers)
- Controlled Processes (entities being controlled)
Announce at Start
"I'm using the STPA Step 2 skill to model the control structure. We'll identify controllers, control actions, and feedback paths."
Key Concepts
What is a Control Structure?
A control structure shows the hierarchical relationships between:
- Higher-level controllers that set goals/constraints
- Lower-level controllers that implement those constraints
- Controlled processes that execute actions
- Feedback loops that provide information back up
Why Control Structures?
- Traditional dataflow diagrams don't show control hierarchy
- STPA focuses on feedback paths often neglected in design
- Abstracts complex systems to 10-15 manageable boxes
- Narrows search from millions of lines of code to specific decisions
Phase 1: Identify Controllers
Questions to Ask
Q1: Who or what makes control decisions in this system?
- Human operators/users
- Software components (services, modules, agents)
- Hardware controllers (PLCs, microcontrollers)
- External systems that provide input
Q2: What is the hierarchy of control?
- Which controllers give commands to others?
- Who has override authority?
- What is the chain of command?
Controller Examples
Software System:
- API Gateway, Authentication Service, Database Controller, User
Physical System:
- Plant Manager, Control Room Operator, PLC, Valve Actuator
AI System:
- Human Operator, Orchestrator, ML Model, Action Executor
Phase 2: Identify Control Actions
Questions to Ask
Q1: What commands does [Controller] send to [Controlled Process]?
- Start/Stop commands
- Configuration changes
- Data modifications
- Enable/Disable actions
Q2: When are these control actions sent?
- On user request
- On schedule
- In response to feedback
- Based on system state
Control Action Examples
| Controller | Control Action | Controlled Process | |
|---|---|---|---|
| User | Submit Login | Auth Service | |
| Auth Service | Issue Token | Session Manager | |
| Orchestrator | Execute Task | ML Model | |
| PLC | Open Valve | Pressure Vessel |
Phase 3: Identify Feedback Paths
Questions to Ask
Q1: What information does [Controlled Process] send back to [Controller]?
- Status information (running, stopped, error)
- Measurement data (temperature, pressure, counts)
- Acknowledgments (success, failure)
- Alerts and warnings
Q2: How does the controller use this feedback?
- To verify actions completed
- To adjust future control actions
- To detect anomalies
- To report to higher-level controllers
Common Missing Feedback
- Confirmation that action was received
- Confirmation that action was executed correctly
- Confirmation that desired effect was achieved
- Time taken to complete action
Graphviz/DOT Template
Diagram Conventions
Layout
rankdir=TB- Top to bottom flow- Higher authority at top, controlled processes at bottom
Node Style
node [shape=box]- All nodes are rectangular boxes- Clear, descriptive labels
Edge Style
- Solid arrows: Control actions (pointing down/to controlled)
- Dashed arrows: Feedback (pointing up/to controller)
- Labels: Describe what is being communicated
Validation Questions
Before proceeding to Step 3:
Q1: Is every controller-controlled relationship shown? Q2: Does every control action have corresponding feedback? Q3: Are there any hidden controllers we haven't identified? Q4: Are there any feedback paths that are missing or delayed?
Output Template
Record in .sgai/PROJECT_MANAGEMENT.md:
digraph ControlStructure { rankdir=TB; node [shape=box];
// [Insert diagram here] }
When to Proceed to Step 3
Move to Step 3 when:
- [ ] All controllers are identified and placed in hierarchy
- [ ] All control actions are documented
- [ ] All feedback paths are identified (or gaps noted)
- [ ] Human partner confirms the structure looks accurate
Load: skills({"name":"stpa/step3-unsafe-control-actions"})
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcmd/sgai/skel/.sgai/skills/stpa/stpa-step2-control-structure/SKILL.md
Popularity
- Repository stars
- 113
- Repository forks
- 6
- 7-day trend score
- 24
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 27 Mar 2026, 7 months ago.
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/sandgardenhq/sgai/stpa-step2-control-structure)