Agent skill

Architecture

by ktnyt in ktnyt/cclsp

Guides the design of safely disposable code through contracts (traits/interfaces) and dependency inversion.

MITAuto-check passedDevelopment

Install Architecture

skills CLI
$ npx skills add ktnyt/cclsp --skill architecture -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ktnyt/cclsp architecture --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ktnyt/cclsp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/architecture .claude/skills/architecture && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
architecture
GitHub stars
675
Token cost
~1.6k tokens
SKILL.md length
476 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

Guides the design of safely disposable code through contracts (traits/interfaces) and dependency inversion.

  • Works in 5 steps: Define the Contract → Define Error Contracts → Implement Against the Contract → …
  • Designing new modules
  • SKILL.md covers Core Principle, Workflow, Layered Architecture and Disposability Checklist, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Architecture is an agent skill from ktnyt/cclsp. Guides the design of safely disposable code through contracts (traits/interfaces) and dependency inversion. Use when designing new modules, refactoring existing code, or making architectural decisions about component boundaries.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Refactoring. It works with Model Context Protocol. The repository describes itself as: Claude Code LSP: enhance your Claude Code experience with non-IDE dependent LSP integration. The licence is MIT.

When your agent uses it

  • Designing new modules
  • Refactoring existing code
  • Making architectural decisions about component boundaries

Example prompts

  • “Use the architecture skill to guide the design of safely disposable code through contracts (traits/interfaces) and dependency inversion”
  • “/architecture”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Define the Contract
  2. Define Error Contracts
  3. Implement Against the Contract
  4. Depend on Contracts, Not Implementations
  5. Test Against the Contract

What it can do on your machine

Read from SKILL.md and the folder at commit 93414a1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are rust, go and typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Architecture loads about 1.6k tokens when it runs. Until then it costs about 60 tokens; SKILL.md has 476 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~60
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ktnyt/cclsp at commit 93414a1, republished under its MIT licence (© ktnyt). 476 words, ~1,587 tokens.

