promptdojo_

Architecting an AI-native workflow — a 5-step playbook in code — step 8 of 9

Write is_ai_native_ready(spec) that returns a dict with:

  • score: float, fraction of REQUIRED fields present (rounded to 2)
  • missing: list of required field names not in the spec
  • has_explicit_policies: True iff EVERY value in spec.get("policies", {}) is a dict (not a string — "ask Sarah" is a string and disqualifies)
  • business_metrics_only: True iff spec.get("metrics", []) contains NONE of these vanity strings: "hours_saved", "hours_saved_per_week", "engagement", "vibes"
  • ready: True iff score >= 0.85 AND has_explicit_policies AND business_metrics_only

Two specs run. Expected output:

{'score': 1.0, 'missing': [], 'has_explicit_policies': True, 'business_metrics_only': True, 'ready': True}
{'score': 0.43, 'missing': ['decisions', 'error_sites', 'success_criteria', 'tacit_knowledge'], 'has_explicit_policies': False, 'business_metrics_only': False, 'ready': False}

full-screen editor opens — close anytime to keep reading.