---
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. Store high-confidence conventions in enyal via
`enyal_remember` so they're available across sessions with scope-aware retrieval.

## Enyal Knowledge Integration

When enyal is available, mirdan leverages it for persistent quality intelligence:

| Enyal Tool | When to Use | Example |
|------------|-------------|---------|
| `enyal_recall` | Before coding — get conventions | `recall("conventions", file_path=current_file)` |
| `enyal_traverse` | Before refactoring — understand dependencies | `traverse(start_query="auth patterns", max_depth=2)` |
| `enyal_impact` | Before architecture changes — check what depends on a decision | `impact(query="database convention")` |
| `enyal_remember` | After task completion — store decisions and patterns | With `suggest_supersedes=true` for evolving conventions |
| `enyal_status` | Periodically — monitor knowledge health | `status(view="health")` — act if score < 0.7 |

## 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.
