Claude
Skills
Sign in
Back

SPECLAN Format

Included with Lifetime
$97 forever

This skill should be used when the user works with SPECLAN specification files in the speclan/ directory, asks to "read a feature", "list requirements", "create a feature", "new requirement", "update a spec", "delete a change request", "show spec hierarchy", "ID format", or references SPECLAN entity types (Goal, Feature, Requirement, ChangeRequest). Provides foundational knowledge for all speclan/ directory operations including file structure, validation rules, status lifecycle, and entity relationships.

Generalscripts

What this skill does


# SPECLAN Format Knowledge

**THIS IS FOUNDATIONAL CONTEXT.** Apply these rules to ALL speclan file operations.

SPECLAN (Specification as a Living Language) manages project specifications as interlinked markdown files with YAML frontmatter in a hierarchical directory structure.

## Quick Reference (CRITICAL)

### Filename IS the Source of Truth

The **directory/filename pattern** `{PREFIX}-{ID}-{slug}` is authoritative:

```
F-1049-pet-management/F-1049-pet-management.md
│  │    │              └─ File MUST match directory name
│  │    └─ Kebab-case slug from title
│  └─ 4-digit numeric ID (randomly generated)
└─ Entity prefix (F=Feature, R=Requirement, etc.)
```

**Extract ID from filename, NOT frontmatter** for indexing and collision checks.

### Entity Prefixes

| Entity | Prefix | Digits | Example | Storage |
|--------|--------|--------|---------|---------|
| Goal | G- | 3 | G-292 | `goals/G-292-slug.md` (flat) |
| Feature | F- | 4 | F-1049 | `features/F-1049-slug/F-1049-slug.md` (dir) |
| Requirement | R- | 4 | R-2046 | `features/.../requirements/R-2046-slug/R-2046-slug.md` (dir) |
| Change Request | CR- | 4 | CR-0731 | `{parent}/change-requests/CR-0731-slug.md` (flat) |

### Status Determines Editability

| Editable (direct edit OK) | Locked (needs Change Request) |
|---------------------------|------------------------------|
| draft, review, approved | in-development, under-test, released, deprecated |

## Directory Structure

SPECLAN specifications live in `${PROJECT}/speclan/`:

```
speclan/
├── goals/                    # G-### Business goals (flat)
├── features/                 # F-#### Feature hierarchy
│   └── F-1049-pet-management/
│       ├── F-1049-pet-management.md      # Feature file matches directory
│       ├── requirements/                  # Requirements as directories
│       │   ├── R-2046-health-check/
│       │   │   ├── R-2046-health-check.md
│       │   │   └── change-requests/       # CRs for this requirement
│       │   └── R-3272-status-tracking/
│       │       └── R-3272-status-tracking.md
│       ├── change-requests/               # CRs for this feature
│       │   └── CR-0731-add-feature.md
│       └── F-1200-pet-health/             # Child feature (nested)
│           └── F-1200-pet-health.md
├── templates/                # Templates (UUID in frontmatter, slug filename)
│   ├── features/
│   └── requirements/
└── change-requests/          # Root-level change requests
```

**Key structural rules:**
- **Features and Requirements use directory-based storage** - directory name must match contained markdown filename
- Requirements are nested inside their parent feature's `requirements/` directory as subdirectories
- Child features are subdirectories of parent features
- Change requests live in `change-requests/` adjacent to the entity they modify (features OR requirements)

## Entity Hierarchy

```
Goal (G-###)
  └── Feature (F-####)  [forms hierarchical tree via directories]
        └── Requirement (R-####)
```

