Agent Skillsmodu-ai/moai-adk › moai-foundation-quality

moai-foundation-quality

GitHub

提供MoAI质量模型背景,涵盖TRUST 5原则及通过Agent、Harness和命令实现的代码审查、质量门禁检查与合规性评估机制。

.claude/skills/moai-foundation-quality/SKILL.md modu-ai/moai-adk

Trigger Scenarios

代码审查 质量门禁检查 覆盖率目标设定 TRUST 5合规性评估

Install

npx skills add modu-ai/moai-adk --skill moai-foundation-quality -g -y
More Options

Non-standard path

npx skills add https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-foundation-quality -g -y

Use without installing

npx skills use modu-ai/moai-adk@moai-foundation-quality

指定 Agent (Claude Code)

npx skills add modu-ai/moai-adk --skill moai-foundation-quality -a claude-code -g -y

安装 repo 全部 skill

npx skills add modu-ai/moai-adk --all -g -y

预览 repo 内 skill

npx skills add modu-ai/moai-adk --list

SKILL.md

Frontmatter
{
    "name": "moai-foundation-quality",
    "license": "Apache-2.0",
    "metadata": {
        "tags": "foundation, quality, testing, validation, trust-5, best-practices, code-review",
        "status": "active",
        "aliases": "moai-foundation-quality",
        "updated": "2026-07-10",
        "version": "3.0.0",
        "category": "foundation",
        "modularized": "true"
    },
    "description": "TRUST 5 quality principles and how MoAI enforces them through agents, the 3-level harness, \/moai gate, and sync-auditor scoring. Use for code review, quality gate checks, coverage targets, or TRUST 5 compliance.\n",
    "when_to_use": "Use for code-quality guidance: TRUST 5 principles (Tested, Readable, Unified, Secured, Trackable), the 3-level harness (minimal\/standard\/ thorough), \/moai gate (lint+format+type+test), coverage targets, security checks, language-aware toolchains, code-smell detection, and technical-debt triage.\n",
    "allowed-tools": "Read, Grep, Glob",
    "compatibility": "Designed for Claude Code",
    "user-invocable": false,
    "progressive_disclosure": {
        "enabled": true,
        "level1_tokens": 100,
        "level2_tokens": 5000
    }
}

TRUST 5 Quality Principles and Enforcement

This skill provides background knowledge on MoAI's quality model: the five TRUST 5 principles, how agents enforce them, the 3-level harness, and the language-aware toolchains that /moai gate runs. MoAI does NOT ship a quality-validation library — quality is enforced through agents (manager-develop, sync-auditor), slash commands (/moai gate, /moai review), and the harness (minimal/standard/thorough).

Quick Reference

TRUST 5 Principles (Tested, Readable, Unified, Secured, Trackable) are quality dimensions, not code objects. Every code change is evaluated against all five.

Quality Mechanisms (the real enforcement layer):

  • /moai gate — runs lint + format + type-check + test in parallel as a pre-commit quality gate (<30s). Auto-detects the project language and runs the appropriate toolchain.
  • manager-develop (run-phase) — implements via cycle_type ∈ {tdd, ddd, autofix}; the chosen cycle shapes how tests and behavior are produced.
  • sync-auditor — independent skeptical quality assessment with 4-dimension scoring (Functionality, Security, Craft, Consistency), scored as the harmonic mean of dimensions, not the average.
  • 3-level harness — minimal (fast validation), standard (default checks), thorough (full sync-auditor + TRUST 5). Auto-determined by the Complexity Estimator based on SPEC scope.
  • LSP quality gates — phase-specific thresholds (run: zero errors/type-errors/ lint-errors; sync: zero errors, max 10 warnings, clean LSP).

The MoAI Quality Model

MoAI does not provide a Python SDK or any library for quality validation. Quality is enforced through the workflow, the agents, and the gate commands. This skill documents how those pieces fit together so a Claude invocation can reason about quality correctly.

How TRUST 5 is enforced per phase

Phase Quality check Owner
plan Capture LSP baseline; identify quality risks in the plan manager-spec
run Zero errors/type-errors/lint-errors; tests pass; coverage met manager-develop (cycle_type shapes the approach)
sync Lint clean (≤10 warnings); docs updated; TRUST 5 re-affirmed manager-docs, then sync-auditor scores
audit Independent 4-dimension scoring (Functionality/Security/Craft/Consistency) sync-auditor

cycle_type and quality (manager-develop)

The run-phase cycle_type selects how quality is built in:

  • tdd — Test-Driven Development (RED-GREEN-REFACTOR). Behavior is specified by a failing test first, then implemented. Best for new features.
  • ddd — Domain-Driven refactoring (ANALYZE-PRESERVE-IMPROVE). Behavior-preserving transformation of existing code. Best for refactoring and debt reduction.
  • autofix — diagnostic-driven fixing (LSP / lint / type errors). Best for /moai fix and regression recovery.

See Skill("moai-workflow-tdd"), Skill("moai-workflow-ddd"), and Skill("moai-workflow-loop") for the per-cycle mechanics.

TRUST 5 Principles

TRUST 5 is a mnemonic for five quality dimensions. Treat each as a question to ask of any change, not a score to compute.

  • T — Tested: Does the change have tests? Are they green? Is coverage at or above the project threshold (85%+ by default)? For existing untested code, are characterization tests capturing current behavior?
  • R — Readable: Is naming clear? Are comments in English (or the configured code-comments language)? Could a new contributor follow the logic without a walkthrough?
  • U — Unified: Does the change match the file's existing conventions (naming, error handling, imports)? Is it formatted with the project's formatter? Consistency within a file beats personal preference.
  • S — Secured: Are all external inputs validated? Does it follow OWASP guidance for web security? Are credentials kept out of version control (environment variables instead)? See moai-ref-owasp-checklist.
  • T — Trackable: Does the commit follow Conventional Commits? Does it reference the SPEC / issue it implements? Can the change be traced back to a requirement?

For the per-principle assessment checklist and the "not applicable" guard, see TRUST 5 Principles.

Quality Gates and the 3-Level Harness

The harness level controls how deep quality validation goes. It is auto-determined by the Complexity Estimator based on SPEC scope.

Level What runs When
minimal Fast validation only (lint + type + test) Small SPECs, low risk
standard Default checks (lint + type + test + format) Most SPECs
thorough Full sync-auditor + 4-dimension TRUST 5 scoring Large SPECs, high risk

/moai gate is the lightweight pre-commit entry point: it runs lint + format + type-check + test in parallel and applies no fixes. It is the fastest way to get a quality signal. For deeper review use /moai review.

Language-Aware Toolchains

The quality gate auto-detects the project language and runs the appropriate toolchain. Tools that are not installed are skipped gracefully; projects with no recognized language marker pass the gate silently. This skill is language-neutral — the 16 supported languages are treated equally.

Language Lint Format Test
Go go vet → golangci-lint gofmt go test
Python ruff black pytest
TypeScript / JavaScript eslint prettier jest / mocha
Rust cargo clippy rustfmt cargo test
Java / Kotlin (per project linter) (per project) junit
Ruby rubocop rubocop rspec
PHP phpstan / phpcs php-cs-fixer pest / phpunit
... (16 languages supported; auto-detected)

For the full toolchain mapping and how /moai gate detects the language, see Language-Aware Toolchains.

Module Reference

Each module is loaded on demand. Load the one relevant to the current task.

  • TRUST 5 Principles — the five dimensions as assessment questions, per-principle checklists, and the "not applicable" guard.
  • Proactive Analysis — how /moai gate, /moai review, and /moai loop surface quality issues proactively, and how to triage findings.
  • Best Practices — using WebSearch / WebFetch for up-to-date framework/library best practices, and validating against them.
  • Integration Patterns — how quality fits into the SPEC workflow phases (plan/run/sync) and the harness levels.

Reference Files

  • examples.md — worked TRUST 5 assessment examples and gate/review triage walkthroughs. Load when applying TRUST 5 to a concrete change.
  • reference.md — the quality-mechanism reference: harness level detail, language toolchain table, agent roles, and the sync-auditor scoring model. Load when you need the authoritative mapping.

Works Well With

Agents (see CLAUDE.md §4 for the 11-agent catalog):

  • manager-develop — run-phase implementation; owns the Tested and Unified principles through cycle_type.
  • sync-auditor — independent 4-dimension quality scoring (Functionality / Security / Craft / Consistency).
  • Explore (Anthropic built-in) — read-only codebase exploration before assessing quality.

Skills:

  • moai-foundation-core — TRUST 5 framework cross-reference and SPEC workflow foundations.
  • moai-ref-testing-pyramid — test-pyramid strategy, coverage targets, and test patterns.
  • moai-ref-owasp-checklist — OWASP Top 10 security checklist for the Secured principle.
  • moai-workflow-tdd / moai-workflow-ddd / moai-workflow-loop — the cycle_type workflows that manager-develop uses.

Commands:

  • /moai gate — pre-commit quality gate (lint + format + type + test).
  • /moai review — code review with security and MX-tag compliance.
  • /moai fix — auto-detect and fix LSP/lint/type errors.
  • /moai loop — iterative fix loop until resolved or max iterations.

Common Rationalizations

Rationalization Reality
"The linter warnings are false positives" False positives should be suppressed with inline comments. Ignoring them trains the team to ignore real issues.
"Security scanning can wait until before release" Security vulnerabilities compound. Late discovery means expensive rework. Scan continuously.
"Coverage is high enough, the remaining 15% is edge cases" Edge cases are where production bugs live. The uncovered code is the riskiest code.
"Code review is subjective, automation is sufficient" Automation catches syntax and patterns. Reviews catch design flaws, naming confusion, and missing abstractions.
"TRUST 5 is too bureaucratic for a hotfix" Hotfixes without quality gates introduce the next hotfix. TRUST 5 on a hotfix is the minimum, not the maximum.

