Spec-driven development on OpenSpec, with mechanical spec-as-source enforcement: a custom 'spec-as-source' OpenSpec schema adds file-ownership (targets) and test-verification ([@test]) metadata to every capability spec, three scripts (link check, ownership check, manifest build) keep code and specs from drifting apart, plus requirement-gathering, spec-writer, work-review, and a session-handoff skill with a proactive context-warning hook.
68
85%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
#!/usr/bin/env python3
# GENERATED FROM SPEC — DO NOT EDIT DIRECTLY
# Source: openspec/specs/prompt-engineer/spec.md
"""Mechanical checks for prompt-engineer (design D4).
check_engineered.py --input <REFINED_PROMPT.md>
Input check only: the file is readable, has a lock register, and its
coverage table covers each of the eight engineering blocks with an
active lock id. An uncovered block goes back to prompt-loop.
check_engineered.py <REFINED_PROMPT.md> <ENGINEERED_PROMPT.md> [--rules PATH]
Input check, then the output checks: required sections present; every
lock-register entry of the input byte-identical in the output; no
reasoning-scripting phrase in the engineered prompt; every change-log
entry cites an R<n> that exists in the rule corpus; the recommended
effort is one of the allowed values.
Exit 0 when every check passes, 1 otherwise (each failure named on stderr),
2 on a usage error. Standard library only.
"""
import re
import sys
from pathlib import Path
BLOCKS = [
"objective",
"context and source priority",
"scope",
"tools policy",
"action boundaries",
"verification",
"output",
"stop condition",
]
REQUIRED_SECTIONS = [
"Engineered prompt",
"Change log",
"Lock register",
"Open questions",
"Recommended effort",
]
# Reasoning scripting and reasoning extraction (PROMPTING_RULES.md R9, R10).
# A finite net, not the judge: paraphrases stay the subagent's job.
BANNED_PHRASES = [
"think step by step",
"think carefully",
"think hard",
"take a deep breath",
"show your reasoning",
"show your chain of thought",
"explain your chain of thought",
"reveal your reasoning",
]
EFFORTS = ["low", "medium", "high", "xhigh", "max"]
DEFAULT_RULES = Path(__file__).resolve().parent.parent / "references" / "PROMPTING_RULES.md"
def sections(text):
"""Map each level-2 heading to the text beneath it."""
out, current, buf = {}, None, []
for line in text.splitlines():
m = re.match(r"^## (.+?)\s*$", line)
if m:
if current is not None:
out[current] = "\n".join(buf)
current, buf = m.group(1), []
elif current is not None:
buf.append(line)
if current is not None:
out[current] = "\n".join(buf)
return out
def bullet_entries(body):
"""Top-level '- ' bullets, each with its indented continuation lines."""
entries = []
for line in body.splitlines():
if line.startswith("- "):
entries.append(line)
elif entries and line.startswith((" ", "\t")) and line.strip():
entries[-1] += "\n" + line
return entries
def lock_id(entry):
m = re.search(r"\*\*(L\d+)\*\*", entry)
return m.group(1) if m else None
def check_input(path):
"""Return (errors, lock entries) for a REFINED_PROMPT.md."""
p = Path(path)
try:
text = p.read_text(encoding="utf-8")
except OSError as exc:
return [f"input not readable: {path} ({exc.strerror})"], []
secs = sections(text)
if "Lock register" not in secs:
return [f"input has no lock register: {path} — a REFINED_PROMPT.md confirmed by prompt-loop is required"], []
locks = bullet_entries(secs["Lock register"])
if not locks:
return [f"input lock register is empty: {path}"], []
active = {lock_id(e) for e in locks if not e.startswith("- ~~")} - {None}
covered = {}
for line in secs.get("Coverage gate", "").splitlines():
cells = [c.strip() for c in line.strip().strip("|").split("|")]
if len(cells) >= 2 and cells[0].lower() in BLOCKS:
covered[cells[0].lower()] = set(re.findall(r"\bL\d+\b", cells[1]))
errors = []
for block in BLOCKS:
ids = covered.get(block, set())
if not ids & active:
errors.append(
f"uncovered block: {block} — no active lock covers it; "
"the document goes back to prompt-loop"
)
return errors, locks
def check_output(path, input_locks, rules_path):
p = Path(path)
try:
text = p.read_text(encoding="utf-8")
except OSError as exc:
return [f"output not readable: {path} ({exc.strerror})"]
secs = sections(text)
errors = [f"missing required section: ## {s}" for s in REQUIRED_SECTIONS if s not in secs]
out_locks = set(bullet_entries(secs.get("Lock register", "")))
for entry in input_locks:
if entry not in out_locks:
errors.append(f"lock {lock_id(entry) or '?'} missing or altered in the output: {entry}")
prompt = secs.get("Engineered prompt", "").lower()
for phrase in BANNED_PHRASES:
if phrase in prompt:
errors.append(f"reasoning-scripting phrase in the engineered prompt: \"{phrase}\"")
try:
corpus = Path(rules_path).read_text(encoding="utf-8")
except OSError as exc:
return errors + [f"rule corpus not readable: {rules_path} ({exc.strerror})"]
known = set(re.findall(r"^\*\*R(\d+) —", corpus, re.M))
for entry in bullet_entries(secs.get("Change log", "")):
cited = re.findall(r"\bR(\d+)\b", entry)
if not cited:
errors.append(f"change-log entry cites no rule: {entry[2:]}")
for n in cited:
if n not in known:
errors.append(f"change-log entry cites R{n}, absent from the rule corpus: {entry[2:]}")
if "Recommended effort" in secs:
body = re.sub(r"<!--.*?-->", "", secs["Recommended effort"], flags=re.S)
values = [l.strip().strip("`*").strip() for l in body.splitlines() if l.strip()]
if len(values) != 1 or values[0] not in EFFORTS:
found = "; ".join(values) or "nothing"
errors.append(f"Recommended effort must be one of {', '.join(EFFORTS)}; found: {found}")
return errors
def main(argv):
args = list(argv)
rules = DEFAULT_RULES
if "--rules" in args:
i = args.index("--rules")
if i + 1 >= len(args):
print(__doc__, file=sys.stderr)
return 2
rules = args[i + 1]
del args[i:i + 2]
if len(args) == 2 and args[0] == "--input":
errors, _ = check_input(args[1])
elif len(args) == 2 and not args[0].startswith("--"):
errors, locks = check_input(args[0])
if not errors:
errors = check_output(args[1], locks, rules)
else:
print(__doc__, file=sys.stderr)
return 2
for e in errors:
print(f"check_engineered: {e}", file=sys.stderr)
if errors:
return 1
print("check_engineered: OK")
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1:])).tessl-plugin
rules
skills
handoff
handoff-skill
openspec-apply-change
openspec-archive-change
openspec-explore
openspec-propose
openspec-sync-specs
plan-judge
plan-mode
prompt-engineer
prompt-loop
requirement-gathering
spec-as-source-setup
templates
openspec-schema
spec-as-source
templates
spec-ci-sync
spec-loop
spec-rebuild
spec-verify
spec-writer
work-review