🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

Quality-Driven Development (QDD)

by @kimky1122

Quality-driven development with automatic TDD/DDD methodology selection and TRUST 5 quality framework. Use when building features, refactoring code, fixing b...

Versionv1.1.0
Downloads832
Installs4
TERMINAL
clawhub install quality-driven-dev

πŸ“– About This Skill


name: quality-driven-dev description: "Quality-driven development with automatic TDD/DDD methodology selection and TRUST 5 quality framework. Use when building features, refactoring code, fixing bugs, or any coding task that needs structured quality assurance."

Quality-Driven Development

Structured development methodology inspired by MoAI-ADK's TRUST 5 framework. Automatically selects TDD or DDD based on project state, enforces quality gates, and produces tested, documented code.

Core Philosophy

> "λ°”μ΄λΈŒ μ½”λ”©μ˜ λͺ©μ μ€ λΉ λ₯Έ 생산성이 μ•„λ‹ˆλΌ μ½”λ“œ ν’ˆμ§ˆμ΄λ‹€."

Logging Strategy

All code must include meaningful logs. Logs are the first line of defense for debugging production issues.

Log Levels

| Level | Purpose | Examples | 운영(PRD) | 개발(DEV) | |-------|---------|----------|:---------:|:---------:| | ERROR | μ˜ˆμ™Έ, μ‹€νŒ¨, 볡ꡬ λΆˆκ°€ 상황 | catch 블둝, DB μ—°κ²° μ‹€νŒ¨, ν•„μˆ˜κ°’ λˆ„λ½ | βœ… | βœ… | | WARN | μ˜ˆμƒ λ°– 상황, 볡ꡬ κ°€λŠ₯ | fallback μ‚¬μš©, μž¬μ‹œλ„, deprecated 호좜 | βœ… | βœ… | | INFO | 핡심 νλ¦„λ§Œ κ°„κ²°ν•˜κ²Œ | API 호좜/응닡, μƒνƒœ λ³€κ²½, νŠΈλžœμž­μ…˜ μ‹œμž‘/μ™„λ£Œ | βœ… | βœ… | | DEBUG | 상세 디버깅, 자유둭게 | ν•¨μˆ˜ μ§„μž…/μ’…λ£Œ, λ³€μˆ˜κ°’, 쑰건 λΆ„κΈ°, 쿼리 νŒŒλΌλ―Έν„° | ❌ | βœ… |

Log Placement Rules

