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
HTTP-specific code (requests, responses, headers, cookies, sessions) belongs in the interface adapters layer. Use cases should be callable from any delivery mechanism.
Incorrect (use case coupled to HTTP):
// application/usecases/LoginUseCase.ts
import { Request, Response } from 'express'
import { sign } from 'jsonwebtoken'
export class LoginUseCase {
async execute(req: Request, res: Response) {
const { email, password } = req.body
const user = await this.users.findByEmail(email)
if (!user || !user.verifyPassword(password)) {
return res.status(401).json({ error: 'Invalid credentials' })
}
// Set HTTP-only cookie
const token = sign({ userId: user.id }, process.env.JWT_SECRET)
res.cookie('auth_token', token, {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
sameSite: 'strict'
})
return res.json({ user: { id: user.id, email: user.email } })
}
}
// Cannot call from CLI, message queue, or test without ExpressCorrect (use case independent of delivery):
// application/usecases/LoginUseCase.ts
export interface LoginCommand {
email: string
password: string
}
export interface LoginResult {
userId: string
email: string
authToken: string
}
export class LoginUseCase {
constructor(
private users: UserRepository,
private tokenService: TokenService
) {}
async execute(command: LoginCommand): Promise<LoginResult> {
const user = await this.users.findByEmail(command.email)
if (!user) {
throw new InvalidCredentialsError()
}
if (!user.verifyPassword(command.password)) {
throw new InvalidCredentialsError()
}
const token = this.tokenService.generate({ userId: user.id.value })
return {
userId: user.id.value,
email: user.email.value,
authToken: token
}
}
}
// interface/http/AuthController.ts
import { Request, Response } from 'express'
export class AuthController {
constructor(private loginUseCase: LoginUseCase) {}
async login(req: Request, res: Response) {
try {
const result = await this.loginUseCase.execute({
email: req.body.email,
password: req.body.password
})
// HTTP concerns in controller
res.cookie('auth_token', result.authToken, {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
sameSite: 'strict'
})
return res.json({
user: { id: result.userId, email: result.email }
})
} catch (error) {
if (error instanceof InvalidCredentialsError) {
return res.status(401).json({ error: 'Invalid credentials' })
}
throw error
}
}
}
// interface/cli/AuthCli.ts - Same use case, different delivery
export class AuthCli {
async login(email: string, password: string) {
const result = await this.loginUseCase.execute({ email, password })
console.log(`Logged in as ${result.email}`)
fs.writeFileSync('.auth_token', result.authToken)
}
}Benefits:
Reference: Clean Architecture - The Web is a Detail
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