Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Claudeloop Architecture

ASecurity

Explains claudeloop's onion architecture — the four layers (domain, application, infrastructure, cli), the import-linter contract enforcing them, and exactly where new code belongs. Use this whenever adding a new file, class, or function to src/claudeloop/, whenever unsure which layer something belongs in, whenever import-linter or lint-imports fails, or when the user mentions "onion architecture", "layers", "ports and adapters", "bootstrap.py", "composition root", or asks "where should this ...

2 stars
0 votes
0 copies
1 views
Added 9/19/2026
ai-agentsgobash

Works with

cursorterminalcli

Security Analysis

A100/100

Scanned 9/19/2026

$npx -y skills add the-vibey-project/vibey --skill claudeloop-architecture --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Claudeloop Architecture?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Claudeloop Architecture
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/the-vibey-project-claudeloop-architecture/badge)](https://www.skillsdirectory.com/skills/the-vibey-project-claudeloop-architecture)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: claudeloop-architecture
description: Explains claudeloop's onion architecture — the four layers (domain, application, infrastructure, cli), the import-linter contract enforcing them, and exactly where new code belongs. Use this whenever adding a new file, class, or function to src/claudeloop/, whenever unsure which layer something belongs in, whenever import-linter or lint-imports fails, or when the user mentions "onion architecture", "layers", "ports and adapters", "bootstrap.py", "composition root", or asks "where should this go". Make sure to consult this before writing any new module under src/claudeloop/ — placing code in the wrong layer is the most common mistake in this codebase and import-linter will reject it in CI regardless.
---

# claudeloop architecture


> **Codex skill mirror** of `.claude/skills/claudeloop-architecture/SKILL.md`. When this guidance changes, update Claude skill, Cursor rule, and `.agents/skills/` in the same PR.

`claudeloop` is a strict onion / ports-and-adapters design. Dependencies
point inward only. This is enforced in CI and pre-commit by `import-linter`,
not by convention — a violation fails with a named contract error, not a
review comment.

## The four layers, innermost first

```
src/claudeloop/
├── domain/           # PURE. stdlib only. No I/O, no async, no third-party imports.
├── application/       # Protocol-based ports + use cases. Imports domain + stdlib only.
├── infrastructure/    # Adapters. The ONLY layer allowed to import anthropic /
│                       #   claude_agent_sdk / structlog / httpx / any third-party SDK.
├── cli/                # Typer commands. Calls application use cases via bootstrap.
└── bootstrap.py         # Composition root — the ONE module allowed to see every layer.
```

## The decision test — where does new code go?

Ask in this order:

1. **Does it touch the filesystem, network, clock, or an SDK?**
   → `infrastructure/`, behind a `Protocol` port defined in
   `application/ports.py`. Never call `anthropic.*` or `claude_agent_sdk.*`
   from anywhere else.

2. **Is it a decision — a branch determining what happens next — with zero
   I/O of its own?**
   → `domain/`. Test: can you write its test as
   `assert some_function(SomeDataclass(...)) == ExpectedResult(...)` with no
   mocking, no fixtures beyond dataclass literals? If yes, it's domain.
   Existing examples: `domain/classify.py` (turn signals → capacity state),
   `domain/waiting.py` (capacity state → next probe instant),
   `domain/completion.py` (structured output → completion verdict),
   `domain/loop.py` (the run-loop state machine itself).

3. **Is it orchestration — call a port, feed the result to a domain
   function, call another port?**
   → `application/`, as a use case in `application/usecases/` or inside
   `application/runner.py`.

4. **Is it argument parsing or terminal output formatting for a human?**
   → `cli/`.

**When in doubt, push logic inward.** A `cli/` command containing an
`if/elif` deciding what a rate-limit response *means* is a bug: that
decision belongs in `domain/classify.py`, testable with zero CLI process
spun up.

## The enforced import rules

From `pyproject.toml`:

```toml
[[tool.importlinter.contracts]]
name = "Onion layering"
type = "layers"
layers = ["claudeloop.cli", "claudeloop.bootstrap", "claudeloop.application", "claudeloop.domain"]

[[tool.importlinter.contracts]]
name = "Infrastructure only reachable from bootstrap"
type = "forbidden"
source_modules = ["claudeloop.domain", "claudeloop.application"]
forbidden_modules = ["claudeloop.infrastructure"]
```

Concretely:

- `domain/*.py` may `import` from stdlib and other `domain/*` modules ONLY.
  No `typing.Protocol`-based ports either — those live one layer out.
- `application/*.py` may import `domain` and stdlib. Ports are
  `typing.Protocol`, never an ABC a concrete adapter must inherit from —
  this is what keeps `application/` from ever needing to import
  `infrastructure/` just to name a type.
- `infrastructure/*.py` may import `domain`, `application`, and any
  third-party package. This is the ONLY place `anthropic` or
  `claude_agent_sdk` appears in an `import` statement anywhere in
  `src/claudeloop/`.
- `cli/*.py` calls into `application/` use cases obtained from
  `bootstrap.build_runner(...)` (or equivalent) — never constructs an
  `infrastructure/` adapter directly.
- `bootstrap.py` is the single seam permitted to import from every layer —
  it's where a concrete adapter (e.g.
  `infrastructure.agent.gateway.ClaudeAgentGateway`) gets wired into the
  `Protocol` port `application/ports.py` declares (e.g. `AgentGateway`).

## Verifying your change respects the contract

```bash
lint-imports
```

Run this before committing any new module. It's also a `pre-commit` hook and
runs in CI (`ci.yml`). A violation names the exact contract broken —
"Onion layering" or "Infrastructure only reachable from bootstrap" — and the
offending import chain.

## Full reference

See `docs/architecture/overview.md` for the complete layer table and
`docs/architecture/decisions/0001-onion-architecture-with-import-linter.md`
for why this was chosen over convention-only layering. See
`docs/architecture/ports-and-adapters.md` for the planned port list
(M2+) and why ports are `Protocol` rather than ABC.

Attribution

the-vibey-projectthe-vibey-project
View sourceSee grades on GitHubMore from the-vibey-project →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →