Skip to content
moai-alfred-spec-authoring logo

SPEC Authoring Skill

moai-alfred-spec-authoring

SPEC document authoring guide - YAML metadata, EARS syntax (5 patterns with Unwanted Behaviors), validation checklist

SKILL.md

Full skill instructions

SPEC Authoring Skill

Skill Metadata

FieldValue
Skill Namemoai-alfred-spec-authoring
Version1.2.0 (2025-11-02)
Allowed toolsRead, Bash, Glob
Auto-load/​alfred:1-plan, SPEC authoring tasks
TierAlfred

What It Does

Comprehensive guide for authoring SPEC documents in MoAI-ADK. Provides YAML metadata structure (7 required + 9 optional fields), official EARS requirement syntax (5 patterns including Unwanted Behaviors), version management lifecycle, TAG integration, and validation strategies.

Key capabilities:

  • Step-by-step SPEC creation workflow
  • Complete metadata field reference with lifecycle rules
  • EARS syntax templates and real-world patterns
  • Pre-submission validation checklist
  • Common pitfalls prevention guide
  • /​alfred:1-plan workflow integration

When to Use

Automatic triggers:

  • /​alfred:1-plan command execution
  • SPEC document creation requests
  • Requirements clarification discussions
  • Feature planning sessions

Manual invocation:

  • Learn SPEC authoring best practices
  • Validate existing SPEC documents
  • Troubleshoot metadata issues
  • Understand EARS syntax patterns

Quick Start: 5-Step SPEC Creation

Step 1: Initialize SPEC Directory

mkdir -p .moai/​specs/​SPEC-{DOMAIN}-{NUMBER}
# Example: Authentication feature
mkdir -p .moai/​specs/​SPEC-AUTH-001

Step 2: Write YAML Front Matter

---
id: AUTH-001
version: 0.0.1
status: draft
created: 2025-10-29
updated: 2025-10-29
author: @YourGitHubHandle
priority: high
---

Step 3: Add SPEC Title & HISTORY

# @SPEC:AUTH-001: JWT Authentication System

## HISTORY

### v0.0.1 (2025-10-29)
- **INITIAL**: JWT authentication SPEC draft created
- **AUTHOR**: @YourHandle

Step 4: Define Environment & Assumptions

## Environment

**Runtime**: Node.js 20.x or later
**Framework**: Express.js
**Database**: PostgreSQL 15+

## Assumptions

1. User credentials stored in PostgreSQL
2. JWT secrets managed via environment variables
3. Server clock synchronized with NTP

Step 5: Write EARS Requirements

## Requirements

### Ubiquitous Requirements
**UR-001**: The system shall provide JWT-based authentication.

### Event-driven Requirements
**ER-001**: WHEN the user submits valid credentials, the system shall issue a JWT token with 15-minute expiration.

### State-driven Requirements
**SR-001**: WHILE the user is in an authenticated state, the system shall permit access to protected resources.

### Optional Features
**OF-001**: WHERE multi-factor authentication is enabled, the system can require OTP verification after password confirmation.

### Unwanted Behaviors
**UB-001**: IF a token has expired, THEN the system shall deny access and return HTTP 401.

Five EARS Pattern Overview

PatternKeywordPurposeExample
UbiquitousshallCore functionality always active"The system shall provide login capability"
Event-drivenWHENResponse to specific events"WHEN login fails, display error"
State-drivenWHILEPersistent behavior during state"WHILE in authenticated state, permit access"
OptionalWHEREConditional features based on flags"WHERE premium enabled, unlock feature"
Unwanted BehaviorsIF-THENError handling, quality gates, business rules"IF token expires, deny access + return 401"

Seven Required Metadata Fields

  1. id: <DOMAIN>-<NUMBER> (e.g., AUTH-001) - Immutable identifier
  2. version: MAJOR.MINOR.PATCH (e.g., 0.0.1) - Semantic versioning
  3. status: draft | active | completed | deprecated
  4. created: YYYY-MM-DD - Initial creation date
  5. updated: YYYY-MM-DD - Final modification date
  6. author: @GitHubHandle - Primary author (@ prefix required)
  7. priority: critical | high | medium | low

Version Lifecycle:

  • 0.0.x → draft (authoring phase)
  • 0.1.0 → completed (implementation done)
  • 1.0.0 → stable (production-ready)

Validation Checklist

Metadata Validation

  • All 7 required fields present
  • author field includes @ prefix
  • version format is 0.x.y
  • id is not duplicated (rg "@SPEC:AUTH-001" -n .moai/​specs/)

Content Validation

  • YAML Front Matter complete
  • Title includes @SPEC:{ID} TAG block
  • HISTORY section has v0.0.1 INITIAL entry
  • Environment section defined
  • Assumptions section defined (minimum 3 items)
  • Requirements section uses EARS patterns
  • Traceability section shows TAG chain structure

EARS Syntax Validation

  • Ubiquitous: "shall" + capability
  • Event-driven: Starts with "WHEN [trigger]"
  • State-driven: Starts with "WHILE [state]"
  • Optional: Starts with "WHERE [feature]", uses "can"
  • Unwanted Behaviors: "IF-THEN" or direct constraint expression

Common Pitfalls

  1. ❌ Changing SPEC ID after assignment → Breaks TAG chain
  2. ❌ Skipping HISTORY updates → Content changes without audit trail
  3. ❌ Jumping version numbers → v0.0.1 → v1.0.0 without intermediate steps
  4. ❌ Ambiguous requirements → "Fast and user-friendly" (unmeasurable)
  5. ❌ Missing @ prefix in author → author: Goos instead of author: @Goos
  6. ❌ Mixing EARS patterns → Multiple keywords in single requirement

Related Skills

  • moai-foundation-ears - Official EARS syntax patterns
  • moai-foundation-specs - Metadata validation automation
  • moai-foundation-tags - TAG system integration
  • moai-alfred-spec-metadata-validation - Automated validation

Detailed Reference


Last Updated: 2025-10-29 Version: 1.2.0 Maintained By: MoAI-ADK Team Support: Use /​alfred:1-plan command for guided SPEC creation

More Productivity & Planning skills

brainstorming logo
Productivity & Planning

brainstorming

Structured design dialogue that validates ideas before implementation begins.

295.4K 385.7K
View
ui-ux-pro-max logo
Productivity & Planning

ui-ux-pro-max

Comprehensive design intelligence for web and mobile UI/UX across 10 technology stacks.

133.1K 383.9K
View
writing-plans logo
Productivity & Planning

writing-plans

Comprehensive implementation plans for multi-step tasks, breaking down specs into bite-sized, testable steps.

295.4K 268K
View
using-superpowers logo
Productivity & Planning

using-superpowers

Introduction to the obra skills system with mandatory skill invocation rules and best practices.

295.4K 259.8K
View
executing-plans logo
Productivity & Planning

executing-plans

Execute a written implementation plan with critical review and task checkpoints.

295.4K 229.1K
View
dispatching-parallel-agents logo
Productivity & Planning

dispatching-parallel-agents

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View
using-git-worktrees logo
Productivity & Planning

using-git-worktrees

Isolated git worktrees with smart directory selection and safety verification.

295.4K 205.2K
View
webapp-testing logo
Productivity & Planning

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

179.7K 170.6K
View
content-strategy logo
Productivity & Planning

content-strategy

Plan searchable and shareable content that drives traffic, builds authority, and generates leads.

53.3K 150.9K
View
repo-intake-and-plan logo
Productivity & Planning

repo-intake-and-plan

README-first repository scanner that extracts commands and classifies reproduction candidates without executing them.

497 139.6K
View
marketing-ideas logo
Productivity & Planning

marketing-ideas

Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.

53.3K 137.2K
View
site-architecture logo
Productivity & Planning

site-architecture

Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.

53.3K 112.8K
View

Productivity AI tools

Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View
SaveDay logo
Productivity

SaveDay

Capture, organize, and utilize your knowledge effortlessly.

Free
View
Any Summary logo
Productivity

Any Summary

Instant Summaries of Audio & Video Interviews with AnySummary

Freemium
View
M
Productivity

Map This

Transform PDFs into engaging mind maps.

Freemium
View
ChatPDF logo
Productivity

ChatPDF

Chat with any PDF instantly

Free
View
I
Productivity

intellisay

Create an optimal daily plan using your voice

Paid
View
A
Productivity

Aurora AI

A productivity platform to centralize organizational knowledge and workflows with contextual AI assistance.

Paid
View
AskYourPDF logo
Productivity

AskYourPDF

AskYourPDF Pricing Plans: Tailored to Your Needs

Free
View