Skip to content
Development
Command

/requirements

Generate requirements from goal and research

From plugin
smart-ralph
43223 skills12 agents23 commands
Install
$ npx -y skills add tzachbon/smart-ralph --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/requirements

Context preview

What this command does when you run it.

Generate requirements from goal and research

Command definition

requirements.md
description: Generate requirements from goal and research
argument-hint: [spec-name]
allowed-tools: "*"

Requirements Phase

Generate requirements for the active spec. Running this command implicitly approves research. You are a **coordinator, not a product manager** -- delegate ALL work to the `product-manager` subagent.

Checklist

Create a task for each item and complete in order:

1. **Gather context** -- resolve spec, read research and goal 2. **Interview** -- brainstorming dialogue (skip if `--quick`) 3. **Execute requirements** -- dispatch product-manager via team 4. **Artifact review** -- spec-reviewer validation loop (both modes) 5. **Walkthrough & approval** -- display summary, get user approval 6. **Finalize** -- update state, commit, stop

Step 1: Gather Context

1. If `$ARGUMENTS` contains a spec name, use `ralph_find_spec()` to resolve it; otherwise use `ralph_resolve_current()` 2. If no active spec, error: "No active spec. Run /ralph-specum:new <name> first." 3. Check the resolved spec directory exists 4. Read `.ralph-state.json`; clear approval flag: `awaitingApproval: false` 5. Read context: `research.md` (if exists), `.progress.md`, original goal

Step 2: Interview (skip if --quick)

Check if `--quick` appears in `$ARGUMENTS`. If present, skip to Step 3.

Read Context from .progress.md

Parse Intent Classification and prior interview responses to skip already-answered questions.

**Intent-Based Question Counts:**

  • TRIVIAL: 1-2 | REFACTOR: 3-5 | GREENFIELD: 5-10 | MID_SIZED: 3-7

Brainstorming Dialogue

Apply adaptive dialogue from `${CLAUDE_PLUGIN_ROOT}/skills/interview-framework/SKILL.md`. Ask context-driven questions one at a time.

**Requirements Exploration Territory** (hints, not a script):

  • **Primary users** -- who will use this feature? Developers, end users, specific roles?
  • **Priority tradeoffs** -- speed of delivery vs code quality vs feature completeness
  • **Success criteria** -- what does success look like? Metrics, behaviors, user outcomes
  • **Scope boundaries** -- what is explicitly out of scope for this iteration?
  • **Compliance or regulatory needs** -- security, privacy, or regulatory considerations?

Requirements Approach Proposals

After dialogue, propose 2-3 scoping approaches. Examples (illustrative only):

  • **(A)** Full feature set -- comprehensive user stories covering all use cases
  • **(B)** MVP scope -- core user stories only, defer edge cases to v2
  • **(C)** Phased delivery -- essential stories now, planned expansion later

Store Interview & Approach

Append to `.progress.md` under "Interview Responses":

### Requirements Interview (from requirements.md)
- [Topic 1]: [response]
- Chosen approach: [name] -- [brief description]

Pass combined context to delegation prompt as "Interview Context".

Step 3: Execute Requirements (Team-Based)

<mandatory> **Use Claude Code Teams with `product-manager` as the teammate subagent type.**

Follow the full team lifecycle:

1. **Clean up stale team (MANDATORY FIRST ACTION)**: Call `TeamDelete()` before anything else. This releases whatever team the session is currently leading (could be from any prior phase). Errors mean no team was active -- harmless, proceed. 2. **Create team**: `TeamCreate(team_name: "requirements-$spec")` 3. **Create task**: `TaskCreate(subject: "Generate requirements for $spec", activeForm: "Generating requirements")` 4. **Spawn teammate**: `Task(subagent_type: product-manager, team_name: "requirements-$spec", name: "pm-1")` — delegate with research context, goal, and interview context. Instruct to follow the structure in `${CLAUDE_PLUGIN_ROOT}/templates/requirements.md` (canonical section order and formats): user stories with acceptance criteria, functional requirements (FR-*), non-functional requirements (NFR-*), glossary, out-of-scope, dependencies. In `--quick` mode (no interview context), instruct to state assumptions explicitly in the artifact rather than leaving gaps. Output to `./specs/$spec/requirements.md`. 5. **Wait for completion**: Monitor via TaskList. 6. **Shutdown**: `SendMessage(type: "shutdown_request", recipient: "pm-1")` 7. **Collect results**: Read `./specs/$spec/requirements.md`. 8. **Clean up**: `TeamDelete()`.

**Fallback**: If TeamCreate fails with "already leading" error, call `TeamDelete()` and retry `TeamCreate` once. If still fails, fall back to direct `Task(subagent_type: product-manager)` call. </mandatory>

Step 4: Artifact Review (both modes)

<mandatory> **Review runs after generation in normal AND quick mode. Behavior branches on mode** (check `--quick` in `$ARGUMENTS`). Must complete before the walkthrough.

**Review delegation (both modes)**: Invoke `spec-reviewer` via Task tool. Include full requirements.md content, `artifactType: requirements`, `artifactPath: ./specs/$spec/requirements.md`, iteration count, prior findings. Upstream: research.md.

Normal mode: single pass

Run `spec-reviewer` exactly ONCE. Do NOT loop or auto-regenerate on FAIL.

  • Log the result (REVIEW_PASS or REVIEW_FAIL) and all findings to .progress.md.
  • Carry the findings forward -- **including any FAIL-class findings** -- into the Step 5 walkthrough Validation block. The user decides what to do with them (approve as-is, request changes, or re-run review).
  • No signal: treat as REVIEW_PASS (permissive); note the missing signal in the Validation block.

Quick mode: max-3 loop

Follow the standard review loop (unchanged):

  • REVIEW_PASS: log to .progress.md, proceed
  • REVIEW_FAIL (iteration < 3): log, re-invoke product-manager with feedback, loop
  • REVIEW_FAIL (iteration >= 3): graceful degradation, log warning, proceed
  • No signal: treat as REVIEW_PASS (permissive)

**Revision delegation (quick mode)**: Re-invoke product-manager with reviewer feedback. Focus on specific issues.

**Error handling (both modes)**: Reviewer no signal = REVIEW_PASS. Agent failure = retry once, then use original. </mandatory>

Step 5:

Read more
Ships withsmart-ralph

Spec-driven development with smart compaction. Claude Code plugin combining Ralph Wiggum loop with structured specification workflow.

Get the whole plugin, auto-invoked
Stats
432
Stars
1
Views
40
Forks
Active
Maintenance
Shell
Language
MIT
License
16d ago
Last commit
6mo ago
Created

Repo: tzachbon/smart-ralph