clean-architecture-llm
БесплатноБез исполняемых скриптовНе проверенDesign LLM-powered modules with Clean Architecture boundaries, SOLID, DRY, KISS, and provider-agnostic ports/adapters. Use when adding prompt workflows…
от VilnaCRM-Org★ 16 звёзд на GitHubОб этом скилле
Clean Architecture for LLM Modules
Use this skill before implementing or reviewing any LLM-backed behavior. It keeps provider SDKs, prompt construction, orchestration, and business logic in the right places so LLM integrations remain testable and replaceable.
Context
Use this skill for:
- New LLM provider integrations or model clients
- Prompt workflows, prompt factories, or prompt templates
- Agent/tool orchestration and AI review automation
- LLM-backed command/query handlers, subscribers, processors, or CLI commands
- Refactors that move LLM logic out of controllers, handlers, or domain classes
- Code reviews for LLM feature maintainability and architecture boundaries
Pair this skill with:
implementing-ddd-architecturefor domain/application/infrastructure patternscode-organizationfor placement, names, and class-type directoriestesting-workflowfor deterministic unit and integration testsdocumentation-syncwhen behavior or onboarding docs changeci-workflowbefore committing or opening a PR
Task
Design LLM modules so:
- Domain code remains provider-agnostic and prompt-free.
- Application code owns use cases, ports, DTOs, and orchestration.
- Infrastructure code owns provider SDKs, HTTP clients, retries, timeouts, and model-specific configuration.
- Prompts are composed through named factories/templates, not inline strings hidden inside handlers.
- Tests use deterministic provider doubles, fixtures, and contract assertions instead of live model calls.
Layer Rules
| Layer | Owns | Must Not Own |
|---|---|---|
| Domain | Business rules, value objects, entities, domain events | Provider names, prompts, tokens, HTTP clients, SDK classes, model IDs |
| Application | Use cases, command/query handlers, ports, request/response DTOs, provider-neutral prompt factories | Direct SDK calls, environment reads, logging secrets, live network calls |
| Infrastructure | Provider adapters, SDK/HTTP clients, auth, retries, timeouts, rate-limit handling, telemetry exporters | Business rules, domain decisions, prompt policy decisions |
| Interface/API | Controllers, processors, CLI commands, serializers | Prompt assembly, provider choice, retry policy, domain decisions |
| Tooling/Docs | Agent skills, examples, review checklists, BMAD specs | Runtime secrets or production-only behavior |
Execution Steps
1. Classify the Capability
Write down the business use case in provider-neutral language:
- Bad: "Call OpenAI to score a user."
- Good: "Evaluate whether a registration risk profile requires additional verification."
If the behavior is not business logic and only supports developer workflow, place it under tooling/docs rather than runtime application code.
2. Define the Port First
Create an Application-layer interface that describes the capability, not the vendor API. The interface should accept typed request objects and return typed response objects.
In this repository, "port" means the provider-neutral Application-layer
interface role. Put the interface in an existing class-type directory that
matches its responsibility, such as Provider/, Validator/, or Resolver/,
or get explicit approval before introducing a new Port/ directory.
Required:
- Use specific names such as
RegistrationRiskEvaluatorInterface, notLlmService. - Keep provider names out of the interface.
- Use immutable request/response DTOs or value objects.
- Document failure modes with domain/application exceptions.
Forbidden:
- Raw
arraypayloads without typed structure. - Provider SDK request classes in Application or Domain code.
- Methods named after vendor endpoints such as
createChatCompletion().
3. Keep Prompt Construction Explicit
Prompts are behavior. Treat them as named collaborators.
Use one of these patterns:
Factory: builds prompt/request objects from typed inputs.Strategy: chooses a prompt or model policy for a use case.Template: stores stable prompt text with named variables.Pipeline: performs validation, redaction, prompt creation, provider call, response parsing, and policy checks in separate steps when the workflow is complex.
Rules:
- Do not concatenate large prompt strings inside handlers or controllers.
- Keep prompt variables explicit and typed.
- Centralize shared prompt fragments to avoid drift.
- Record prompt versioning when output affects user-visib
Установить clean-architecture-llm в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл clean-architecture-llm?
Design LLM-powered modules with Clean Architecture boundaries, SOLID, DRY, KISS, and provider-agnostic ports/adapters. Use when adding prompt workflows, model/provider clients, tool orchestration, AI review automation, agent skills, or other LLM-backed capabilities.
Как установить скилл clean-architecture-llm?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл clean-architecture-llm запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic