structure

Design data structures before implementation. Maps existing code or creates new types.

16 stars

Best use case

structure is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Design data structures before implementation. Maps existing code or creates new types.

Teams using structure should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/structure/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/structure/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/structure/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How structure Compares

Feature / AgentstructureStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Design data structures before implementation. Maps existing code or creates new types.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# /structure [path]

Design data structures and architecture. Context-aware: maps existing code or creates new types from plan.

> **No arguments?** Describe this skill and stop. Do not execute.

## First: Activate Workflow

```bash
mkdir -p .claude && echo '{"skill":"structure","started":"'$(date -Iseconds)'"}' > .claude/active-workflow.json
```

## Mode Detection

```
if path points to existing code:
    MODE = "map"      → Analyze and redesign
else if .claude/plans/ has active plan:
    MODE = "create"   → Create types from plan
else:
    ERROR: Need either existing code path or plan
```

---

## Step 0: Load Expert Guidance

Before starting either mode, read these canon skills and apply their principles throughout:

**Always load (base brain — all 10):**
1. `canon/clarity/SUMMARY.md`
2. `canon/pragmatism/SUMMARY.md`
3. `canon/simplicity/SUMMARY.md`
4. `canon/composition/SUMMARY.md`
5. `canon/distributed/SUMMARY.md`
6. `canon/data-first/SUMMARY.md`
7. `canon/correctness/SUMMARY.md`
8. `canon/algorithms/SUMMARY.md`
9. `canon/abstraction/SUMMARY.md`
10. `canon/optimization/SUMMARY.md`

**Auto-detect domain canon (check files, load matches):**

| Check | If found, also read |
|-------|---------------------|
| `*.ts` or `*.js` files in target | `canon/javascript/typescript/SUMMARY.md`, `canon/javascript/js-safety/SUMMARY.md`, `canon/javascript/js-perf/SUMMARY.md`, `canon/javascript/js-internals/SUMMARY.md`, `canon/javascript/functional/SUMMARY.md` |
| `angular.json` in project root | `canon/angular/angular-arch/SUMMARY.md`, `canon/angular/angular-core/SUMMARY.md`, `canon/angular/angular-perf/SUMMARY.md`, `canon/angular/rxjs/SUMMARY.md` |
| `package.json` contains `"react"` | `canon/javascript/react-state/SUMMARY.md`, `canon/javascript/react-test/SUMMARY.md`, `canon/javascript/reactivity/SUMMARY.md` |
| `pom.xml` or `build.gradle` in project | `canon/java/SUMMARY.md` |
| `*.py` files in target | `canon/python/python-advanced/SUMMARY.md`, `canon/python/python-idioms/SUMMARY.md`, `canon/python/python-patterns/SUMMARY.md`, `canon/python/python-protocols/SUMMARY.md` |
| `*.cs` files or `*.csproj` in project | `canon/csharp/csharp-depth/SUMMARY.md`, `canon/csharp/type-systems/SUMMARY.md`, `canon/csharp/async/SUMMARY.md` |
| `.tsx`, `.jsx`, or HTML template files | `canon/ui-ux/components/SUMMARY.md`, `canon/ui-ux/usability/SUMMARY.md`, `canon/ui-ux/tokens/SUMMARY.md` |
| `d3` in package.json or imports | `canon/visualization/d3/SUMMARY.md`, `canon/visualization/charts/SUMMARY.md`, `canon/visualization/dashboards/SUMMARY.md` |
| SQL files or ORM imports | `canon/database/sql/SUMMARY.md`, `canon/database/sql-perf/SUMMARY.md` |
| Auth, tokens, secrets, encryption | `canon/security/security-mindset/SUMMARY.md`, `canon/security/owasp/SUMMARY.md`, `canon/security/web-security/SUMMARY.md` |

If a skill file doesn't exist (not installed in this project), skip it and continue.
List loaded experts in EXPERTS_LOADED. In EXPERT_DECISIONS, show each specific structural decision an expert drove.

### Step 0b: Learn From Past Mistakes

