Skip to main content
ClaudeWave
Skill1.1k estrellas del repoactualizado today

moai-foundation-core

moai-foundation-core provides foundational architectural principles and patterns for AI-driven development within the MoAI-ADK framework. It establishes six core principles including the TRUST 5 quality gate system, specification-first domain-driven development, delegation patterns for agent orchestration, token optimization strategies, progressive disclosure content structure, and modular file organization. Use this skill when creating new agents or skills, orchestrating complex workflows, planning token budgets, designing documentation architecture, or configuring quality gate standards to ensure scalable, maintainable AI development practices.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/modu-ai/moai-adk /tmp/moai-foundation-core && cp -r /tmp/moai-foundation-core/.claude/skills/moai-foundation-core ~/.claude/skills/moai-foundation-core
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# MoAI Foundation Core

Foundational principles and architectural patterns that power MoAI-ADK's AI-driven development workflow.

Core Philosophy: Quality-first, domain-driven, modular, and efficient AI development through proven patterns and automated workflows.

## Quick Reference

What is MoAI Foundation Core?

Six essential principles that ensure quality, efficiency, and scalability in AI-powered development:

1. TRUST 5 Framework - Quality gate system (Tested, Readable, Unified, Secured, Trackable)
2. SPEC-First DDD - Specification-driven domain-driven development workflow
3. Delegation Patterns - Task orchestration via specialized agents (never direct execution)
4. Token Optimization - 200K budget management and context efficiency
5. Progressive Disclosure - Three-tier knowledge delivery (Quick, Implementation, Advanced)
6. Modular System - File splitting and reference architecture for scalability

Quick Access:

- Quality standards in modules/trust-5-framework.md
- Development workflow in modules/spec-first-ddd.md
- Agent coordination in modules/delegation-patterns.md
- Budget management in modules/token-optimization.md
- Content structure in modules/progressive-disclosure.md
- File organization in modules/modular-system.md
- Agent catalog in modules/agents-reference.md
- Command reference in modules/commands-reference.md
- Security and constraints in modules/execution-rules.md

Use Cases:

- New agent creation with quality standards
- New skill development with structural guidelines
- Complex workflow orchestration
- Token budget planning and optimization
- Documentation architecture design
- Quality gate configuration

---

## Implementation Guide

### 1. TRUST 5 Framework - Quality Assurance System

Purpose: Automated quality gates ensuring code quality, security, and maintainability.

Five Pillars:

Tested Pillar: Maintain comprehensive test coverage with characterization tests ensuring behavior preservation. Execute pytest with coverage reporting. Block merge and generate missing tests on failure. Characterization tests capture current behavior for legacy code, while specification tests validate domain requirements for new code. High coverage ensures code reliability and reduces production defects. Preserves behavior during refactoring and reduces debugging time by 60-70 percent.

Readable Pillar: Use clear and descriptive naming conventions. Execute ruff linter checks. Issue warning and suggest refactoring improvements on failure. Clear naming improves code comprehension and team collaboration. Reduces onboarding time by 40 percent and improves maintenance velocity.

Unified Pillar: Apply consistent formatting and import patterns. Execute black formatter and isort checks. Auto-format code or issue warning on failure. Consistency eliminates style debates and merge conflicts. Reduces code review time by 30 percent and improves readability.

Secured Pillar: Comply with OWASP security standards. Execute security-expert agent analysis. Block merge and require security review on failure. Security vulnerabilities create critical business and legal risks. Prevents 95+ percent of common security vulnerabilities.

Trackable Pillar: Write clear and structured commit messages. Match Git commit message regex patterns. Suggest proper commit message format on failure. Clear history enables debugging, auditing, and collaboration. Reduces issue investigation time by 50 percent.

Integration Points: Pre-commit hooks for automated validation, CI/CD pipelines for quality gate enforcement, Agent workflows for core-quality validation, Documentation for quality metrics.

Detailed Reference: modules/trust-5-framework.md

---

### 2. SPEC-First DDD - Development Workflow

Purpose: Specification-driven development ensuring clear requirements before implementation.

Three-Phase Workflow:

Phase 1 SPEC (/moai:1-plan): workflow-spec generates GEARS format (primary; EARS retained as 6-month backward-compat legacy reference for the 88 pre-v3 SPECs). Output is .moai/specs/SPEC-XXX/spec.md. Execute /clear to save 45-50K tokens.

Phase 2 DDD (/moai:2-run): ANALYZE for requirements, PRESERVE for existing behavior, IMPROVE for enhancement. Validate with at least 85% coverage.

Phase 3 Docs (/moai:3-sync): API documentation, architecture diagrams, project reports.

GEARS Format (current notation): Five patterns — Ubiquitous "The <subject> shall <behavior>" for system-wide always active requirements; Event-driven "When <event> the <subject> shall <behavior>" for trigger-response requirements; State-driven "While <state> the <subject> shall <behavior>" for conditional behavior; Where (capability gate) "Where <capability or feature flag>, the <subject> shall <behavior>" for capability-conditioned behavior; Event-detected (replaces the deprecated conditional modality) "When <undesired-condition-detected>, the <subject> shall <response>" for failure-mode handling. Unified compound clause: `[Where ...][While ...][When ...] The <subject> shall <behavior>` — any subset of the three modifiers may chain. The `<subject>` is generalized — any noun (system, component, service, agent, function, artifact). See the canonical authoring guide at `.claude/skills/moai-workflow-spec/SKILL.md` § "GEARS Format".

EARS Format (legacy reference, 6-month backward-compat — expires 2026-11-22): Five patterns Ubiquitous / Event-driven (WHEN/THEN) / State-driven (WHILE) / Unwanted (SHALL NOT) / Optional (WHERE possible). The 88 pre-v3 SPECs continue to use EARS; the lint engine emits a `LegacyEARSKeyword` warning on residual deprecated conditional modality in NEW SPECs (warning non-strict, error under `moai spec lint --strict`). For NEW SPECs, use GEARS. See `modules/spec-ears-format.md` (legacy reference, deprecated — see GEARS Format guide).

Token Budget: SPEC takes 30K, DDD takes 180K, Docs takes 40K, Total is 250K.

Key Practice: Execute /clear after Phase 1 to initialize context.

Detailed Reference: modules/spec-first-ddd.md

---

#