Download SKILL.mdSave it as .claude/skills/architecture/SKILL.md (or your agent's skills folder).
name
architecture
description
Guides the design of safely disposable code through contracts (traits/interfaces) and dependency inversion. Use when designing new modules, refactoring existing code, or making architectural decisions about component boundaries.

Safely Disposable Code via Contracts

Every implementation should be disposable. The system's correctness is defined by its contracts, not by any particular implementation behind them.

Core Principle

Define what a component does (contract), not how it does it (implementation). Any implementation that satisfies the contract is interchangeable.

A component is "safely disposable" when:

  1. Its behavior is fully described by a contract (trait, interface, protocol)
  2. No consumer depends on implementation details
  3. It can be deleted and rewritten from the contract alone without breaking the system

Workflow

Step 1: Define the Contract

Start with the contract. Write the trait/interface before any implementation.

Rust:

rust
pub trait UserRepository {
    fn find_by_id(&self, id: UserId) -> Result<Option<User>, RepoError>;
    fn save(&self, user: &User) -> Result<(), RepoError>;
}

Go:

go
type UserRepository interface {
    FindByID(ctx context.Context, id UserID) (*User, error)
    Save(ctx context.Context, user *User) error
}

TypeScript:

typescript
interface UserRepository {
  findById(id: UserId): Promise<User | null>;
  save(user: User): Promise<void>;
}

Rules:

  • Keep contracts small (1-5 methods)
  • Name contracts after the role, not the implementation (e.g., UserRepository, not PostgresUserStore)
  • Define contracts where they are consumed, not where they are implemented
  • Use domain types in signatures, not infrastructure types
Step 2: Define Error Contracts

Errors are part of the contract. Define domain-level error types that hide infrastructure details.

rust
#[derive(Debug, thiserror::Error)]
pub enum RepoError {
    #[error("entity not found: {0}")]
    NotFound(String),
    #[error("conflict: {0}")]
    Conflict(String),
    #[error("internal error")]
    Internal(#[source] Box<dyn std::error::Error + Send + Sync>),
}

The Internal variant wraps infrastructure errors without leaking them into the contract.

Step 3: Implement Against the Contract

Each implementation is a disposable artifact. Write it knowing it can be thrown away.

rust
pub struct PgUserRepository {
    pool: PgPool,
}

impl UserRepository for PgUserRepository {
    fn find_by_id(&self, id: UserId) -> Result<Option<User>, RepoError> {
        // Postgres-specific code here.
        // This entire struct is disposable.
    }

    fn save(&self, user: &User) -> Result<(), RepoError> {
        // ...
    }
}
Step 4: Depend on Contracts, Not Implementations

Consumers accept the contract, never the concrete type.

rust
pub struct UserService<R: UserRepository> {
    repo: R,
}

impl<R: UserRepository> UserService<R> {
    pub fn new(repo: R) -> Self {
        Self { repo }
    }

    pub fn get_user(&self, id: UserId) -> Result<Option<User>, RepoError> {
        self.repo.find_by_id(id)
    }
}

In Go, this is implicit — accept the interface:

go
func NewUserService(repo UserRepository) *UserService {
    return &UserService{repo: repo}
}
Step 5: Test Against the Contract

Write tests that verify the contract, not the implementation. These tests can be reused across implementations.

rust
// A test suite that works for ANY UserRepository implementation.
fn test_repository_contract(repo: &impl UserRepository) {
    let user = User::new("test@example.com");
    repo.save(&user).unwrap();

    let found = repo.find_by_id(user.id()).unwrap();
    assert_eq!(found, Some(user));
}

#[test]
fn pg_repo_satisfies_contract() {
    let repo = PgUserRepository::new(test_pool());
    test_repository_contract(&repo);
}

#[test]
fn in_memory_repo_satisfies_contract() {
    let repo = InMemoryUserRepository::new();
    test_repository_contract(&repo);
}

Layered Architecture

Organize code so that dependencies always point inward toward the domain:

src/
├── domain/          # Contracts + domain types (zero external deps)
│   ├── model.rs     #   Domain entities and value objects
│   ├── repo.rs      #   Repository contracts (traits)
│   └── service.rs   #   Domain services using contracts
├── infra/           # Disposable implementations
│   ├── pg_repo.rs   #   Postgres implementation
│   └── http.rs      #   HTTP handlers
└── main.rs          # Wiring (connects contracts to implementations)
  • domain/ defines contracts and types. It imports nothing from infra/.
  • infra/ implements contracts. It imports from domain/.
  • main.rs wires implementations to contracts.
Show full SKILL.md (202 more words)Show less

Disposability Checklist

Before considering a component done, verify:

  • A contract (trait/interface) exists and lives in the domain layer
  • The contract is named after the role, not the technology
  • Errors are domain-level, not infrastructure-level
  • Consumers depend on the contract, not the implementation
  • The implementation can be deleted without changing any consumer code
  • Contract-level tests exist and can run against any implementation
  • No implementation details leak through the contract (e.g., SQL types, HTTP types)

Anti-Patterns

Anti-PatternProblemFix
Fat contract10+ methods, hard to implementSplit into focused contracts
Leaky contractInfrastructure types in signaturesUse domain types only
Concrete dependencyConsumer imports the struct directlyAccept the trait/interface
God moduleOne module does everythingExtract contracts and split
Premature abstractionContract with only one possible implementation foreverWait until there's a reason to abstract

When NOT to Abstract

Not everything needs a contract. Skip abstraction when:

  • The component is a pure function with no side effects
  • There will genuinely never be an alternative implementation
  • The "contract" would be a trivial 1:1 mirror of a standard library type
  • You're early in exploration and the boundary isn't clear yet

Start concrete, extract a contract when the second use case appears or when you need testability.

© ktnyt, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/architecture of ktnyt/cclsp.

Open the folder on GitHubat commit 93414a1

Compare with similar skills

Architecture next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Architecture compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Architecture this skillktnyt/cclsp675—~1.6kAutomated safety check: PassMIT
ast-grep Structural Searchcode-yeongyu/oh-my-openagent70k—~3.3kAutomated safety check: PassMIT
Graph-Guided Safe Refactoringtirth8205/code-review-graph32k1 repos~332Automated safety check: PassMIT
Code Review Graph Navigatorhandsontable/handsontable22k—~939Automated safety check: PassCustom licence
Typed Dependencies with fp-go EffectIBM/fp-go2k—~4.3kAutomated safety check: PassApache-2.0
Filescope MCPadmica/FileScopeMCP302—~1.7kAutomated safety check: PassProprietary

Similar skills

  • ast-grep Structural Search

    code-yeongyu/oh-my-openagent

    Searches and rewrites code by syntax-tree shape across 25 languages with ast-grep, for codemods, structural queries and YAML lint rules, using a Python wrapper script.

    70k GitHub stars~3.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Graph-Guided Safe Refactoring

    tirth8205/code-review-graph

    Plans a refactor from a code dependency graph, previews renames before applying them and checks that the final impact matches the plan.

    32k GitHub starsUsed in 1 repo~332 tokens
    DevelopmentAuto-check passed
  • Code Review Graph Navigator

    handsontable/handsontable

    Queries a pre-built, Tree-sitter-based code graph of the whole monorepo instead of grepping call chains, for exploring, debugging, refactoring or reviewing code.

    22k GitHub stars~939 tokensUpdated today
    DevelopmentAuto-check passed
  • Teaches an agent to write fp-go v2 services with the Effect type, carrying dependencies in its type parameter instead of in context.Context or parameters.

    2k GitHub stars~4.3k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Filescope MCP

    admica/FileScopeMCP

    Codebase intelligence via FileScopeMCP — symbol lookup, dependency mapping, importance ranking, and semantic search.

    302 GitHub stars~1.7k tokensUpdated 5 mo ago
    DevelopmentAuto-check passed
  • Gives an agent working in a Go codebase a structural view through a local MCP server: call graphs, blast-radius and impact analysis, and bounded first-call exploration.

    228 GitHub stars~4.8k tokensUpdated 2 days ago
    DevelopmentAuto-check: notes

More from ktnyt/cclsp

  • Hands On Test

    ktnyt/cclsp

    Performs manual hands-on testing of a web application using playwright-cli.

    675 GitHub stars~1.7k tokensUpdated 7 mo ago
    Auto-check passed
  • Security Review

    ktnyt/cclsp

    Request a security expert assessment for code changes that touch child process spawning, file system access, configuration loading, or environment variable handling.

    675 GitHub stars~565 tokensUpdated 7 mo ago
    Auto-check passed

Categories

Questions about Architecture

What does Architecture do?

Guides the design of safely disposable code through contracts (traits/interfaces) and dependency inversion. Architecture is an agent skill from ktnyt/cclsp. Guides the design of safely disposable code through contracts (traits/interfaces) and dependency inversion.

When should I use Architecture?

Architecture fits situations like: designing new modules; refactoring existing code; making architectural decisions about component boundaries.

How do I install Architecture in Claude Code?

Run `npx skills add ktnyt/cclsp --skill architecture -a claude-code`. Or copy the skill folder (.claude/skills/architecture in ktnyt/cclsp) into .claude/skills/architecture in your project. Claude Code loads it when a task matches its description.

How do I install Architecture in Codex?

Run `npx skills add ktnyt/cclsp --skill architecture -a codex`. Or copy the skill folder (.claude/skills/architecture in ktnyt/cclsp) into .agents/skills/architecture in your project. Codex loads it when a task matches its description.

Can I use Architecture in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ktnyt/cclsp --skill architecture -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/architecture, .gemini/skills/architecture, .github/skills/architecture and .opencode/skills/architecture in your project.

What does Architecture need to run?

SKILL.md names no scripts, command-line tools or credentials: Architecture is instructions for the agent only.

Does Architecture access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Architecture safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Architecture use?

Architecture is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Architecture use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Architecture?

Skills that share tags, products or a category with Architecture: ast-grep Structural Search (code-yeongyu/oh-my-openagent, 70k stars), Graph-Guided Safe Refactoring (tirth8205/code-review-graph, 32k stars), Code Review Graph Navigator (handsontable/handsontable, 22k stars) and Typed Dependencies with fp-go Effect (IBM/fp-go, 2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Architecture?

ktnyt (a GitHub user) maintains it in ktnyt/cclsp, which has 675 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on February 22, 2026.

Source: ktnyt/cclsp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.