executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
solid-srp-patternImplements the Single Responsibility Principle (SRP) from SOLID, ensuring a class has one reason to change.
Independent GitHub snapshot · Automated classification · Original documentation governs
name: solid-srp-pattern description: Implements the Single Responsibility Principle (SRP) from SOLID, ensuring a class has one reason to change. license: MIT compatibility: opencode metadata: version: "1.0.0" domain: architecture triggers: single responsibility principle, solid principles, gof patterns archetypes:
archetypes: implementation, educational anti_triggers: multiple responsibilities response_profile: verbosity: medium directive_strength: high abstraction_level: tactical
Implements the Single Responsibility Principle from SOLID, ensuring a class has one reason to change.
This section should succinctly explain the scenarios where the Single Responsibility Principle is applicable:
Verbosity: Medium
Directive Strength: High
Abstraction Level: Tactical
When you want to ensure that a class or module has a single responsibility.
To improve the maintainability and understandability of the code.
When making changes to a class, ensuring impacts are minimized.
package main
import (
"fmt"
)
// User represents a user model
type User struct {
Name string
Email string
}
// UserRepository handles user-related database operations
type UserRepository struct {}
func (UserRepository) Save(u User) {
// Logic to save user to database
fmt.Println("Saving user:", u)
}
// EmailService manages email notifications
type EmailService struct {}
func (EmailService) SendEmail(email string, message string) {
// Logic to send email
fmt.Println("Sending email to:", email, "Message:", message)
}
package main
func main() {
userRepo := UserRepository{}
emailService := EmailService{}
user := User{Name: "John Doe", Email: "john@example.com"}
userRepo.Save(user)
emailService.SendEmail(user.Email, "Welcome to our service!")
}