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.
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-coreSKILL.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 the project's test runner with coverage (e.g. go test -cover, pytest --cov, cargo test, npm test -- --coverage). 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, and preserves behavior during refactoring. Readable Pillar: Use clear and descriptive naming conventions. Run the project's linter (e.g. golangci-lint, ruff, eslint, clippy). Issue warning and suggest refactoring improvements on failure. Clear naming improves code comprehension, team collaboration, and maintenance velocity. Unified Pillar: Apply consistent formatting and import patterns. Run the project's formatter (e.g. gofmt, black, prettier, rustfmt). Auto-format code or issue warning on failure. Consistency eliminates style debates and merge conflicts and improves readability. Secured Pillar: Comply with OWASP security standards. Surface security findings via the appropriate agent or reference skill (e.g. spawn a per-spawn general-purpose agent with security instructions, or load the moai-ref-owasp-checklist / moai-ref-llm-security reference). Block merge and require security review on failure. Security vulnerabilities create critical business and legal risks. Trackable Pillar: Write clear and structured commit messages. Match Git commit message regex patterns (Conventional Commits). Suggest proper commit message format on failure. Clear history enables debugging, auditing, and collaboration. Integration Points: Pre-commit hooks for automated validation, CI/CD pipelines for quality gate enforcement, Agent workflows for TRUST 5 validation (moai-foundation-quality orchestration), 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 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 run): ANALYZE for requirements, PRESERVE for existing behavior, IMPROVE for enhancement. Validate with at least 85% coverage. Phase 3 Docs (/moai 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 take
Claude Code upstream change tracker -> moai-adk update plan + docs sync workflow (dev-only). Tracks new CC release notes, classifies changes by impact tier, cross-references official docs, generates update plan at .moai/research/ or .moai/specs/, and synchronizes docs-site 4-locale + README. NOT distributed to user projects.
GitHub Workflow - Manage issues and review PRs with Agent Teams (dev-only). NOT distributed to user projects.
MoAI-ADK production release via Enhanced GitHub Flow (CLAUDE.local.md §18). Creates release/vX.Y.Z branch, version bump, CHANGELOG (bilingual), PR to main, merge commit (NOT squash), then scripts/release.sh for tag + GoReleaser. Hotfix support via --hotfix flag. All git operations delegated to manager-git. Quality failures escalate to expert-debug. NOT distributed to user projects (dev-only).
Run the 7-phase /moai brain ideation workflow to convert ideas into validated proposals
Identify and safely remove dead code with test verification
Scan codebase and generate architecture documentation in codemaps/
Analyze test coverage, identify gaps, and generate missing tests
Hybrid design workflow — Claude Design import (path A) or code-based brand design (path B)