xiaohongshu
xiaohongshu
arch-check
Verify architecture health including layer violations, circular dependencies, package structure, and design pattern compliance
Full skill instructions
Verify the codebase adheres to architectural principles, layer boundaries, and design patterns.
This project follows a layered architecture:
┌─────────────────────────────────────────┐
│ Controller Layer │ ← HTTP endpoints
├─────────────────────────────────────────┤
│ Service Layer │ ← Business logic
├─────────────────────────────────────────┤
│ Provider / Strategy / Mapper Layer │ ← Data access, transformations
├─────────────────────────────────────────┤
│ Model Layer │ ← Domain objects (records)
└─────────────────────────────────────────┘
Allowed Dependencies:
Violations to detect:
// BAD: Controller importing Strategy
import ...service.strategy.FetchCurrentConditionsStrategy;
// BAD: Provider importing Controller
import ...controller.SpotsController;
// BAD: Model importing Service
import ...service.AggregatorService;
Use Grep to check imports in each layer:
# Controllers should not import strategies directly
grep -r "import.*strategy" src/main/java/**/controller/
# Providers should not import controllers or services
grep -r "import.*controller\|import.*service[^/]" src/main/java/**/provider/
# Models should not import anything except other models
grep -r "import.*service\|import.*controller\|import.*provider" src/main/java/**/model/
Check for circular imports between packages:
Package dependency graph:
controller → service → provider
→ strategy
→ mapper
→ model (allowed from all)
Search patterns:
// Check if Service A imports Service B and vice versa
// File: ServiceA.java contains "import ...ServiceB"
// File: ServiceB.java contains "import ...ServiceA"
Common circular dependency patterns:
Verify expected package structure:
src/main/java/com/github/pwittchen/varun/
├── Application.java # Main entry point
├── config/ # Configuration classes
│ └── *Config.java
├── controller/ # REST controllers
│ └── *Controller.java
├── exception/ # Custom exceptions
│ └── *Exception.java
├── mapper/ # Data mappers
│ └── *Mapper.java
├── model/ # Domain models (records)
│ └── *.java
├── provider/ # Data providers
│ └── *Provider.java
└── service/ # Business services
├── *Service.java
└── strategy/ # Strategy implementations
└── *Strategy*.java
Check for:
FooManager instead of FooService)// Interface
interface FetchCurrentConditionsStrategy {
boolean canProcess(int windguruId);
CurrentConditions fetch();
}
// Check all implementations:
// - Implement the interface
// - Have canProcess() method
// - Are registered/discoverable (via @Component or explicit registration)
// Check providers:
// - Single responsibility (one data source)
// - Return domain models
// - Don't contain business logic
// Check cache usage:
// - Caches are in service layer (not controller)
// - Cache keys are consistent
// - Cache invalidation is handled
Check for:
// BAD: Direct instantiation of services
private ForecastService service = new ForecastService();
// GOOD: Constructor injection
private final ForecastService service;
public MyService(ForecastService service) {
this.service = service;
}
// BAD: Field injection (harder to test)
@Autowired
private ForecastService service;
// GOOD: Constructor injection with Lombok
@RequiredArgsConstructor
public class MyService {
private final ForecastService forecastService;
}
Search for anti-patterns:
grep -r "@Autowired" src/main/java/
grep -r "new.*Service\(\)" src/main/java/
Analyze classes for responsibility violations:
Warning signs:
Check service classes:
// RED FLAG: Service doing too much
class BigService {
void handleRequest() // HTTP concern
void processData() // Business logic
void saveToCache() // Data concern
void sendNotification() // Side effect
void formatResponse() // Presentation
}
Controller conventions:
// Check all controllers follow same patterns:
@RestController
@RequestMapping("/api/v1/...")
public class XxxController {
// GET for reads
@GetMapping("/{id}")
public Mono<Xxx> getById(@PathVariable int id)
// POST for creates
@PostMapping
public Mono<Xxx> create(@RequestBody XxxRequest request)
// Consistent response types (Mono/Flux)
// Consistent error handling
}
Check for:
Check configuration is externalized:
// BAD: Hardcoded values in code
private static final String API_URL = "https://api.example.com";
private static final int TIMEOUT = 5000;
// GOOD: Externalized configuration
@Value("${api.url}")
private String apiUrl;
// or
@ConfigurationProperties(prefix = "api")
public class ApiConfig {
private String url;
private int timeout;
}
Search for hardcoded values:
grep -r "http://" src/main/java/
grep -r "https://" src/main/java/
grep -rE "[0-9]{4,}" src/main/java/ # Large numbers (ports, timeouts)
Check exception flow:
Controller → Service → Provider/Strategy
↑ ↑ ↑
└───────────┴───────────┴── Exceptions bubble up
Controller: Translates to HTTP responses
Service: May wrap in domain exceptions
Provider: Throws low-level exceptions
Verify:
Check test structure mirrors main:
src/test/java/
├── controller/ # Controller tests (WebTestClient)
├── service/ # Service unit tests
├── provider/ # Provider tests
├── strategy/ # Strategy tests
└── integration/ # Integration tests
src/e2e/java/ # End-to-end tests (Playwright)
Verify:
## Architecture Health Report
### Summary
| Check | Status | Issues |
|-------|--------|--------|
| Layer Violations | ✓/✗ | X |
| Circular Dependencies | ✓/✗ | X |
| Package Structure | ✓/✗ | X |
| Design Patterns | ✓/✗ | X |
| DI Compliance | ✓/✗ | X |
| Single Responsibility | ✓/✗ | X |
| API Consistency | ✓/✗ | X |
### Layer Violations
#### [Violation Description]
**File**: `path/to/file.java:line`
**Issue**: Controller directly imports Strategy
**Impact**: Bypasses service layer, harder to test
**Fix**: Inject service that uses strategy
### Circular Dependencies
ServiceA ←→ ServiceB (CIRCULAR)
**Fix**: Extract shared logic to new service, or use events
### Package Structure Issues
| File | Current Package | Expected Package |
|------|-----------------|------------------|
| FooHelper.java | service | util or helper |
### Design Pattern Violations
#### Strategy Pattern
- Missing: `XxxStrategy` not implementing interface
- Orphaned: `YyyStrategy` not registered
### Dependency Injection Issues
| File | Line | Issue | Fix |
|------|------|-------|-----|
| Service.java | 15 | Field injection | Use constructor |
| Handler.java | 23 | Direct instantiation | Inject dependency |
### Single Responsibility Concerns
| Class | Lines | Methods | Dependencies | Concern |
|-------|-------|---------|--------------|---------|
| BigService | 650 | 15 | 9 | Consider splitting |
### Hardcoded Values Found
| File | Line | Value | Recommendation |
|------|------|-------|----------------|
| Client.java | 42 | "https://..." | Move to config |
### Architecture Diagram (Current)
┌─────────────┐ ┌─────────────┐ │ Controller │────▶│ Service │ └─────────────┘ └──────┬──────┘ │ ┌────────────┼────────────┐ ▼ ▼ ▼ ┌─────────┐ ┌─────────┐ ┌─────────┐ │Provider │ │Strategy │ │ Mapper │ └─────────┘ └─────────┘ └─────────┘
### Recommendations
1. **Critical**: Fix circular dependency between X and Y
2. **High**: Refactor BigService into smaller services
3. **Medium**: Move hardcoded URLs to configuration
4. **Low**: Rename FooManager to FooService for consistency
Glob to list all Java files by packageGrep to check imports in each layerxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience