skills/fundamentals/object-relationships/SKILL.md
Identify and implement correct relationships between classes: Dependency, Association, Aggregation, and Composition. Trigger: When designing class structures, reviewing coupling, or deciding between inheritance and composition.
npx skillsauth add johnnystefan/test-saas-business fundamentals/object-relationshipsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill enables the agent to distinguish between different types of connections between classes. Understanding these relationships leads to better architectural decisions, such as choosing between inheritance and composition or identifying tight coupling.
a.b().c().d()), suggest using Hide Delegate to simplify the relationship.// DEPENDENCY — Order uses DataFormatter only as a method argument
class Order {
print(formatter: DataFormatter) {
formatter.format(this);
}
}
// ASSOCIATION — Student knows about a specific Teacher via a field
class Student {
private teacher: Teacher;
constructor(teacher: Teacher) {
this.teacher = teacher;
}
}
// AGGREGATION — Professors are part of a Dept, but exist outside of it
class Department {
private professors: Professor[] = [];
addProfessor(p: Professor) {
this.professors.push(p);
}
}
// COMPOSITION — Rooms are created and managed by House; they die with it
class House {
private rooms: Room[] = [];
constructor() {
this.rooms.push(new Room('Kitchen'));
this.rooms.push(new Room('Bedroom'));
}
}
tools
Zustand 5 state management patterns. Trigger: When implementing client-side state with Zustand (stores, selectors, persist middleware, slices).
databases
Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.
development
Vitest unit testing patterns with React Testing Library. Trigger: When writing unit tests for React components, hooks, or utilities.
tools
Vite 8 (Rolldown-powered) build tool configuration, plugin API, SSR, and migration guide. Trigger: When working with vite.config.ts, Vite plugins, building libraries, or SSR apps with Vite.