λ°˜λ“œμ‹œ 둜그λ₯Ό λ„£μ–΄μ•Ό ν•˜λŠ” κ³³:

  • API μ—”λ“œν¬μΈνŠΈ μ§„μž… (INFO: μš”μ²­ νŒŒλΌλ―Έν„° μš”μ•½)
  • μ™ΈλΆ€ μ„œλΉ„μŠ€ 호좜 μ „/ν›„ (INFO: 호좜 λŒ€μƒ, 응닡 μƒνƒœ)
  • μ—λŸ¬/μ˜ˆμ™Έ catch 블둝 (ERROR: μ—λŸ¬ λ©”μ‹œμ§€ + μ»¨ν…μŠ€νŠΈ)
  • λΉ„μ¦ˆλ‹ˆμŠ€ 둜직 뢄기점 (DEBUG: μ–΄λ–€ λΆ„κΈ°λ‘œ κ°”λŠ”μ§€)
  • μƒνƒœ λ³€κ²½ (INFO: before β†’ after)
  • 배치/μŠ€μΌ€μ€„λŸ¬ μ‹œμž‘/μ™„λ£Œ (INFO: 처리 건수, μ†Œμš” μ‹œκ°„)
  • 둜그 μž‘μ„± 원칙:

  • μš΄μ˜μ—μ„œ INFO만으둜 흐름 좔적이 κ°€λŠ₯ν•΄μ•Ό ν•œλ‹€
  • DEBUGλŠ” λΆ€λ‹΄ 없이 자유둭게 β€” μš΄μ˜μ—μ„  좜λ ₯ μ•ˆ 됨
  • 민감 정보(λΉ„λ°€λ²ˆν˜Έ, 토큰, κ°œμΈμ •λ³΄) μ ˆλŒ€ λ‘œκ·Έμ— 포함 κΈˆμ§€
  • 둜그 λ©”μ‹œμ§€μ— μ»¨ν…μŠ€νŠΈ 포함 (ID, νŒŒλΌλ―Έν„° λ“±) β€” "처리 μ‹€νŒ¨" ❌ β†’ "μ£Όλ¬Έ 처리 μ‹€νŒ¨ [orderId=123, reason=μž¬κ³ λΆ€μ‘±]" βœ…
  • Workflow

    Phase 0: Project Analysis

    Before any coding, analyze the project:

    1. Check if test framework exists (jest, vitest, pytest, go test, etc.) 2. Measure current test coverage (run coverage command if available) 3. Detect language, framework, and project structure 4. Identify logging framework (slf4j, winston, pino, logback, print/console.log etc.) β€” if none exists, recommend and set up one 5. Select methodology automatically:

    Coverage >= 10% OR new project β†’ TDD (default)
    Coverage < 10% AND existing project β†’ DDD
    

    Report the analysis result and selected methodology to the user before proceeding.

    Phase 1: SPEC Document

    Create a SPEC document before implementation:

    # SPEC-{ID}: {Title}

    Goal

    One sentence describing what this change achieves.

    Acceptance Criteria

  • [ ] Criterion 1 (testable)
  • [ ] Criterion 2 (testable)
  • [ ] Criterion 3 (testable)
  • Scope

  • In scope: What will be changed
  • Out of scope: What will NOT be changed
  • Technical Approach

    Brief description of implementation strategy.

    Log Points

    Key locations where logs will be added (level + message summary).

    TRUST 5 Checklist

  • [ ] Tested: All acceptance criteria have corresponding tests
  • [ ] Readable: Code is self-documenting with clear naming
  • [ ] Unified: Follows existing project conventions
  • [ ] Secured: No new vulnerabilities introduced
  • [ ] Trackable: Changes are documented and linked to this SPEC
  • Phase 2A: TDD Execution (New Projects / Coverage >= 10%)

    Follow RED β†’ GREEN β†’ REFACTOR strictly:

    RED β€” Write failing tests first 1. Write test for first acceptance criterion 2. Run test β€” confirm it FAILS 3. Report: "πŸ”΄ RED: Test written and failing as expected"

    GREEN β€” Minimal implementation 1. Write minimum code to pass the test 2. Add appropriate logs at key points (API calls, error handling, state changes) 3. Run test β€” confirm it PASSES 4. Report: "🟒 GREEN: Test passing"

    REFACTOR β€” Clean up 1. Improve code quality while keeping tests green 2. Review log quality β€” ensure levels are correct, messages are clear with context 3. Run all tests β€” confirm everything still passes 4. Report: "♻️ REFACTOR: Code cleaned, all tests green"

    Repeat for each acceptance criterion.

    Phase 2B: DDD Execution (Existing Projects / Coverage < 10%)

    Follow ANALYZE β†’ PRESERVE β†’ IMPROVE:

    ANALYZE β€” Understand existing code 1. Read existing code and identify dependencies 2. Map domain boundaries and side effects 3. Check existing logging β€” identify gaps where logs are missing 4. Report: "πŸ” ANALYZE: Current behavior documented"

    PRESERVE β€” Capture current behavior 1. Write characterization tests for existing behavior 2. Run tests β€” confirm they pass against current code 3. Report: "πŸ›‘οΈ PRESERVE: Characterization tests in place"

    IMPROVE β€” Change under test protection 1. Make changes incrementally 2. Add/improve logs at changed code paths 3. Run tests after each change 4. Report: "πŸ“ˆ IMPROVE: Changes verified by tests"

    Phase 3: TRUST 5 Quality Gate

    Before declaring work complete, verify all 5 principles:

    | Principle | Check | Action | |-----------|-------|--------| | Tested | Run full test suite | All tests pass, coverage maintained or improved | | Readable | Review naming, comments, log messages | Fix unclear names, ensure log messages have context | | Unified | Check style consistency, log format consistency | Match existing patterns (indent, naming, log format) | | Secured | Security review, log content review | No hardcoded secrets, no sensitive data in logs | | Trackable | Documentation, log coverage | Changes described, key paths have appropriate logs |

    Only proceed to completion when ALL 5 checks pass.

    Phase 4: Completion Report

    ## βœ… SPEC-{ID} Complete

    Methodology: {TDD|DDD}

    Changes:

  • {file1}: {what changed}
  • {file2}: {what changed}
  • Log Points Added:

  • {file1:line}: {level} - {description}
  • {file2:line}: {level} - {description}
  • Test Results:

  • Tests: {passed}/{total}
  • Coverage: {before}% β†’ {after}%
  • TRUST 5:

  • βœ… Tested | βœ… Readable | βœ… Unified | βœ… Secured | βœ… Trackable
  • Agent Roles

    When working on complex tasks, delegate to specialized perspectives:

    | Role | Focus | When to Activate | |------|-------|-----------------| | Architect | System design, API contracts | New feature, structural change | | Backend | API, DB, business logic | Server-side work | | Frontend | UI, UX, components | Client-side work | | Security | Vulnerabilities, auth, input validation | Auth features, data handling | | Tester | Test strategy, edge cases, coverage | Always (TRUST 5 - Tested) | | Performance | Optimization, profiling | Load-sensitive features |

    For each task, identify which roles are relevant and apply their perspective during review.

    Reference Guides

    | Topic | Reference | Load When | |-------|-----------|-----------| | TDD Patterns | references/tdd-patterns.md | TDD methodology selected | | DDD Patterns | references/ddd-patterns.md | DDD methodology selected | | TRUST 5 Detail | references/trust5-checklist.md | Quality gate phase | | Language-specific | references/lang-{language}.md | Language-specific patterns needed |

    Constraints

    MUST DO:

  • Always analyze project before choosing methodology
  • Always create SPEC before coding
  • Always write tests (TDD: before code, DDD: before changes)
  • Always run TRUST 5 gate before completion
  • Report progress at each phase transition
  • Always add meaningful logs with appropriate levels at key code points
  • Always ensure tests are actually executed (not just written) β€” run the test suite and confirm results before proceeding
  • MUST NOT:

  • Skip test writing for any reason
  • Write implementation before tests (TDD mode)
  • Modify untested code without characterization tests first (DDD mode)
  • Declare complete without all 5 TRUST checks passing
  • Change code outside the SPEC scope
  • Log sensitive data (passwords, tokens, personal info)
  • Skip logging at error/catch blocks
  • πŸ”’ Constraints

    MUST DO:

  • Always analyze project before choosing methodology
  • Always create SPEC before coding
  • Always write tests (TDD: before code, DDD: before changes)
  • Always run TRUST 5 gate before completion
  • Report progress at each phase transition
  • Always add meaningful logs with appropriate levels at key code points
  • Always ensure tests are actually executed (not just written) β€” run the test suite and confirm results before proceeding
  • MUST NOT:

  • Skip test writing for any reason
  • Write implementation before tests (TDD mode)
  • Modify untested code without characterization tests first (DDD mode)
  • Declare complete without all 5 TRUST checks passing
  • Change code outside the SPEC scope
  • Log sensitive data (passwords, tokens, personal info)
  • Skip logging at error/catch blocks