---
description: "Mirdan quality workflow guide"
---

# mirdan Quality Workflow

> Auto-generated by mirdan. Regenerate with `mirdan init --upgrade`.

## Quality Sandwich (Mandatory for All Coding Tasks)

### Before Writing Code
1. Call `mcp__mirdan__enhance_prompt(task_description)` to get:
   - Quality requirements for this specific task
   - Security sensitivity detection (`touches_security`)
   - Framework-specific guidance
   - Tool recommendations (call these MCPs)
   - A `session_id` — **save this and pass it to every validate call**

### After Writing Code
2. Call `mcp__mirdan__validate_code_quality(code, session_id=<id>)` to validate:
   - Pass `check_security=true` if `touches_security` was flagged
   - Fix ALL errors before proceeding
   - On re-validation, read `session_context` for delta: resolved / new / persistent
   - Follow `recommendation_reminders` to confirm MCPs from step 1 were used

### Before Marking Complete
3. Ensure validation passes with no errors

## Available Tools

| Tool | Purpose | When to Use |
|------|---------|-------------|
| `enhance_prompt` | Quality framework for a task | Start of ANY coding task |
| `validate_code_quality` | Full code validation | After writing code |
| `validate_quick` | Fast security-only check | Real-time feedback (hooks) |
| `get_quality_standards` | Language/framework rules | Before coding in {{language}} |
| `scan_conventions` | Discover and persist project patterns | After establishing project conventions |
| `get_quality_trends` | Track quality over time | Periodic health checks |

## Convention Learning Cycle

Run `scan_conventions` after establishing code patterns in a project. Discovered conventions
are persisted to `.mirdan/conventions.yaml` and automatically included in future
`enhance_prompt` quality requirements — no manual configuration needed.

## Project Context
- **Language**: {{language}}
- **Frameworks**: {{frameworks}}
- **Quality enforcement**: Automatic via hooks

## Auto-Fix
When violations are found, mirdan provides fix suggestions.
Apply fixes with `mirdan fix <file>` or review suggestions inline.
