Skip to content
Back to skills

Collection

ASecurity

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

  • 24 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 8, 2026
securitygobashsqlnodeexpressgitdatabase

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-43a70068/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-43a70068)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: moai-alfred-spec-authoring
version: 1.2.0
created: 2025-10-23
updated: 2025-11-02
status: active
description: SPEC document authoring guide - YAML metadata, EARS syntax (5 patterns with Unwanted Behaviors), validation checklist
keywords: ['spec', 'authoring', 'ears', 'metadata', 'requirements', 'tdd', 'planning']
allowed-tools:
  - Read
  - Bash
  - Glob
---

# SPEC Authoring Skill

## Skill Metadata

| Field | Value |
| ----- | ----- |
| **Skill Name** | moai-alfred-spec-authoring |
| **Version** | 1.2.0 (2025-11-02) |
| **Allowed tools** | Read, Bash, Glob |
| **Auto-load** | `/alfred:1-plan`, SPEC authoring tasks |
| **Tier** | Alfred |

---

## 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

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

### Step 2: Write YAML Front Matter

```yaml
---
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

```markdown
# @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

```markdown
## 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

```markdown
## 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

| Pattern | Keyword | Purpose | Example |
|---------|---------|---------|---------|
| **Ubiquitous** | shall | Core functionality always active | "The system shall provide login capability" |
| **Event-driven** | WHEN | Response to specific events | "WHEN login fails, display error" |
| **State-driven** | WHILE | Persistent behavior during state | "WHILE in authenticated state, permit access" |
| **Optional** | WHERE | Conditional features based on flags | "WHERE premium enabled, unlock feature" |
| **Unwanted Behaviors** | IF-THEN | Error 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

- **Full Metadata Reference**: [reference.md](./reference.md)
- **Practical Examples**: [examples.md](./examples.md)

---

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

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.