Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Coordination?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/andreibesleaga-coordination-3fadaec5)
---
name: agentic-linter
description: Enforce architecture layer boundaries defined in AGENTS.md — detect and fix import violations
triggers: [architecture lint, boundary, import violation, layer check, ADD, circular dependency, dependency check]
tags: [coordination]
context_cost: medium
---
# Agentic Linter Skill
## Goal
Enforce the architectural layer rules defined in AGENTS.md Section 3. Act as a semantic linter that detects boundary violations and proposes concrete fixes using the Dependency Inversion Principle.
## Steps
1. **Load architecture rules from AGENTS.md**
- Read AGENTS.md Section 3 (Architecture Rules / Layer Definitions)
- Map each layer to its allowed imports
- Note any project-specific forbidden patterns
2. **Run import graph analysis**
**For TypeScript/JavaScript (Node.js):**
```bash
# Check circular dependencies
npx madge@8.0.0 --circular --extensions ts,js src/
# Check layer violations (if .dependency-cruiser.cjs configured)
npx dependency-cruiser --config .dependency-cruiser.cjs src/
```
**For PHP/Laravel:**
```bash
# Deptrac for DDD layer enforcement
vendor/bin/deptrac analyse --config-file deptrac.yaml
```
**For Python/FastAPI:**
```bash
# Import Linter (layer rules defined in .import-linter.ini)
lint-imports
```
**Manual check (if tools not installed):**
- Read each file in inner layers (domain, application)
- Scan imports for references to outer layers (infrastructure, HTTP, database)
3. **Classify violations**
- **Circular dependency:** A → B → A (any length cycle)
- **Layer inversion:** Inner layer imports outer layer (domain imports infrastructure)
- **God object:** Class with > 20 public methods (file length is limited by Constitution Article III, not checked here)
- **Framework leak:** Domain entity imports from web framework or ORM
4. **For each violation, propose a concrete fix**
**Circular dependency fix:**
```typescript
// PROBLEM: UserService imports OrderService, OrderService imports UserService
// SOLUTION: Extract shared interface
// src/domain/ports/user-query-port.ts
export interface IUserQueryPort {
findById(id: string): Promise<User | null>;
}
// UserService implements IUserQueryPort
// OrderService depends on IUserQueryPort (not UserService directly)
```
**Layer inversion fix (Dependency Inversion Principle):**
```typescript
// PROBLEM: domain/User.ts imports from infrastructure/PrismaClient
// SOLUTION: Create interface in inner layer
// src/domain/ports/user-repository.ts
export interface IUserRepository {
save(user: User): Promise<void>;
findById(id: string): Promise<User | null>;
}
// src/infrastructure/prisma-user-repository.ts
// implements IUserRepository (infrastructure depends on domain, not reverse)
```
5. **Apply fixes** (if instructed, or propose for human review)
- Create the interface file in the inner layer
- Update the outer layer implementation to implement the interface
- Update dependency injection wiring in main/composition root
- Run tests to verify nothing broke
6. **Re-run analysis** — confirm violations are resolved
7. **Generate configuration file** (if requested)
```javascript
// .dependency-cruiser.cjs — generated configuration
module.exports = {
forbidden: [
{
name: 'domain-not-to-infrastructure',
severity: 'error',
from: { path: '^src/domain' },
to: { path: '^src/infrastructure' }
},
{
name: 'no-circular',
severity: 'error',
from: {},
to: { circular: true }
}
]
};
```
## Constraints
- Do not just report violations — always provide a concrete fix proposal
- Fix proposals must not change the external behavior of the code
- New interface files should be placed in the innermost layer that uses them
- After applying fixes, all existing tests must still pass
## Output Format
Violation report with file:line references + concrete fix for each. Run summary: "[N] violations found, [N] fixed, [N] proposed for review."
## Limits and safety
- Run the analysis tools on a branch or working copy. Do not run project scripts you have not read just to trace imports.
- Do not edit `.dependency-cruiser.cjs`, `deptrac.yaml` or the import-linter config to make a violation disappear; changing them needs the human's yes.
- Propose fixes first. Apply them only when asked, on a branch, and run the full tests before and after.
- A fix must keep access checks and input escaping unchanged; show the diff of any method whose visibility changes.