skills/moai-foundation-specs/SKILL.md
SPEC document management - lifecycle, versioning, approval workflows, 50+ references, SPEC-first TDD integration
npx skillsauth add ajbcoding/claude-skill-eval moai-foundation-specsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
SPEC (Specification) is the formal requirements document that drives SPEC-first, TDD development. This Skill provides comprehensive guidance on SPEC lifecycle management, version control, approval workflows, traceability, and integration with MoAI-ADK development pipeline.
/alfred:1-plan workflow in MoAI-ADKPurpose: Initial specification authoring and refinement
Activities:
1. Specification Author creates SPEC-XXX/spec.md
2. Define requirements using EARS patterns
3. Gather stakeholder input
4. Refine until ready for review
5. Create acceptance criteria
6. Document known risks and constraints
Typical Duration: 2-5 days (simple features) to 2-4 weeks (complex systems)
Key Artifacts:
spec.md - Main specification documentacceptance-criteria.md - Acceptance tests (if separate)technical-notes.md - Implementation guidance (optional)Deliverables for Review:
Example Draft Structure:
# SPEC-045: User Authentication System
## Problem Statement
Current system lacks multi-factor authentication. Need MFA for security compliance.
## Requirements
REQ-001 (Event-Driven): When login_attempted the system eventually satisfies
mfa_challenge_presented
REQ-002 (Ubiquitous): The system shall always satisfy mfa_enabled_for_admin = true
REQ-003 (Optional): When mfa_timeout_exceeded the system immediately satisfies
session_terminated
## Acceptance Criteria
- [ ] MFA works with authenticator apps (Google, Microsoft)
- [ ] Fallback SMS when app unavailable
- [ ] Session timeout after 10 minutes inactivity
- [ ] Audit log all MFA events
## Technical Notes
- Use TOTP (RFC 6238) for time-based codes
- Backup codes for emergency access
- Consider integration with existing identity system
## Risks
- User adoption of MFA might be low
- SMS delivery reliability (use backup)
Draft Anti-Patterns - Avoid:
Purpose: Peer review and stakeholder feedback
Review Participants:
Review Checklist:
[ ] Requirements are clear and unambiguous
[ ] All requirements are EARS-format
[ ] Acceptance criteria are measurable
[ ] No conflicting requirements
[ ] Architecture feasible
[ ] Risk assessment complete
[ ] Traceability clear
[ ] No external dependencies missing
[ ] Timeline realistic
[ ] Budget/resources adequate
Review Process:
Review Duration: 3-7 business days (parallel review)
Version Bumping Rules:
Purpose: Specification is approved and development proceeds
Activation Steps:
feature/SPEC-XXXDuring Active Phase:
Change Management:
If requirement change needed during development:
1. Assess impact on timeline/scope
2. Document change request
3. Get approval from technical lead + product owner
4. Update SPEC with new version
5. Notify implementation team
6. Update code and tests accordingly
Typical Duration: Development time + testing (1-8 weeks)
Version Bumping:
Completion Criteria:
Purpose: Feature is being replaced or removed
Triggering Events:
Deprecation Process:
During Deprecation:
Deprecation Notice Format:
# SPEC-042: Old Authentication (DEPRECATED)
**Status**: DEPRECATED
**Successor**: SPEC-045 (New MFA Authentication)
**Migration Guide**: See migration-guide.md
**EOL Date**: 2025-12-31 (6 months from deprecation)
## Migration Timeline
- 2025-07: New system available, parallel operation
- 2025-09: Default switch to new system
- 2025-12: Old system shutdown
## Support
- Questions: Ask in #migration channel
- Migration assistance: [email protected]
Version Marking:
v1.5.0 (DEPRECATED)Purpose: SPEC is no longer active, kept for historical record
Archival Process:
.moai/specs/archived/Archive Retention:
Archive Access:
Format: major.minor.patch
Versioning Rules:
Starting with: 1.0.0
PATCH (1.0.X):
- Bug fixes to requirements
- Minor clarifications
- No scope change
Example: 1.0.0 → 1.0.1
MINOR (1.X.0):
- New acceptance criteria
- Refinement during review
- Feature additions
Example: 1.0.0 → 1.1.0
MAJOR (X.0.0):
- Scope changes
- Architecture redesign
- Incompatible changes
Example: 1.0.0 → 2.0.0
Pre-release versions:
- 1.0.0-rc1 (release candidate)
- 1.0.0-beta (beta testing)
- 0.1.0 (draft versions before 1.0.0)
Version Metadata:
# In SPEC frontmatter
version: 1.2.3
status: stable
created: 2025-11-01
updated: 2025-11-12
approved_by: tech-lead-name
approval_date: 2025-11-05
deprecated: false
eol_date: null # null if active, 2025-12-31 if deprecated
Every update logs:
Change Log Format:
# Version History
## v1.2.3 (2025-11-12) - Clarifications
- Clarified requirement REQ-002 acceptance criteria
- Added risk assessment for database migration
- Updated timeline from 4 weeks to 6 weeks
- Author: john-smith | Tech Lead: sarah-jones
## v1.2.2 (2025-11-10) - Bug Fix
- Fixed requirement numbering consistency
- Author: john-smith
## v1.2.1 (2025-11-08) - Review Updates
- Addressed QA concerns about test coverage
- Added backup procedures to recovery plan
- Author: john-smith | Reviewer: qa-lead
---
name: User Profile Enhancement
spec_id: SPEC-050
version: 1.0.0
status: stable
created: 2025-11-01
approved_date: 2025-11-08
approved_by: tech-lead
---
# SPEC-050: User Profile Enhancement
## Problem Statement
Users cannot upload profile pictures. Current profile view shows placeholder only.
## Functional Requirements
REQ-001 (Event-Driven):
When user_uploads_profile_image the system eventually satisfies
image_stored_in_profile_and_cache_updated
Acceptance: Image appears immediately after upload
REQ-002 (Ubiquitous):
The system shall always satisfy profile_image_size <= 5MB
Acceptance: Upload fails with error if exceeds 5MB
REQ-003 (Unwanted):
The system shall never satisfy (invalid_image_format AND stored)
Acceptance: Only PNG, JPEG, WebP accepted
## Non-Functional Requirements
- Performance: Image upload completes within 3 seconds
- Security: Images scanned for malware
- Compliance: GDPR-compliant data storage
## Acceptance Criteria
- [ ] Upload works for PNG, JPEG, WebP
- [ ] File size limited to 5MB
- [ ] Image appears in profile immediately
- [ ] Old images automatically deleted
- [ ] Performance < 3 seconds on 4G
- [ ] Mobile and desktop tested
## Testing Strategy
- Unit tests: Image validation, storage
- Integration tests: Upload workflow
- E2E tests: User upload → profile view
- Manual: Test on various devices
## Technical Notes
- Use S3 for image storage
- CloudFront CDN for distribution
- ImgProxy for optimization
## Risks
- Malware in images (mitigate with scanning)
- Storage costs (monitor usage)
- CDN cache invalidation (use versioning)
## Dependencies
- S3 bucket provisioning
- ImgProxy service deployment
- Malware scanning service
## Timeline
- Development: 2 weeks
- Testing: 1 week
- Deployment: 1 day
---
name: Payment Processing Refactor
spec_id: SPEC-051
version: 2.1.0
status: stable
created: 2025-10-15
approved_date: 2025-11-01
approved_by: tech-lead, product-owner
---
# SPEC-051: Payment Processing Refactor
## Problem Statement
Current payment system doesn't support multiple payment providers. Need flexibility
to add Stripe, PayPal, Square without major refactoring.
## Architecture
### System Components
Payment Service (core abstraction) ├── Stripe Provider (implementation) ├── PayPal Provider (implementation) └── Square Provider (future)
## Functional Requirements
REQ-001-005: [5 event-driven payment flow requirements]
REQ-006-010: [5 ubiquitous invariants for payment safety]
REQ-011-015: [5 state-driven mode requirements]
## Non-Functional Requirements
- Throughput: ≥ 1000 transactions/sec
- Latency: P99 < 500ms
- Availability: 99.95% uptime
- Security: PCI-DSS Level 1 compliance
- Scalability: Auto-scale to 10k transactions/sec
## Integration Points
- Payment Gateway APIs (Stripe, PayPal)
- Accounting system (QuickBooks API)
- Fraud detection (Third-party service)
- Notification system (Email, SMS, in-app)
## Acceptance Criteria
- [ ] All payment methods work end-to-end
- [ ] Transactions persist through failures
- [ ] Receipts generated automatically
- [ ] Refunds processed within 2 hours
- [ ] All error cases handled gracefully
- [ ] Performance targets met
- [ ] Security audit passed
## Risk Assessment
| Risk | Probability | Impact | Mitigation |
|------|------------|--------|-----------|
| API rate limits | Medium | High | Implement queue, caching |
| Data loss | Low | Critical | Transaction journaling |
| Fraud | Medium | High | Third-party fraud detection |
| Compliance violation | Low | Critical | Regular audits |
## Timeline & Resources
- Backend Development: 4 weeks (2 engineers)
- Frontend Integration: 2 weeks (1 engineer)
- QA Testing: 2 weeks (2 QA engineers)
- Deployment & monitoring: 1 week (devops)
- Total: 9 weeks, 6 people
## Success Metrics
- Zero payment failures
- Payment latency < 500ms (P99)
- User-reported issues < 0.1%
- All tests passing (≥90% coverage)
.moai/specs/SPEC-XXX//alfred:1-plan Command/alfred:1-plan "user profile enhancement feature"
↓
Creates SPEC-XXX structure
├── spec.md (specification)
├── acceptance-criteria.md
├── technical-notes.md (optional)
└── CHANGELOG.md
↓
Author reviews and marks ready
↓
Tech lead approves
↓
Status: ACTIVE
/alfred:2-run Command/alfred:2-run SPEC-050
↓
Reads SPEC-050 specification
↓
TDD cycle:
RED: Tests from acceptance criteria
GREEN: Implementation
REFACTOR: Code quality
↓
↓
Tests link to requirements
/alfred:3-sync Command/alfred:3-sync auto SPEC-050
↓
Validates all acceptance criteria met
↓
Updates documentation
↓
Verifies test coverage
↓
Creates PR to develop
.moai/specs/
├── SPEC-001/
│ ├── spec.md
│ └── acceptance-criteria.md
├── SPEC-002/
└── SPEC-003/
.moai/specs/
├── core/
│ ├── SPEC-001/ (auth)
│ └── SPEC-002/ (api)
├── features/
│ ├── SPEC-010/ (profile)
│ └── SPEC-011/ (payments)
├── infrastructure/
│ ├── SPEC-020/ (database)
│ └── SPEC-021/ (monitoring)
└── deprecated/
└── SPEC-000/ (old feature)
.moai/specs/
├── index.md (SPEC registry)
├── platform/
│ ├── auth/ (4 specs)
│ ├── api/ (3 specs)
│ ├── user/ (5 specs)
│ └── payments/ (3 specs)
├── features/
│ ├── analytics/ (3 specs)
│ ├── reporting/ (2 specs)
│ └── mobile/ (4 specs)
├── infrastructure/
│ ├── backend/ (5 specs)
│ ├── devops/ (4 specs)
│ └── security/ (3 specs)
├── deprecated/ (archived specs)
└── archive/ (historical reference)
| Problem | Solution | |---------|----------| | Vague requirements | Apply EARS patterns, add measurable criteria | | Stuck in review | Set review deadline, escalate to tech lead | | Scope creep | Document as separate SPEC, increment version | | Changing requirements | Version bump, impact analysis, re-review | | Too many specs | Organize by domain, create index | | Old archived specs | Move to .moai/specs/archive/, compress |
moai-foundation-ears — Write requirements using EARS patternsmoai-foundation-trust — TRUST 5 quality principlesmoai-alfred-agent-guide — Alfred agent orchestration with SPECsSPECs are the foundation of SPEC-first, TDD development. Clear specifications drive quality implementation.
content-media
Download YouTube video transcripts when user provides a YouTube URL or asks to download/get/fetch a transcript from YouTube. Also use when user wants to transcribe or get captions/subtitles from a YouTube video.
development
Transform learning content (like YouTube transcripts, articles, tutorials) into actionable implementation plans using the Ship-Learn-Next framework. Use when user wants to turn advice, lessons, or educational content into concrete action steps, reps, or a learning quest.
tools
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.
tools
Replace with description of the skill and when Claude should use it.