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...
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
λ°λμ λ‘κ·Έλ₯Ό λ£μ΄μΌ νλ κ³³:
λ‘κ·Έ μμ± μμΉ:
"μ²λ¦¬ μ€ν¨" β β "μ£Όλ¬Έ μ²λ¦¬ μ€ν¨ [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} CompleteMethodology: {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:
MUST NOT:
π Constraints
MUST DO:
MUST NOT: