agentleFS
f22363712-dotcomf22363712-dotcom/fbd-skill/sop-creator/SKILL.md

sop-creator

Skill1 starsChanged 6 months agoMITView on GitHub

Generate deterministic state-machine SOPs that transform probabilistic AI into reliable automation pipelines

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

24 rules. 0 are common, 21 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 21

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ensure consistent execution across iterations

    line 22
  2. Distinctive:

    Create auditable, verifiable processes

    line 24
  3. Very specific:

    Use assets/state-machine-sop.md as template

    line 145
  4. Distinctive:

    Ensure < 200 lines per section

    line 147
  5. Very specific:

    Create scripts/validate_state{N}.sh for each state

    line 151
  6. Very specific:

    Use assets/gateway-template.sh as base

    line 152
  7. Distinctive:

    Ensure scripts return proper exit codes

    line 154
  8. Distinctive:

    All SOP files generated

    line 183
  9. Distinctive:

    Verify exit codes (0 for pass, non-zero for fail)

    line 189
  10. Distinctive:

    Check error messages are actionable

    line 190
  11. Distinctive:

    Verify state machine completeness

    line 193
  12. Distinctive:

    Check all states have gateways

    line 194
  13. Distinctive:

    Ensure error handling present

    line 195
  14. Distinctive:

    MUST NOT generate SOPs without validation gateways

    line 239
  15. Distinctive:

    MUST NOT create states without exit conditions

    line 240
  16. Distinctive:

    MUST NOT skip gateway script generation

    line 241
  17. Distinctive:

    MUST NOT exceed 200 lines per SOP section

    line 242
  18. Distinctive:

    MUST NOT use vague language ("should", "might", "consider")

    line 243
  19. Distinctive:

    MUST use imperative language ("MUST", "FORBIDDEN")

    line 246
  20. Distinctive:

    MUST include error handling for each state

    line 247
  21. Distinctive:

    MUST generate executable gateway scripts

    line 248
  22. Distinctive:

    MUST validate all outputs before proceeding

    line 249
  23. Distinctive:

    MUST update progress after each state

    line 250
  24. Distinctive:

    DO NOT proceed until user responds

    line 295

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SOP Creator: VibeCoding Meta-Skill

Transform natural language requirements into high-certainty state machine workflows.

Purpose

This skill generates Standard Operating Procedures (SOPs) that constrain AI behavior through:

  • Physical validation gateways (exit code enforcement)
  • Explicit state machines (finite, auditable transitions)
  • Built-in error handling (degradation ladders)
  • Structured I/O (typed inputs/outputs)

When to Use

Invoke /sop-creator when you need to:

  • Automate multi-step workflows with AI
  • Ensure consistent execution across iterations
  • Prevent context drift and premature actions
  • Create auditable, verifiable processes

State Machine

INIT → REQUIREMENTS → DESIGN → GENERATION → VALIDATION → COMPLETE
  ↓        ↓            ↓          ↓            ↓
[Gate]   [Gate]      [Gate]    [Gate]       [Gate]

State 1: REQUIREMENTS

Entry Conditions

  • User has provided workflow description
  • Working directory is writable

Actions

  1. Extract Core Requirements
    • Identify workflow trigger condition
    • Define expected deliverables
    • List critical constraints
    • Determine validation criteria
  2. Generate requirements.json
    {
      "workflow_name": "string",
      "purpose": "string",
      "trigger": "string",
      "deliverables": ["string"],
      "constraints": ["string"],
      "states": ["string"],
      "validation_methods": ["string"]
    }

Validation Gateway

Script: scripts/validate_requirements.py

Checks:

  • requirements.json exists and is valid JSON
  • All required fields present
  • At least 3 states defined
  • At least 1 validation method per state

Exit Conditions

  • requirements.json created
  • Gateway returns exit code 0
  • User approves requirements

Next State

→ DESIGN (if approved) → REQUIREMENTS (if rejected - revise)


State 2: DESIGN

Entry Conditions

  • requirements.json exists and validated
  • User approval received

Actions

  1. Design State Transitions
    • Map state flow diagram
    • Define entry/exit conditions per state
    • Specify allowed actions per state
    • Design validation gateways
  2. Generate design.json
    {
      "states": [
        {
          "name": "string",
          "purpose": "string",
          "entry_conditions": ["string"],
          "actions": ["string"],
          "exit_conditions": ["string"],
          "gateway_script": "string",
          "next_states": ["string"]
        }
      ],
      "global_constraints": ["string"],
      "error_handling": {
        "max_retries": 3,
        "escalation_actions": ["string"]
      }
    }

Validation Gateway

Script: scripts/validate_design.py

Checks:

  • design.json exists and is valid JSON
  • All states have entry/exit conditions
  • All states have gateway scripts defined
  • State transitions form valid DAG (no orphans)
  • Error handling defined

