Skip to content
moai-foundation-specs logo

SPEC Writing Expert

moai-foundation-specs

SPEC writing standards with EARS format and TAG traceability

SKILL.md

Full skill instructions

SPEC Writing Expert

Requirement Specification Standards

Format: EARS (Easy Approach to Requirements Syntax)
Traceability: TAG-based (SPEC→TEST→CODE→DOC)


Overview

Standardized approach to writing clear, testable requirements.

SPEC Components

  1. Functional Requirements: What the system does.
  2. Non-Functional Requirements: Performance, security, usability.
  3. Acceptance Criteria: Testable conditions for completion.
  4. TAG Assignment: Unique identifier for traceability.

EARS Format (5 Types)

1. Ubiquitous Requirements

Always true, no conditions.

Template: The [system] shall [action].

Example:

The authentication system shall encrypt passwords using bcrypt.

2. Event-Driven Requirements

Triggered by events.

Template: When [trigger], the [system] shall [action].

Example:

When a user submits login credentials, the system shall validate against the database.

3. State-Driven Requirements

Depends on system state.

Template: While [state], the [system] shall [action].

Example:

While user is authenticated, the system shall display personalized dashboard.

4. Optional Requirements

May or may not occur.

Template: Where [condition], the [system] shall [action].

Example:

Where MFA is enabled, the system shall require second factor authentication.

5. Complex Requirements

Multiple conditions.

Template: If [condition], then [action], else [alternative].

Example:

If password validation fails, then system shall display error message, else proceed to dashboard.

SPEC Template

# SPEC-001: User Authentication

## Overview

Implement secure user authentication with JWT tokens.

## Functional Requirements

### @AUTH-001: Login Validation

**Type**: Event-Driven
**Requirement**: When user submits credentials, system shall validate email and password format before database lookup.
**Acceptance Criteria**:

- Email format: RFC 5322 compliant
- Password: min 8 characters
- Return validation errors within 100ms

### @AUTH-002: Password Hashing

**Type**: Ubiquitous
**Requirement**: System shall hash passwords using bcrypt with 12 rounds.
**Acceptance Criteria**:

- Bcrypt algorithm (OWASP recommended)
- 12 salt rounds (2025 standard)
- Unique salt per password

## Non-Functional Requirements

### @AUTH-NF-001: Performance

- Login response time: <500ms (p95)
- Concurrent logins: 1000/​sec

### @AUTH-NF-002: Security

- OWASP Top 10 compliance
- TLS 1.3 for transmission
- Rate limiting: 5 attempts/​min per IP

## TAG Traceability

- SPEC: @AUTH-001, @AUTH-002
- Tests: test_auth.py
- Code: auth/​login.py
- Docs: api/​authentication.md

Best Practices

  1. One Requirement Per TAG: Don't combine multiple requirements.
  2. Testable: Each requirement must be verifiable.
  3. Unambiguous: Use "shall" (mandatory), "should" (recommended), "may" (optional).
  4. Measurable: Include quantifiable acceptance criteria.

Validation Checklist

  • EARS Format: Correct template used?
  • TAG Assignment: Unique @TAG-### assigned?
  • Testable: Can be verified with tests?
  • Complete: Acceptance criteria defined?
  • Traceable: Linked to TEST/​CODE/​DOC?

Related Skills

  • moai-foundation-ears: Detailed EARS syntax
  • moai-foundation-tags: TAG management
  • moai-foundation-trust: Quality principles

Last Updated: 2025-11-20

More Security skills

supabase logo
Security

supabase

Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...

2.7K 308.9K
View

Comprehensive guides and best practices for Neon Serverless Postgres, covering setup, connection methods, authentication, and platform APIs.

98 216.2K
View

Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.

462 163.8K
View

A skill to evaluate how secure Firestore security rules are. Use this when Firestore security rules are updated to ensure that the generated rules are extremely secure and robust.

462 127.7K
View

Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.

462 125.1K
View

Complete Better Auth server and client setup with database adapters, session management, plugins, and security configuration.

222 118.2K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View
cloudflare logo
Security

cloudflare

Complete Cloudflare platform integration with decision trees for compute, storage, AI, networking, security, and infrastructure-as-code.

3K 110.7K
View

Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.

253 103K
View
gws-gmail logo
Security

gws-gmail

Send, read, and manage Gmail messages, drafts, labels, and account settings.

31.2K 78.9K
View

Comprehensive website auditing across 230+ rules in 21 categories including SEO, performance, security, and accessibility.

94 72.3K
View
gws-shared logo
Security

gws-shared

Shared authentication, CLI syntax, and output formatting patterns for gws Google Workspace commands.

31.2K 63.4K
View

Security AI tools

StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
GeoSpy logo
Security

GeoSpy

GeoSpy: Pricing, Features, FAQs, and Alternatives for AI Teams

Free
View

Detect AI-generated voices to protect against audio fraud.

Paid
View

Ensure Your Content's Originality with AI Plagiarism Checker

Freemium
View
Img Upscaler logo
Security

Img Upscaler

Upscale images by 400% without quality loss

Freemium
View
AICheatCheck logo
Security

AICheatCheck

Accurately Detect AI-Generated Content with TheChecker.AI

Free
View
D
Security

Detect GPT

Chrome extension that detects and flags AI-generated content

Free
View