--- title: "Design Rule Checks" description: "Run DRC checks, track violations, and generate rule sets" --- The DRC tools let you run Design Rule Checks on your KiCad PCB designs, get detailed violation reports, track progress over time, and generate technology-specific rule sets. All DRC operations use `kicad-cli` and do not require a running KiCad instance. ## Prerequisites - KiCad 9.0 or newer installed - `kicad-cli` available in your system PATH (included with KiCad 9.0+) ## Running a DRC check ``` Run a DRC check on my project at /path/to/project.kicad_pro ``` The `run_drc_check` tool: - Locates the `.kicad_pcb` file for the project - Runs DRC via `kicad-cli pcb drc` - Parses the JSON report to extract violations - Saves results to DRC history - Compares with previous runs (if available) ## Viewing DRC reports ### Current report ``` Show me the DRC report for /path/to/project.kicad_pro ``` Loads the `kicad://drc/project_path` resource, showing total violations, categorized issues, violation details with locations, and recommendations for common fixes. ### DRC history ``` Show me the DRC history for /path/to/project.kicad_pro ``` Loads the `kicad://drc/history/project_path` resource, showing a visual trend of violations over time, table of all check runs, comparison between first and most recent checks, and progress indicators. ## Understanding violations ### Common categories | Category | Description | Common fixes | |----------|-------------|-------------| | Clearance | Items too close together | Increase spacing, reroute traces | | Track Width | Traces too narrow | Increase trace width, check current requirements | | Annular Ring | Via rings too small | Increase via size, adjust manufacturing settings | | Drill Size | Holes too small | Increase drill diameter, check fab capabilities | | Silkscreen | Silkscreen conflicts with pads | Adjust silkscreen position, resize text | | Courtyard | Component courtyards overlap | Adjust placement, reduce footprint sizes | ## Generating rule sets ### Technology-specific rules ``` Create a DRC rule set for HDI technology ``` The `create_drc_rule_set` tool generates rules tailored to specific PCB technologies: - **standard** -- conventional PCB manufacturing - **HDI** -- high-density interconnect - **RF** -- radio frequency designs - **automotive** -- automotive-grade requirements ### Exporting rules ``` Export DRC rules for RF technology in KiCad format ``` The `export_kicad_drc_rules` tool outputs rules in KiCad-compatible text format, ready to paste into your project's design rules. ### Manufacturing constraints ``` Get manufacturing constraints for automotive technology ``` The `get_manufacturing_constraints` tool returns numeric limits (minimum track width, clearance, via size, etc.) along with design recommendations and notes for the specified technology. ## Workflow The DRC tools work alongside KiCad's built-in DRC: 1. Run the mckicad DRC check to get an overview and start tracking progress 2. Use KiCad's built-in DRC for interactive fixes (highlights exact locations in the editor) 3. Re-run the mckicad DRC to verify fixes and update the history ## Custom design rules Use the DRC prompt templates for help creating specialized rules: ``` I need custom design rules for a high-voltage circuit with 2kV isolation ``` This provides guidance for high-voltage circuits, high-current paths, RF constraints, and specialized manufacturing requirements. ## Troubleshooting ### DRC check fails 1. Ensure the project exists at the specified path 2. Verify the project contains a `.kicad_pcb` file 3. Check that `kicad-cli` is in your PATH or set `KICAD_CLI_PATH` 4. Use the full absolute path to the project file 5. Check the server logs for detailed error information ### Incomplete results 1. Verify the PCB file is not corrupted -- try opening it in KiCad 2. Ensure you are using KiCad 9.0+ for full kicad-cli DRC support 3. Check that all referenced libraries are available