Exit Conditions

  • design.json created
  • Gateway returns exit code 0
  • State machine is acyclic (except retry loops)

Next State

→ GENERATION


State 3: GENERATION

Entry Conditions

  • design.json exists and validated
  • Output directory specified

Actions

  1. Generate SOP Markdown
    • Use assets/state-machine-sop.md as template
    • Populate with design.json data
    • Ensure < 200 lines per section
    • Add workflow-specific constraints
  2. Generate Gateway Scripts
    • Create scripts/validate_state{N}.sh for each state
    • Use assets/gateway-template.sh as base
    • Implement validation logic from design.json
    • Ensure scripts return proper exit codes
  3. Generate Support Files
    • Create progress.md template
    • Create errors.log template
    • Create BLOCKED.md template

Validation Gateway

Script: scripts/validate_generation.py

Checks:

  • SOP markdown file exists
  • All gateway scripts exist and are executable
  • progress.md template exists
  • All placeholders replaced

Exit Conditions

  • All files generated
  • Gateway returns exit code 0
  • No [PLACEHOLDER] text remains

Next State

→ VALIDATION


State 4: VALIDATION

Entry Conditions

  • All SOP files generated
  • Gateway scripts executable

Actions

  1. Dry-Run Test
    • Execute each gateway script with test data
    • Verify exit codes (0 for pass, non-zero for fail)
    • Check error messages are actionable
  2. Structure Validation
    • Verify state machine completeness
    • Check all states have gateways
    • Ensure error handling present
    • Validate constraint clarity
  3. Generate Validation Report
    # SOP Validation Report
    
    ## Gateway Tests
    - [x] validate_state1.sh: PASS
    - [x] validate_state2.sh: PASS
    
    ## Structure Checks
    - [x] All states have entry/exit conditions
    - [x] All gateways return proper exit codes
    - [x] Error handling defined
    
    ## Issues Found
    [List any issues]
    
    ## Status: READY / NEEDS_REVISION

Validation Gateway

Script: scripts/final_validation.sh

Checks:

  • All state gateways executable
  • Test execution successful
  • No structural issues found
  • Validation report shows READY

Exit Conditions

  • Validation report generated
  • Gateway returns exit code 0
  • Status = READY

Next State

→ COMPLETE


Global Constraints

FORBIDDEN Actions

  • MUST NOT generate SOPs without validation gateways
  • MUST NOT create states without exit conditions
  • MUST NOT skip gateway script generation
  • MUST NOT exceed 200 lines per SOP section
  • MUST NOT use vague language ("should", "might", "consider")

REQUIRED Behaviors

  • MUST use imperative language ("MUST", "FORBIDDEN")
  • MUST include error handling for each state
  • MUST generate executable gateway scripts
  • MUST validate all outputs before proceeding
  • MUST update progress after each state

Error Handling

Degradation Ladder

Level 1: First Failure

  • Log error to errors.log
  • Analyze validation output
  • Retry with corrections

Level 2: Second Failure

  • Log error to errors.log
  • Review reference documentation
  • Check constraint violations
  • Retry with revised approach

Level 3: Third Failure (ESCALATION)

  • Log error to errors.log
  • STOP all generation
  • Create BLOCKED.md:
    # SOP Generation Blocked
    
    ## State: [STATE_NAME]
    ## Attempts: 3
    
    ## Problem
    [Description]
    
    ## Gateway Output
    [Full output]
    
    ## Tried Approaches
    1. [Approach 1 - why failed]
    2. [Approach 2 - why failed]
    3. [Approach 3 - why failed]
    
    ## Questions
    1. [Specific question]
    2. [Clarification needed]
  • Request user intervention
  • DO NOT proceed until user responds

Output Structure

{output_directory}/
├── {workflow_name}_sop.md    # Main SOP document
├── progress.md               # Progress tracking template
├── errors.log                # Error log template
├── BLOCKED.md                # Escalation template (if needed)
├── scripts/
│   ├── validate_state1.sh    # Gateway for state 1
│   ├── validate_state2.sh    # Gateway for state 2
│   ├── validate_state3.sh    # Gateway for state 3
│   └── final_validation.sh   # Final validation
└── .sop-metadata.json        # Generation metadata

Usage Example

# Invoke the skill
/sop-creator

# Provide requirements when prompted
"Create an SOP for deploying a Docker container to production"

# Review generated requirements.json
# Approve or request revisions

# Skill generates complete SOP package
# All files created in specified output directory

# Test the generated SOP
cd output_directory
bash scripts/validate_state1.sh

References

  • VibeCoding Principles: references/vibecoding-principles.md
  • Gateway Design: references/engineering-gateways.md
  • SOP Template: assets/state-machine-sop.md
  • Gateway Templates: assets/gateway-template.{sh,py}

Version History

  • 1.0.0 - Initial release with 4-state generation pipeline

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.