---
description: Create a comprehensive feature specification using the eg workflow system
argument-hint: <instance-name> <feature-requirements>
---

# Feature Definition Workflow

Create a comprehensive feature specification using the eg workflow system.

Input: `$ARGUMENTS`

## Step 1: Parse Arguments and Setup

First, parse the arguments to extract:
- Instance name (first word before space)
- Feature requirements (everything after first space)

Then create the workflow directory at `.eg/{instance-name}/`

## Step 2: Launch Spec Creator Agent

Use the Task tool to invoke the spec-creator agent:

```
Task(
  description="Create comprehensive feature specification",
  prompt=`
    Create a comprehensive feature specification for: {requirements}
    
    Use the provided template structure from .claude/templates/spec.template.md
    
    Fill in all template sections with detailed information:
    - Problem Statement: What problem this feature solves
    - Goals: Primary and secondary objectives
    - Success Criteria: How we know it works
    - Acceptance Scenarios: Given/When/Then scenarios
    - Scope: What's included and excluded
    - Dependencies: What must exist before we start
    - Risks: Main risks and mitigation strategies
    - Initial Approach: High-level implementation strategy
    
    Save the completed specification to: .eg/{instance-name}/feature-definition.md
  `,
  subagent_type="spec-creator"
)
```

## Step 3: Validate Feature Definition

After the specification is created, validate it using the definition-validator:

```
Task(
  description="Validate feature definition against quality standards",
  prompt=`
    Validate the feature definition at .eg/{instance-name}/feature-definition.md
    
    Use the definition-validator agent to:
    - Check template compliance
    - Validate all sections are complete
    - Ensure quality standards are met
    - Provide structured feedback
    
    The validator will output PASS/NEEDS_IMPROVEMENT/MAJOR_ISSUES
  `,
  subagent_type="definition-validator"
)
```

## Step 4: Review and Iterate

If validation result is NEEDS_IMPROVEMENT or MAJOR_ISSUES:
1. Use the validator feedback to improve the specification
2. Re-run the spec-creator with specific improvements
3. Re-validate until PASS is achieved

## Step 5: Launch Spec Reviewer Agent

Once validation passes, use the Task tool to invoke the reviewer for additional feedback:

```
Task(
  description="Review feature specification for completeness",
  prompt=`
    Review the feature specification at @.eg/{instance-name}/feature-definition.md
    
    Validate:
    - All template sections are properly filled
    - Goals are clear and measurable
    - Acceptance criteria are testable
    - Scope is well-defined
    - Dependencies are identified
    - Risks have mitigation strategies
    - Approach is feasible
    
    Provide specific feedback on any missing or unclear sections.
  `,
  subagent_type="spec-reviewer"
)
```

## Step 6: Finalize and Phase Gate

Based on all feedback:
1. Make any necessary final updates to the specification
2. Present the validated feature definition to the user
3. Ask for explicit approval: "The feature definition has been validated and is ready. Shall we proceed to the architecture phase? (yes/no)"
4. Only proceed to architecture after receiving "yes"

Once approved, inform the user that the next step would be:
`/eg:architect {instance-name} @.eg/{instance-name}/feature-definition.md`