Skip to content
Back to skills

Spec Types

ASecurity

Author domain type specification files in a spec's types/ directory. Each file documents types for a domain with field tables, immutability annotations, discriminant fields, and behavior cross-references. Use when creating type specifications, auditing type completeness, or documenting domain types.

  • 22 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added October 22, 2026
ai-agents

Security analysis

A100/100

Scanned October 22, 2026

npx -y skills add leaderiop/SpecForge --skill spec-types --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Spec Types?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Spec Types
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leaderiop-spec-types/badge)](https://www.skillsdirectory.com/skills/leaderiop-spec-types)

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

Download with Pro
SKILL.md
---
name: spec-types
description: "Author domain type specification files in a spec's types/ directory. Each file documents types for a domain with field tables, immutability annotations, discriminant fields, and behavior cross-references. Use when creating type specifications, auditing type completeness, or documenting domain types."
---

# Spec Types

Rules and conventions for authoring **domain type specification files** in a spec's `types/` directory. Distinct from `type-system/` which covers compile-time safety patterns.

## When to Use

- Creating type specifications for domain types
- Auditing type files for completeness (missing immutability annotations, missing discriminant fields)
- Documenting new domain types
- Checking for duplicate type definitions across files

## Directory Structure

```
types/
  index.yaml                    # Manifest of all type files
  <domain>.md                   # One file per domain
```

### index.yaml Schema

```yaml
kind: types
package: "@myproject/<name>"
entries:
  - id: TYPE-001
    file: graph.md
    title: Graph Types
    status: active              # active | draft | deprecated
    domain: graph
  - id: TYPE-002
    file: errors.md
    title: Error Types
    status: active
    domain: errors
```

**Rules:**
- Every `.md` file in `types/` MUST have a corresponding entry
- Every entry MUST have a corresponding file on disk
- No duplicate `id` values across entries
- One file per domain, not one file per type

## File Naming

- Kebab-case domain name: `graph.md`, `agent.md`, `flow.md`, `errors.md`, `ports.md`
- One file per domain, not one file per type

## File Template

```markdown
---
id: TYPE-NNN
kind: types
title: "<Domain> Types"
status: active
behaviors: [BEH-XX-NNN]
adrs: []
---

# <Domain> Types

Type definitions for the <domain> domain.

---

## <TypeName>

| Field | Type | Mutability | Constraints | Description |
|-------|------|------------|-------------|-------------|
| field_a | String | immutable | required | <purpose> |
| field_b | Integer | mutable | optional, >= 0 | <purpose> |

<Prose explaining the type's purpose, constraints, and usage context.>

---
```

### Discriminated Unions

For types that use a discriminant field to distinguish variants:

```markdown
## <UnionTypeName>

**Discriminant field:** `kind`

| Variant | Discriminant Value | Additional Fields |
|---------|-------------------|-------------------|
| VariantA | `"variant_a"` | `payload: String` |
| VariantB | `"variant_b"` | `count: Integer` |
```

## Content Rules

1. **YAML frontmatter** — Every types file MUST start with `---` frontmatter containing `id`, `kind: types`, `title`, `status`, `behaviors`, `adrs`. The `**Source behaviors:**` line is REMOVED from prose — that metadata lives in frontmatter.
2. **Immutability annotations** — All fields should declare mutability (immutable/mutable) in the field table.
3. **Unique discriminant values** — All discriminated union types have unique discriminant values per variant.
4. **Behavior cross-references** — Cross-reference behavior files that use these types.
5. **No duplicates** — No duplicate type definitions across `types/` files.
6. **Errors file** — `types/errors.md` collects all error types with their discriminant values.

## Cross-References

```markdown
# From types to behaviors:
**Source behaviors:** [BEH-XX-001-graph-ops.md](../behaviors/BEH-XX-001-graph-ops.md)

# From behaviors to types (in header):
**Types:** [types/graph.md](../types/graph.md)

# From architecture to types:
See [types/graph.md](../types/graph.md)
```

Attribution

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

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.