Skip to content

Check_prd

FieldValue
TypeSkill Resource
Source~/.copilot/skills/product/scripts/check_prd.py
DescriptionNot specified

Source Content

#!/usr/bin/env python3
"""Check a PRD has every required section, non-empty.
Usage: check_prd.py <prd.md>
"""
import re
import sys
REQUIRED = ["Problem", "Goals", "Requirements", "Success Metrics", "Scope", "Open Questions"]
def main() -> int:
if len(sys.argv) != 2:
print("Usage: check_prd.py <prd.md>", file=sys.stderr)
return 2
text = open(sys.argv[1], encoding="utf-8").read()
headings = re.split(r"^#{1,3}\s+", text, flags=re.MULTILINE)
fail = 0
for section in REQUIRED:
match = re.search(rf"^#{{1,3}}\s+.*{re.escape(section)}.*$", text, re.IGNORECASE | re.MULTILINE)
if not match:
print(f"❌ missing required section: {section}")
fail = 1
continue
start = match.end()
rest = text[start:]
next_heading = re.search(r"\n#{1,3}\s", rest)
body = rest[:next_heading.start()] if next_heading else rest
if not body.strip():
print(f"❌ section '{section}' present but empty")
fail = 1
else:
print(f"✅ section '{section}' present and non-empty")
return fail
if __name__ == "__main__":
raise SystemExit(main())