Additional entities:
- **Template** (UUID v4) - Reusable spec templates
- **ChangeRequest** (CR-####) - Modifications to released entities

## ID Format Conventions

| Entity | Format | Example | Storage Location |
|--------|--------|---------|------------------|
| Goal | `G-###` | G-292 | `goals/` (flat files) |
| Feature | `F-####` | F-1049 | `features/` (hierarchical directories) |
| Requirement | `R-####` | R-2046 | `features/{feature}/requirements/` (directories) |
| ChangeRequest | `CR-####` | CR-0731 | `{entity}/change-requests/` (flat files) |
| Template | UUID v4 | bf5cb38b-... | `templates/{type}/` (flat files) |

**ID Generation:** All numeric IDs are **randomly generated** with collision detection (not sequential). Always check existing IDs before creating new ones.

**ID-Based Ordering:** IDs determine artifact priority/order numerically:
- **Lower IDs = Higher priority** (processed/displayed first)
- **Higher IDs = Lower priority** (processed/displayed later)
- Example: F-1049 has higher priority than F-2847
- This ordering applies within the same entity type (features sorted among features, requirements among requirements, etc.)

## File Naming Convention

Files follow pattern: `<ID>-kebab-case-title.md`

Examples:
- `G-292-comprehensive-pet-retail-operations.md` (flat file in goals/)
- `F-1049-pet-management/F-1049-pet-management.md` (directory-based)
- `R-2046-health-check/R-2046-health-check.md` (directory-based)

**Directory-based entities** (Features, Requirements):
- Directory name **must match** the contained markdown filename
- Example: `F-1049-pet-management/F-1049-pet-management.md`
- Example: `R-2046-health-check/R-2046-health-check.md`

Template filenames use **kebab-case slugs** (UUID stored in frontmatter only):
- `basic-feature.md`
- `functional-requirement.md`

## Markdown File Format

Every spec file has YAML frontmatter followed by markdown content. The **body MUST start with an H1 heading (`# Title`) matching the `title` field** from the frontmatter:

```markdown
---
id: F-1049
type: feature
title: Pet Management
status: draft
owner: Store Manager
created: "2025-12-29T09:53:49.355Z"
updated: "2025-12-29T10:31:04.445Z"
goals:
  - G-292
  - G-087
---

# Pet Management              ← REQUIRED: H1 must match frontmatter title

## Overview
Brief description of what this feature does and why it exists.

## User Story
As a **Store Manager**, I want **comprehensive tools** so that **I can track pets**.

## Scope
- Pet Tracking
- Status Management
- Health Records
```

**Structural rules:**
- First line after frontmatter MUST be `# {title}` (H1 heading)
- Subsequent sections use `## Heading` (H2) and below
- No content before the H1 heading

## Common YAML Frontmatter Fields

**All entities share:**
```yaml
id: <entity-id>           # Required
type: <entity-type>       # Required: goal|feature|requirement|template|changeRequest
title: <string>           # Required
status: <status>          # Required: draft|review|approved|in-development|under-test|released|deprecated
owner: <string>           # Required
created: <ISO-8601>       # Required
updated: <ISO-8601>       # Required
tags: [<string>, ...]     # Optional
```

**Entity-specific fields** - See `references/entity-fields.md` for complete reference.

## Status Lifecycle

Entities follow a 7-stage lifecycle:

```
draft → review → approved → in-development → under-test → released → deprecated
```

| Status | Editable | Description |
|--------|----------|-------------|
| `draft` | Yes | Initial creation, work in progress |
| `review` | Yes | Ready for review |
| `approved` | Yes | Approved, ready for development |
| `in-development` | **No** | Currently being implemented |
| `under-test` | **No** | Implementation complete, testing |
| `released` | **No** | Deployed to production |
| `deprecated` | **No** | No longer active (terminal state) |

**Read-only statuses:** Entities in `in-development`, `under-test`, `released`, or `deprecated` are locked. Direct edits are not allowed - changes require a **Change Request** (`CR-####`).

## Validation Rules

For complete validation rules including ID format regex, directory naming enforcement,
parent-child relationship validation, status lifecycle rules, and entity-specific
field validation, consult `references/validation-rules.md`.

## Linking Between Specs

### YAML Frontmatter References

```yaml
# Goal references features
contributors:
  - F-1049
  - F-2247

# Feature references goals
goals:
  - G-292
  - G-087

# Requirement references parent feature
feature: F-1009

```

### Markdown Cross-References

Use relative paths in markdown content:

```markdown
## Related
### Goals
- [Animal Welfare Compliance](../goals/G-087-animal-welfare-compliance.md)

### Features
- [Pet Status Lifecycle](../F-1807-pet-status-lifecycle/F-1807-pet-status-lifecycle.md)
```

## Working with SPECLAN Files

### Detecting SPECLAN Directory

To find the speclan directory in a project:

1. Check common locations:

Related in General