What problem does it solve?
When contributing to dd-trace-py, imports that cross architectural boundaries (foundation code depending on products, or products depending on each other) create hidden coupling and circular-import risk. This Skill runs the dependency direction detector locally, interprets its output, and guides you through structurally sound fixes so the detect_layering_violations CI job passes.
Core Features & Use Cases
- Violation Detection: Runs scripts/import-analysis/layers.py to analyze the codebase and produce a violations.json report with severity scores, zone classifications, and tangle indicators.
- CI Comparison: Compares PR results against a base-branch snapshot to distinguish new, pre-existing, worsened, and removed violations, plus uncovered top-level modules.
- Architectural Fix Patterns: Provides five concrete remediation patterns (core event bus, dependency inversion, shared-type extraction, code relocation, foundation demotion) with a decision checklist, explicitly forbidding deferred imports as a fix.
- Use Case: Your PR fails the detect_layering_violations CI job because ddtrace.internal.tracemethods imports ddtrace.trace. Use this Skill to reproduce the violation locally, identify the exact cross-boundary names, and apply the appropriate restructuring pattern.
Quick Start
Run the dependency direction detector on my branch and propose fixes for any new layering violations it reports.