architecture-fitness-functions

Converts documented architecture rules into automated fitness function tests across multiple stacks.

6|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/emilianoeloi/cowboy --skill architecture-fitness-functions-emilianoeloi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: architecture-fitness-functions
Source: https://github.com/emilianoeloi/cowboy/tree/main/.github/skills/architecture-fitness-functions
Command: npx skills add https://github.com/emilianoeloi/cowboy --skill architecture-fitness-functions-emilianoeloi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Architecture rules written in prose (agent root files, ADRs, code review comments) get violated repeatedly because nothing enforces them automatically. This Skill turns those prose rules into deterministic, automated tests — fitness functions — that detect violations at test time instead of relying on reviewers remembering the rules. ## Core Features & Use Cases - Rule-to-Test Conversion: Promotes any documented architecture rule into an automated test following the pattern: Rule → Detector → Assert → actionable failure message with file, line, and fix suggestion. - Five Rule Families: Covers layer dependency direction, single gateway for dangerous operations, forbidden patterns, hardcoded secrets, and mandatory output contracts. - Stack-Agnostic Examples: Provides working implementations for Python/pytest (ast + regex), Swift (Python scanner scripts or SwiftLint custom rules), Kotlin (Konsist or Detekt), and Node/TypeScript (dependency-cruiser, ESLint). - Use Case: Your team keeps finding domain code importing the API layer in reviews. Use this Skill to write a pytest fitness function that parses imports with the ast module and fails CI with exact file:line violations, so the rule is enforced on every commit. ## Quick Start Ask the agent to convert the architecture rule "domain must not import outer layers" into an automated fitness function test for my Python project.

Frequently Asked Questions about architecture-fitness-functions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce architecture rules automatically in tests?▼

Write a fitness function: a test that scans source files with a detector (AST parse, regex, or dependency graph), collects violations, and asserts the list is empty. The failure message should include file, line, and the expected fix.

When should an architecture rule become a fitness function?▼

Promote a rule when it has been violated twice despite being documented, or immediately if the violation is detectable via grep, AST parsing, or dependency graph checks. Do not wait for repeated manual review findings.

What tools check architecture rules in Kotlin and TypeScript?▼

Kotlin uses Konsist, a JUnit-integrated architecture testing library, or custom Detekt rules. TypeScript uses dependency-cruiser for layer direction rules and ESLint custom rules or regex scripts for forbidden patterns.

Can I test Swift architecture rules without SwiftLint?▼

Yes. A standalone Python script can scan .swift files line by line with regex, checking for forbidden APIs like URLSession.shared outside an allowlisted directory. SwiftLint custom rules are an alternative if the project already uses it.

Why should fitness functions run as a separate CI tier?▼

Structural tests run in seconds without heavy fixtures, so separating them from behavior tests gives fast failure feedback. Slow tests get skipped or disabled, which defeats the purpose of automated enforcement.