Apply software design principles across architecture and implementation using deterministic decision workflows, SOLID checks, structural patterns, and anti-pattern detection; use when reviewing designs, refactoring modules, or resolving maintainability and coupling risks.
Does it follow best practices?
Evaluation — 99%
↑ 1.01xAgent success when using this tile
Validation for skill structure
You are reviewing the domain model for a library management system. The development team has been struggling with business logic scattered across services, difficulty testing business rules, and frequent bugs in book lending policies. The current model has grown organically and now exhibits classic "anemic domain model" symptoms.
Your task is to evaluate the current domain design and provide recommendations to transform it into a rich domain model that properly encapsulates business logic and rules.
Create a design review report called domain-refactor.md that:
Focus specifically on entity design patterns and domain modeling principles.
=============== FILE: book.ts =============== export interface Book { id: string; title: string; author: string; isbn: string; availableCopies: number; totalCopies: number; category: string; publishedYear: number; }
=============== FILE: member.ts =============== export interface Member { id: string; name: string; email: string; membershipType: 'STUDENT' | 'FACULTY' | 'PUBLIC'; joinDate: Date; currentLoans: string[]; // book IDs overdueCount: number; }
=============== FILE: loan-service.ts =============== export class LoanService { async borrowBook(memberId: string, bookId: string): Promise<Loan> { const member = await this.memberRepo.findById(memberId); const book = await this.bookRepo.findById(bookId);
// Business rules scattered in service
if (member.membershipType === 'STUDENT' && member.currentLoans.length >= 3) {
throw new Error('Students can only borrow 3 books');
}
if (member.membershipType === 'FACULTY' && member.currentLoans.length >= 10) {
throw new Error('Faculty can only borrow 10 books');
}
if (member.membershipType === 'PUBLIC' && member.currentLoans.length >= 2) {
throw new Error('Public members can only borrow 2 books');
}
if (member.overdueCount > 2) {
throw new Error('Cannot borrow with overdue books');
}
if (book.availableCopies <= 0) {
throw new Error('Book not available');
}
// Update data directly
book.availableCopies--;
member.currentLoans.push(bookId);
const loan = {
id: generateId(),
memberId,
bookId,
borrowDate: new Date(),
dueDate: this.calculateDueDate(member.membershipType),
status: 'ACTIVE'
};
await this.loanRepo.save(loan);
await this.bookRepo.save(book);
await this.memberRepo.save(member);
return loan;}
private calculateDueDate(memberType: string): Date { const days = memberType === 'STUDENT' ? 14 : memberType === 'FACULTY' ? 30 : 7; const dueDate = new Date(); dueDate.setDate(dueDate.getDate() + days); return dueDate; } }
Install with Tessl CLI
npx tessl i pantheon-ai/software-design-principles@0.1.4evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
references