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
Replace primitive types with value objects that encapsulate validation and behavior. Value objects are immutable, compared by value, and self-validating.
Incorrect (primitive obsession):
class Customer {
constructor(
public id: string,
public email: string,
public phone: string,
public postalCode: string
) {}
changeEmail(newEmail: string): void {
// Validation scattered or missing
if (!newEmail.includes('@')) {
throw new Error('Invalid email')
}
this.email = newEmail
}
}
// Callers can pass any string
const customer = new Customer('123', 'not-an-email', '123', 'invalid')Correct (value objects for domain concepts):
class Email {
private constructor(private readonly value: string) {}
static create(value: string): Email {
if (!Email.isValid(value)) {
throw new InvalidEmailError(value)
}
return new Email(value.toLowerCase())
}
private static isValid(value: string): boolean {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)
}
equals(other: Email): boolean {
return this.value === other.value
}
toString(): string {
return this.value
}
}
class PhoneNumber {
private constructor(
private readonly countryCode: string,
private readonly number: string
) {}
static create(countryCode: string, number: string): PhoneNumber {
// Validation and normalization
return new PhoneNumber(countryCode, number.replace(/\D/g, ''))
}
}
class Customer {
constructor(
public readonly id: CustomerId,
private email: Email,
private phone: PhoneNumber
) {}
changeEmail(newEmail: Email): void {
this.email = newEmail // Already validated
}
}
// Compile-time type safety + runtime validation
const customer = new Customer(
CustomerId.create('123'),
Email.create('user@example.com'),
PhoneNumber.create('+1', '555-1234')
)Benefits:
Reference: Value Object Pattern
Install with Tessl CLI
npx tessl i pantheon-ai/software-design-principlesevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
references