Chesterton's Fence: Before removing a quality check, understand why it was added. Removing a gate without understanding its history repeats the failure it was designed to prevent.

Shift Left: The earlier a defect is found, the cheaper it is to fix. Quality checks belong in the development loop, not at the end of it.

Red Flags

  • Linter or type-checker warnings suppressed globally instead of per-line
  • OWASP checklist not consulted when handling user input or authentication
  • Coverage report not generated for a commit that adds new functionality
  • TRUST 5 dimension skipped with "not applicable" without justification
  • Quality report generated but no action taken on identified issues

Verification

  • Linter runs clean or remaining warnings have inline suppression comments with reasons (show the command output)
  • OWASP checklist reviewed for security-relevant changes (show checklist references)
  • Coverage report generated and threshold met (show tool output)
  • All five TRUST 5 dimensions assessed (show assessment for each)
  • Quality findings triaged with a resolution plan for each
  • No global rule disabling in linter configuration

Version History

  • 4100d87 Current 2026-08-20 09:08

Same Skill Collection

.claude/skills/hns-lsel-curator/SKILL.md
.claude/skills/hns-moaiadk-dev-reference/SKILL.md
.claude/skills/hns-oss-docs-i18n-rules/SKILL.md
.claude/skills/hns-oss-docs-readme-sync/SKILL.md
.claude/skills/hns-oss-docs-structure-map/SKILL.md
.claude/skills/hns-oss-docs-verify/SKILL.md
.claude/skills/hns-workflow-ci-loop/SKILL.md
.claude/skills/moai-domain-backend/SKILL.md
.claude/skills/moai-domain-database/SKILL.md
.claude/skills/moai-domain-frontend/SKILL.md
.claude/skills/moai-domain-humanize/SKILL.md
.claude/skills/moai-domain-svg-infographic/SKILL.md
.claude/skills/moai-foundation-cc/SKILL.md
.claude/skills/moai-foundation-core/SKILL.md
.claude/skills/moai-foundation-thinking/SKILL.md
.claude/skills/moai-harness-learner/SKILL.md
.claude/skills/moai-kanban-foreman/SKILL.md
.claude/skills/moai-meta-harness/SKILL.md
.claude/skills/moai-ref-api-patterns/SKILL.md
.claude/skills/moai-ref-cross-model-audit/SKILL.md
.claude/skills/moai-ref-git-workflow/SKILL.md
.claude/skills/moai-ref-owasp-checklist/SKILL.md
.claude/skills/moai-ref-react-patterns/SKILL.md
.claude/skills/moai-ref-testing-pyramid/SKILL.md
.claude/skills/moai-ref-ui-polish/SKILL.md
.claude/skills/moai-workflow-ddd/SKILL.md
.claude/skills/moai-workflow-docs-claim-check/SKILL.md
.claude/skills/moai-workflow-loop/SKILL.md
.claude/skills/moai-workflow-project/SKILL.md
.claude/skills/moai-workflow-spec/SKILL.md
.claude/skills/moai-workflow-tdd/SKILL.md
.claude/skills/moai-workflow-testing/SKILL.md
.claude/skills/moai-workflow-worktree/SKILL.md
.claude/skills/moai/SKILL.md
.moai/archive/skills/v2.16/moai-framework-electron/SKILL.md
.moai/archive/skills/v2.16/moai-platform-auth/SKILL.md
.moai/archive/skills/v2.16/moai-platform-chrome-extension/SKILL.md
.moai/archive/skills/v2.16/moai-platform-deployment/SKILL.md
.moai/archive/skills/v3.0/moai-design-craft/SKILL.md
.moai/archive/skills/v3.0/moai-design-tools/SKILL.md
.moai/archive/skills/v3.0/moai-docs-generation/SKILL.md
.moai/archive/skills/v3.0/moai-domain-uiux/SKILL.md
.moai/archive/skills/v3.0/moai-foundation-context/SKILL.md
.moai/archive/skills/v3.0/moai-foundation-philosopher/SKILL.md
.moai/archive/skills/v3.0/moai-platform-database-cloud/SKILL.md
.moai/archive/skills/v3.0/moai-tool-svg/SKILL.md
.moai/archive/skills/v3.0/moai-workflow-jit-docs/SKILL.md
.moai/archive/skills/v3.0/moai-workflow-templates/SKILL.md
.moai/archive/skills/v3.0/moai-workflow-thinking/SKILL.md

Metadata

Files
0
Version
4100d87
Hash
10af2b7a
Indexed
2026-08-20 09:08

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 06:25
浙ICP备14020137号-1 $방문자$