architecture-principles
Core architecture principles (SSOT, DRY, Anti-Spaghetti) for maintainable code design. Use when planning features, implementing code, or reviewing architecture to prevent duplication and technical debt.
Best use case
architecture-principles is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Core architecture principles (SSOT, DRY, Anti-Spaghetti) for maintainable code design. Use when planning features, implementing code, or reviewing architecture to prevent duplication and technical debt.
Teams using architecture-principles should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/architecture-principles/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How architecture-principles Compares
| Feature / Agent | architecture-principles | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Core architecture principles (SSOT, DRY, Anti-Spaghetti) for maintainable code design. Use when planning features, implementing code, or reviewing architecture to prevent duplication and technical debt.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# Architecture Principles
## Instructions
### Apply 3 principles
**SSOT (Single Source of Truth):** One place for each constant or logic
**DRY (Don't Repeat Yourself):** Extract when repeated 2+ times
**Anti-Spaghetti:** Clear layers, minimal dependencies
### When to apply
**Planning:** Design with SSOT in mind
**Implementing:** Extract shared logic
**Reviewing:** Check for duplication
## Example
<!-- CUSTOMIZE: Replace with {{MAIN_TECH_STACK}}-appropriate examples -->
### Python Example
```python
# ❌ Duplicated
def validate_api(value):
if value < 10.0: raise ValueError("Too low")
def validate_webhook(value):
if value < 10.0: raise ValueError("Too low")
# ✅ SSOT + DRY
class Validator:
MIN_VALUE = 10.0 # SSOT: Single source
def validate_value(self, value): # DRY: Reusable
if value < self.MIN_VALUE:
raise ValueError(f"Below {self.MIN_VALUE}")
# Anti-Spaghetti: Use everywhere
validator.validate_value(value)
```
### JavaScript/Node.js Example
```javascript
// ❌ Duplicated
function validateApi(value) {
if (value < 10.0) throw new Error("Too low");
}
function validateWebhook(value) {
if (value < 10.0) throw new Error("Too low");
}
// ✅ SSOT + DRY
class Validator {
static MIN_VALUE = 10.0; // SSOT: Single source
validateValue(value) { // DRY: Reusable
if (value < Validator.MIN_VALUE) {
throw new Error(`Below ${Validator.MIN_VALUE}`);
}
}
}
// Anti-Spaghetti: Use everywhere
const validator = new Validator();
validator.validateValue(value);
```
### Go Example
```go
// ❌ Duplicated
func validateApi(value float64) error {
if value < 10.0 { return errors.New("Too low") }
return nil
}
func validateWebhook(value float64) error {
if value < 10.0 { return errors.New("Too low") }
return nil
}
// ✅ SSOT + DRY
type Validator struct {
MinValue float64 // SSOT: Single source
}
func NewValidator() *Validator {
return &Validator{MinValue: 10.0}
}
func (v *Validator) ValidateValue(value float64) error { // DRY: Reusable
if value < v.MinValue {
return fmt.Errorf("Below %.2f", v.MinValue)
}
return nil
}
// Anti-Spaghetti: Use everywhere
validator := NewValidator()
validator.ValidateValue(value)
```
## Checklist
```markdown
[ ] Constants in one place (SSOT)?
[ ] Repeated logic extracted (DRY)?
[ ] Clear layer separation (Anti-Spaghetti)?
```
---
**For detailed patterns, see [reference.md](reference.md)**
**For more examples, see [examples.md](examples.md)**Related Skills
dev-swarm-stage-architecture
Design the complete system architecture including components, data flow, infrastructure, database schema, and API design. Use when starting stage 07 (architecture) or when user asks about system design, tech stack, or database schema.
design-layered-backend-architecture
Design or review a layered backend architecture (routes, controllers, services, repositories) for HTTP APIs and microservices.
databases-architecture-skill
Master database design (SQL, NoSQL), system architecture, API design (REST, GraphQL), and building scalable systems. Learn PostgreSQL, MongoDB, system design patterns, and enterprise architectures.
coding-principles
Language-agnostic coding principles for maintainability, readability, and quality. Use when implementing features, refactoring code, or reviewing code quality.
code-architecture-analyzer
智能代码架构解读和分析工具。当用户请求分析项目架构、生成架构文档、识别设计模式、分析依赖关系、评估代码质量、或理解复杂项目结构时使用此skill。适用于接手新项目、代码审查、重构规划、技术选型评估等场景。
clean-architecture
Structure software around the Dependency Rule: source code dependencies point inward from frameworks to use cases to entities. Use when the user mentions "architecture layers", "dependency rule", "ports and adapters", "hexagonal architecture", or "use case boundary". Covers component principles, boundaries, and SOLID. For code quality, see clean-code. For domain modeling, see domain-driven-design.
c4-architecture
Generate architecture documentation using C4 model Mermaid diagrams. Use when asked to create architecture diagrams, document system architecture, visualize software structure, create C4 diagrams, or generate context/container/component/deployment diagrams. Triggers include "architecture diagram", "C4 diagram", "system context", "container diagram", "component diagram", "deployment diagram", "document architecture", "visualize architecture".
c4-architecture-c4-architecture
Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.
backend-architecture
Design and implement scalable backend infrastructure, microservices, and system architecture patterns.
astro-architecture
Technical architecture for Astro lead generation websites. Use when setting up new projects, configuring build tools, or establishing project foundations. For images use astro-images skill. For SEO use astro-seo skill.
assessing-architecture-quality
Use when assessing codebase architecture and you feel pressure to soften critique, lead with strengths, or frame problems diplomatically - provides evidence-based critical assessment resisting relationship and economic pressures
architecture
Comprehensive system architecture design and implementation workflow that orchestrates expert analysis, technical decision-making, and architectural pattern selection using the integrated toolset. Handles everything from initial system analysis to implementation-ready technical specifications.