coding-patterns
Architecture and design patterns for lettactl. Reference when building new features, displays, or commands.
от nouamanecodes★ 44 звезды на GitHub
Установить coding-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Display Architecture
All UX/display code lives in src/lib/ux/display/. Commands never format output directly — they transform data into typed interfaces and call display functions.
Entry List Pattern
For any list of entries shown chronologically (messages, archival memory, etc.), use the shared entry-list.ts module:
import { displayEntryList, EntryListItem } from './entry-list';
const items: EntryListItem[] = data.map(d => ({
metaLine: chalk.dim(d.timestamp) + purple(` [${d.label}]`),
content: d.text,
}));
return displayEntryList('Title (N)', items, optionalNote);
metaLine: pre-formatted metadata (timestamp, role, tags, score, etc.)content: text body — truncated for summary views, full for--fullviews- The module handles fancy/plain switching internally via
shouldUseFancyUx()
Used by: messages.ts, archival.ts
Box Pattern
For detail views and structured data (describe command output), use box.ts:
import { createBox, createBoxWithRows, BoxRow } from '../box';
// Key-value box
const rows: BoxRow[] = [
{ key: 'ID', value: data.id },
{ key: 'Name', value: data.name },
];
lines.push(...createBox('Title', rows, width));
// Free-form rows box
const items = data.map(d => chalk.white(d.name));
lines.push(...createBoxWithRows('Section (N)', items, width));
Used by: details.ts (describe command)
Table Pattern
For resource listings (get agents, get blocks, etc.), use the table helpers in resources.ts:
- Header row with column names
- Status dot + padded columns
- Fancy mode uses colored box frame, plain mode uses dashes
Used by: resources.ts (get command list views)
When to Use Which
| View Type | Pattern | Example |
|---|---|---|
| Chronological entries | Entry List | messages, archival memory |
| Resource listing | Table | get agents, get blocks, get tools |
| Single resource detail | Box | describe agent, describe block |
| Full content dump | Entry List (--full) |
get archival --full |
Display Module Structure
Every display file follows the same structure:
- Export a typed data interface (e.g.,
AgentData,ArchivalEntryData) - Export a display function that checks
shouldUseFancyUx() - Fancy variant uses chalk colors, box drawing, purple branding
- Plain variant uses simple text — no colors, no box chars
New display modules go in src/lib/ux/display/ with a re-export in index.ts.
Command → Display Flow
Command (get.ts, describe.ts)
→ Fetches raw data from LettaClientWrapper
→ Transforms to typed display interface
→ Calls OutputFormatter adapter (output-formatter.ts)
→ Calls display function (display/*.ts)
→ Returns formatted string
→ output() to stdout
Commands never import chalk or format strings. OutputFormatter adapters transform raw SDK responses to typed display data.
LettaClientWrapper
All SDK calls go through src/lib/letta-client.ts. Never call the SDK directly from commands. Wrapper methods handle:
- Normalizing response shapes
- Consistent error surfaces
- Single place to update when SDK changes
Command Directory Structure
Each command lives in its own directory under src/commands/<command>/:
src/commands/
├── get/
│ ├── index.ts # Re-exports, router logic
│ ├── types.ts # Interfaces, constants (SUPPORTED_RESOURCES, etc.)
│ ├── agents.ts # Handler for `get agents`
│ ├── blocks.ts # Handler for `get blocks`
│ └── ... # One file per resource type
├── delete/
│ ├── index.ts # Router + re-exports (deleteAgentWithCleanup for SDK)
│ ├── types.ts # DELETE_SUPPORTED_RESOURCES, options interfaces
│ ├── agent.ts # Single agent deletion
│ ├── mcp-server.ts # Single MCP server deletion
│ ├── all-agents.ts # Bulk delete handlers
│ └── ...
└── messages/
├── index.ts # Re-exports all commands
├── types.ts # ListOptions, SendOptions, etc.
├── list.ts # listMessagesCommand
├── send.ts # sendMessageCommand
├── utils.ts # Shared helpers (getMessageContent, formatElapsedTime)
└── ...
Directory Contents
| File | Purpose |
|---|---|
index.ts |
Re-exports public API, router logic if needed |
types.ts |
Interfaces, option types, constants like SUPPORTED_RESOURCES |
<handler>.ts |
One file per subcommand or resource type |
utils.ts |
Shared helpers used by multiple handlers |
Router Pattern (index.ts)
For commands with multiple subcommands (get, describe, delete), the index.ts acts as a router:
// src/commands/get/index.ts
import { getAgents } from './agents';
import { getBlocks } from './blocks';
import { SUPPORTED_RESOURCES } from './types';
export default async function getCommand(resource: string, name: string, options: GetOptions, command: any) {
if (!SUPPORTED_RESOURCES.includes(resource)) {
throw new Error(`Unsupported resource: ${resource}`);
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл coding-patterns?
Architecture and design patterns for lettactl. Reference when building new features, displays, or commands.
Как установить скилл coding-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл coding-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…