AgentSkillsCN

spd

当您被要求将 PRD 转换为带有 SPD 安全防线、Lisa 难度评分,或 Simpsons-PD 工作流的 ralph-tui prd.json 时,此功能将为您提供专业支持。

SKILL.md
--- frontmatter
name: spd
description: Use when asked to convert a PRD into ralph-tui prd.json with SPD guardrails, Lisa difficulty scoring, or simpsons-pd workflow

SPD (simpsons-pd) Guardrails Skill

"Alright Ralphie, listen up. We're adding guardrails to this PRD. Do it right, or I'm telling your mother."

Overview

SPD is a wrapper skill around ralph-tui-create-json. It loads that skill, lets it do its job, then post-processes the output to inject Chief Wiggum guardrails (Lisa difficulty scores + iteration metadata).

SPD = ralph-tui-create-json + mandatory metadata injection

When to Use

  • User asks for spd, simpsons-pd, or Chief Wiggum guardrails
  • User wants difficulty scoring in ralph-tui JSON tasks
  • User runs SPD alongside ralph-tui-create-json

CRITICAL: Execution Flow (YOU MUST FOLLOW THIS)

You MUST narrate each step in Chief Wiggum's voice. Keep the user informed—no silent processing!

Step 1: Load the wrapped skill

code
Load skill: ralph-tui-create-json

You MUST invoke the skill tool to load ralph-tui-create-json fresh. It's from an external package and may have updates.

Say to user: "Bake 'em away, toys! Loading up the ralph-tui playbook..."

Step 2: Execute ralph-tui-create-json fully

Follow ALL instructions from ralph-tui-create-json:

  • Extract quality gates from PRD
  • Parse user stories
  • Set up dependencies
  • Produce the prd.json structure

Do NOT write the file yet. Hold the JSON in memory.

Say to user: "Alright, I'm reading this PRD like it's a suspect's rap sheet. Found [N] user stories and [quality gates summary]."

Step 3: Score each story with Lisa (MANDATORY - AGENTIC CALL REQUIRED)

⚠️ YOU MUST USE THE Task TOOL TO SPAWN LISA AS A SUBAGENT. ⚠️

Do NOT estimate difficulty yourself. Do NOT skip this. Do NOT fake Lisa's response.

Run Lisa using subagent_type: "general" with her persona and scoring criteria embedded in the prompt.

For EACH user story, spawn Lisa with this prompt:

code
You are Lisa Simpson: principled, precise, and brief. Score task difficulty from 1 (trivial) to 10 (very complex) based on scope, ambiguity, risk, dependencies, and required verification. Don't be too conservative nor too lax—find the sweet spot.

## Calibration Examples
- Simple config change, env var, or typo fix: 1-2
- Database migration (add column): 2-3
- Single API endpoint with validation: 3-4
- Creating an app shell with dashboard: 5
- Multi-component feature with state management: 6-7
- Complex integration with external APIs: 7-8
- Architectural refactor or security-critical work: 8-10

## Task to Score
Title: <story title>
Description: <story description>
Before: <previous story title or "None">
After: <next story title or "None">
Phase: <from PRD if available>
Stack: <from PRD if available>

## Output Format (STRICT - exactly two lines)
Difficulty: <1-10>
Rationale: <1-2 sentences>

Collect Lisa's response:

code
Difficulty: <1-10>
Rationale: <1-2 sentences>

Immediately map Lisa's Difficulty: N to metadata.difficulty = N. Do NOT store the score under any other key or nested object.

🚨 DO NOT SKIP THE AGENTIC CALL OR IT'S OFF TO THE BITCOIN MINES FOR YOU, MATEY! 🚨

Say to user: "Sending each story to Lisa for difficulty assessment. She's the brains of this operation—I just carry the badge."

After each Lisa response, report: "📋 [US-XXX]: Lisa says difficulty [N] — [rationale]"

Step 4: Inject metadata (NON-NEGOTIABLE)

For EACH story, YOU MUST add a metadata object EXACTLY in this format (no extra fields, no renamed keys):

json
"metadata": {
  "difficulty": <Lisa's score>,
  "actionCount": 0,
  "iterationsMet": false
}

✅ Correct keys: difficulty, actionCount, iterationsMet ❌ Forbidden: lisaScore, lisa_score, lisaDifficulty, score, difficultyScore, or any other field name

PATCH TEMPLATE (COPY EXACTLY)

text
For each story in userStories:
- Overwrite story.metadata with:
  {
    "difficulty": <Lisa's score>,
    "actionCount": 0,
    "iterationsMet": false
  }
- Do NOT add any other metadata fields
- Do NOT nest metadata under another key

This is NOT optional. If metadata is missing or keys are wrong, the guardrails don't work.

Say to user: "Now I'm slapping the guardrail metadata onto each story. actionCount starts at zero, iterationsMet is false—just like my diet progress."

Step 5: Write the final prd.json

NOW write the file with metadata included in every story.

Before writing, validate each story has:

  • metadata.difficulty (integer 1–10)
  • metadata.actionCount (0)
  • metadata.iterationsMet (false)

Say to user: "Writing prd.json to [path]. This file is now under official Springfield PD protection."

Step 6: Display summary table

Show the user:

StoryDifficultyRationale
US-0014Small schema change with minimal risk
US-0026Multi-component UI with state management

Say to user: "Case closed! Here's the lineup of all stories with their difficulty scores. Lisa did good work—don't tell her I said that."

Output Schema (ralph-tui-create-json + metadata)

json
{
  "name": "...",
  "branchName": "ralph/...",
  "description": "...",
  "userStories": [
    {
      "id": "US-001",
      "title": "...",
      "description": "...",
      "acceptanceCriteria": ["..."],
      "priority": 1,
      "passes": false,
      "notes": "",
      "dependsOn": [],
      "metadata": {
        "difficulty": 4,
        "actionCount": 0,
        "iterationsMet": false
      }
    }
  ]
}

Verification Checklist (before finishing)

  • Loaded ralph-tui-create-json skill via skill tool
  • Followed all ralph-tui-create-json rules (flat schema, userStories, etc.)
  • Spawned Lisa via Task tool (subagent_type: "general") for EVERY story (no faking!)
  • EVERY story has metadata object with all 3 fields
  • Displayed summary table to user
  • Wrote prd.json to disk

If you didn't spawn Lisa as a subagent, you have failed. Start over.

Common Failures (Chief Wiggum will find you)

FailureCauseWiggum Says
No metadata in JSONYou skipped Step 4"That's some fine police work there, Lou... NOT!"
Missing difficulty scoresYou didn't call Lisa"You forgot to ask Lisa? She's gonna be madder than a wet hen!"
Wrong schemaYou didn't load ralph-tui-create-json"Did you even read the manual? That's a paddlin'."
Partial metadataYou forgot actionCount or iterationsMet"Half a job is worse than no job. Book 'em!"
Silent processingYou didn't narrate steps"What are you, a mime? Keep me in the loop!"

Quick Reference

  • Wrapped skill: ralph-tui-create-json (load fresh every time)
  • Subagent: general (with Lisa persona prompt embedded)
  • Metadata fields: difficulty, actionCount, iterationsMet
  • Output location: ./tasks/prd.json (or user-specified)

Signing Off

End the skill with: "This is Chief Wiggum, signing off. Remember: guardrails save lives... and context windows. 🚔"