Read both lessons files if they exist:
1. `.claude/universal-lessons.md` — universal patterns (ships with skills, applies to all projects)
2. `.claude/lessons.md` — project-specific patterns (accumulated from this project's runs)

Apply relevant lessons to your structural design:

- **DESIGN** entries → avoid these architectural mistakes in your target state
- **LOGIC** entries → design types/interfaces that make these bug patterns impossible (e.g., validated newtypes instead of raw strings for paths/names)
- **AI_SMELL** entries → do not create speculative types/interfaces without consumers; avoid over-decomposition

If a file doesn't exist, skip it and continue.

### Step 0c: Load Quality Contracts

Read `.claude/rubric/contracts.md`. This defines 7 abstract types for boundary enforcement. Use them during boundary analysis in both modes.

---

## MODE: Map (Existing Code)

Analyze existing code, diagram relationships, design improvements.

### Step 1: Map Current Architecture

Read all files in target. Output a diagram:

```
## Architecture: [target]

CURRENT_STATE:
┌─────────────┐     ┌─────────────┐
│ UserService │────▶│  AuthStore  │
│             │     │             │
│ - getUser() │     │ - token     │
│ - saveUser()│     │ - validate()│
└──────┬──────┘     └──────┬──────┘
       │                   │
       ▼                   ▼
┌─────────────┐     ┌─────────────┐
│   User      │     │   Session   │
│ (interface) │     │ (interface) │
└─────────────┘     └─────────────┘

DEPENDENCIES:
- UserService → AuthStore (tight coupling)
- UserService → User (data)
- AuthStore → Session (data)

ISSUES_FOUND:
- [issue]: [why it matters]

PURITY_CHECK:
- [module]: pure ✓ | impure ✗ (calls [I/O function] directly)
  For each impure module: can business logic be extracted into pure functions
  that take data and return data, with I/O pushed to callers?
```

### Step 2: Apply Canon Wisdom

Review against principles from the masters:

| Principle | Check |
|-----------|-------|
| **Data-first** | Are data structures driving the design? |
| **Composition** | Inheritance depth > 2? Refactor to composition. |
| **Single responsibility** | Does each class do one thing? |
| **Interface segregation** | Are interfaces minimal? |
| **Dependency inversion** | Depend on abstractions, not concretions? |
| **Pure core / impure shell** | Is business logic free of I/O? Core functions should take data and return data — no direct calls to filesystem, network, or database. I/O belongs in a thin outer layer that calls the pure core. If a function both computes and persists, split it. |
| **Impossible states** | Can invalid states be represented? |
| **Quality contracts** | Are boundaries enforced with validated types, or do raw strings pass through? |

### Step 3: Design Target State

```
TARGET_STATE:
┌─────────────┐     ┌─────────────┐
│ UserService │     │ AuthService │
│             │     │ (new)       │
└──────┬──────┘     └──────┬──────┘
       │                   │
       ▼                   ▼
┌─────────────────────────────────┐
│         UserRepository          │
│         (extracted)             │
└─────────────────────────────────┘

CHANGES_NEEDED:
- Extract AuthService from AuthStore
- Create UserRepository interface
- Inject dependencies via constructor

EXPERTS_LOADED: [list of skill names actually read]
EXPERT_DECISIONS:
- [expert-skill]: [specific structural decision it drove]
```

### Map Mode Output

```markdown
## Structure: [target]

MODE: map

CURRENT_STATE:
[diagram]

ISSUES_FOUND:
- [issue]: [description]

TARGET_STATE:
[diagram]

CHANGES_NEEDED:
- [change 1]
- [change 2]

QUALITY_CONTRACTS:
| Boundary | Abstract Type | Contract | Construction Check |
|----------|--------------|----------|--------------------|
| {boundary} | {type} | {what must be true} | {missing contract = issue} |

EXPERTS_LOADED: [list of skill names actually read]
EXPERT_DECISIONS:
- [expert-skill]: [specific decision it drove]

STRUCTURE_COMPLETE
```

---

## MODE: Create (New Types from Plan)

Create actual type files from an approved plan.

### Requirements

1. **CREATE TYPE FILES** - Use Write tool to create actual .ts files
2. **EVERY TYPE FROM PLAN** - Create all types listed in plan's TYPES section
3. **NO PLACEHOLDER TYPES** - Every field must have a real type, not 'any' or 'unknown'
4. **INVARIANTS AS COMMENTS** - Document invariants as JSDoc comments

### Craft Standards

Types must look like they were designed by a skilled human engineer:

**Reject:**
- Over-engineered type hierarchies
- Generic wrappers when simple types work
- Speculative fields "in case we need them later"
- `Partial<T>` abuse creating unclear contracts

**Embrace:**
- Types that document the domain
- Minimal fields - only what's actually used
- Self-documenting names
- Impossible states made unrepresentable

### Elegance Principles

| Principle | Apply It |
|-----------|----------|
| **Minimal surface** | Only essential methods/fields |
| **Consistent naming** | Same operation = same name everywhere |
| **Orthogonal operations** | Operations compose cleanly |
| **Interface over implementation** | Return `List<T>` not `ArrayList<T>` |
| **Immutability by default** | Prefer readonly. Mutation is explicit. |
| **Pure core / impure shell** | Business logic takes data, returns data. I/O is a separate layer. |
| **Fail-fast** | Validate at boundaries |

### Boundary Analysis (Create Mode)

For each function/module being created, identify boundaries using the detection signals from `.claude/rubric/contracts.md`:
- Where does user input enter? → ValidatedInput
- Where are file paths constructed? → SafePath
- Where are errors caught and re-thrown? → CausedError
- Where are secrets handled? → Secret
- Where is external data read? → ExternalData
- Where could operations hang or grow unbounded? → BoundedOperation
- Where are state mutations that could be retried? → IdempotentAction

Output a QUALITY_CONTRACTS table in the structure output.

### Create Mode Output

```markdown
## Structure: [feature]

MODE: create

TYPES_CREATED:
- src/types/user.ts: User, UserPublic, CreateUserInput
- src/types/auth.ts: AuthToken, TokenPayload

INVARIANTS_DOCUMENTED:
- User: email must be unique, password_hash never exposed
- AuthToken: expires_at must be in future

QUALITY_CONTRACTS:
| Boundary | Abstract Type | Contract | Construction Check |
|----------|--------------|----------|--------------------|
| {where data enters/leaves} | {abstract type} | {what must be true} | {EXPORT_FUNCTION or EXPORT_TYPE to verify} |

EXPERTS_LOADED: [list of skill names actually read]
EXPERT_DECISIONS:
- [expert-skill]: [specific decision it drove]

STRUCTURE_COMPLETE
```

---

## FORBIDDEN (Phase FAILS if detected)

- Using 'any' or 'unknown' types
- TODO comments in types
- Describing without creating (create mode)
- Skipping diagram (map mode)
- No STRUCTURE_COMPLETE marker

## 🛑 MANDATORY STOP

After completing structure analysis/creation:
- DO NOT proceed to `/implementation`
- DO NOT start writing implementation code

**Your turn ends here.** Output STRUCTURE_COMPLETE and STOP.

Related Skills

infrastructure-documenter

16
from diegosouzapw/awesome-omni-skill

Expert guide for documenting infrastructure including architecture diagrams, runbooks, system documentation, and operational procedures. Use when creating technical documentation for systems and deployments.

architecting-structure

16
from diegosouzapw/awesome-omni-skill

Enforces "Feature-First" architecture across standard frameworks. Use to scaffold new projects, refactor messy ones, or enforce clean file organization rules.

analyze-code-structure

16
from diegosouzapw/awesome-omni-skill

Examine code organization and identify structural patterns. Use when reviewing module design.

agentic-structure

16
from diegosouzapw/awesome-omni-skill

Collaborative programming framework for production-ready development. Use when starting features, writing code, handling security/errors, adding comments, discussing requirements, or encountering knowledge gaps. Applies to all development tasks for clear, safe, maintainable code.

abp-infrastructure-patterns

16
from diegosouzapw/awesome-omni-skill

ABP Framework cross-cutting patterns including authorization, background jobs, distributed events, multi-tenancy, and module configuration. Use when: (1) defining permissions, (2) creating background jobs, (3) publishing/handling distributed events, (4) configuring modules.

data-structure-protocol

16
from diegosouzapw/awesome-omni-skill

Give agents persistent structural memory of a codebase — navigate dependencies, track public APIs, and understand why connections exist without re-reading the whole repo.

seo-structure-architect

16
from diegosouzapw/awesome-omni-skill

Analyzes and optimizes content structure including header hierarchy, suggests schema markup, and internal linking opportunities. Creates search-friendly content organization.

structured-prompt-writer

16
from diegosouzapw/awesome-omni-skill

结构化AI提示词写作工具,内置395+提示词模板。支持详细模式和简单模式。用于创建专业的AI角色提示词、系统提示词或任务提示词。当用户需要:(1) 创建新的AI提示词/Prompt (2) 设计AI角色/Persona (3) 编写系统提示词 (4) 优化现有提示词结构时使用此技能。

ai-ad-prompt-structurer

16
from diegosouzapw/awesome-omni-skill

No description provided.

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

ui-ux-pro-max

16
from diegosouzapw/awesome-omni-skill

UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 9 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient. Integrations: Component search and examples.

ui ux

16
from diegosouzapw/awesome-omni-skill

UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 9 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient. Integrations: shadcn/ui MCP for component search and examples.