sandgardenhq/sgai/stpa-step1-define-purpose
Claude Code and agent skill by sandgardenhq/sgai
- community
Checking that the SKILL.md file is still in the repository.
STPA Step 1 - Define the purpose of analysis by identifying losses, hazards, and system-level constraints. When beginning STPA analysis. After loading stpa/overview. When you need to establish what could go wrong and what must be prevented.
Install
npx vskill@latest install sandgardenhq/sgai/stpa-step1-define-purposeSKILL.md
STPA Step 1: Define Purpose of Analysis
Objective
Establish the foundation for the entire STPA analysis by identifying:
- Losses - What we absolutely cannot afford to happen
- Hazards - System states that could lead to those losses
- System-Level Constraints - What the system must do/not do to prevent hazards
Announce at Start
"I'm using the STPA Step 1 skill to define the purpose of our analysis. We'll identify losses, hazards, and constraints through a series of questions."
Phase 1: Identify Losses (L)
Questions to Ask (ONE at a time)
Q1: What are the unacceptable outcomes for this system?
- Examples for software: data loss, unauthorized access, system downtime, financial loss
- Examples for physical: injury, property damage, environmental harm
- Examples for AI: biased decisions, safety violations, unintended actions
Q2: For each loss, how severe is the impact?
- Critical: Immediate danger or catastrophic failure
- Serious: Significant damage or major disruption
- Moderate: Notable impact but recoverable
- Minor: Inconvenience with minimal lasting effect
Recording Losses
Phase 2: Identify Hazards (H)
Definition
A hazard is a system state or set of conditions that, together with a worst-case set of environmental conditions, will lead to a loss.
Questions to Ask
Q1: What system states could lead to [Loss L-1]?
- Think about the system's behavior, not component failures
- Focus on what the SYSTEM does, not what COMPONENTS do
Q2: Under what environmental conditions would this hazard lead to the loss?
- Worst-case scenarios
- Concurrent conditions that compound risk
Hazard Template
Examples
Software System:
- H-1: Authentication service grants access to unauthorized users [→ L-2, L-4]
- H-2: Database writes incomplete transaction records [→ L-2]
Physical System:
- H-1: Vehicle accelerates when driver intends to stop [→ L-1]
- H-2: Pressure vessel exceeds safe operating limits [→ L-1, L-3]
AI System:
- H-1: ML model recommends unsafe medication dosage [→ L-1]
- H-2: Autonomous agent takes actions outside approved scope [→ L-1, L-4]
Recording Hazards
Phase 3: Define System-Level Constraints (SC)
Definition
System-level constraints specify what the system must do or must NOT do to prevent hazards.
Derivation Rule
For each hazard, derive at least one constraint that, if enforced, prevents the hazard.
Constraint Template
Examples
From H-1 (auth service):
- SC-1: Authentication service must verify credentials before granting access [→ H-1]
- SC-2: Authentication service must never bypass verification checks [→ H-1]
From H-1 (vehicle):
- SC-1: Vehicle must decelerate when brake is applied [→ H-1]
- SC-2: Vehicle must never accelerate during brake application [→ H-1]
Recording Constraints
Validation Questions
Before proceeding to Step 2, verify:
- Completeness: "Are there any other losses you can think of?"
- Traceability: "Does each hazard trace to at least one loss?"
- Coverage: "Does each hazard have at least one constraint?"
- Clarity: "Are the constraints specific enough to be verifiable?"
Output Template
Record in .sgai/PROJECT_MANAGEMENT.md:
When to Proceed to Step 2
Move to Step 2 when:
- [ ] All significant losses are identified
- [ ] Each loss has at least one associated hazard
- [ ] Each hazard has at least one constraint
- [ ] Human partner confirms the analysis looks complete
Load: skills({"name":"stpa/step2-control-structure"})
Security
- Security scanPassed, 100 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 repositoryCheckingcmd/sgai/skel/.sgai/skills/stpa/stpa-step1-define-purpose/SKILL.md
Popularity
- Repository stars
- 133
- Repository forks
- 9
- 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-step1-define-purpose)