tsp-model
Skill262 starsChanged 8 months agoMITView on GitHub
Use when creating, modifying, or documenting TypeSpec domain models. Triggers include adding new entities, value objects, enums, extending base types, or when asked to create a "tsp model", "domain model", "entity", or work with files in the tsp/ directory. Part of the Shep autonomous SDLC platform — https://shep.bot
In this repository23 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- packages/CLAUDE.mdCLAUDE.md
- src/CLAUDE.mdCLAUDE.md
- architecture-reviewerSkill
- cross-validate-artifactsSkill
- mermaid-diagramsSkill
- react-flowSkill
- shadcn-uiSkill
- shep-kit:commit-prSkill
- shep-kit:fast-loopSkill
- shep-kit:implementSkill
- shep-kit:mergedSkill
- shep-kit:new-feature-fastSkill
- shep-kit:new-featureSkill
- shep-kit:parallel-taskSkill
- shep-kit:planSkill
- shep-kit:researchSkill
- shep-kit:statusSkill
- shep:ui-componentSkill
- shep-workstreamsSkill
- vercel-react-best-practicesSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 44
Every .tsp file MUST follow this structure:
- Distinctive: line 127
After creating/modifying TypeSpec:
- Distinctive: line 146
Forgetting index.tsp exports: - Add to directory's index.tsp
- Distinctive: line 147
Wrong import paths: - Use relative paths from current file
- Very specific: line 148
Missing examples: - Always include @example with realistic JSON
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TypeSpec Domain Model Generation
Generate TypeSpec domain models following this project's conventions for Clean Architecture entities.
Directory Structure
tsp/
├── common/ # Base types, scalars, enums
│ ├── base.tsp # BaseEntity, SoftDeletableEntity, AuditableEntity
│ ├── scalars.tsp # UUID scalar type
│ ├── ask.tsp # Askable interface pattern
│ └── enums/ # One file per enum
├── domain/ # Domain entities
│ ├── entities/ # One file per entity
│ └── value-objects/# Embedded value objects
├── agents/ # Agent system models
└── deployment/ # Deployment configuration modelsFile Conventions
One model per file - Each entity/enum/value-object gets its own file.
Naming:
- Files:
kebab-case.tsp(e.g.,action-item.tsp) - Models:
PascalCase(e.g.,ActionItem) - Enums:
PascalCasewith values inPascalCase(e.g.,TaskStatus.InProgress)
Required Template
Every .tsp file MUST follow this structure:
/**
* @module Shep.Domain.Entities.<EntityName>
*
* Brief description of the entity's purpose.
*
* ## Entity Relationships (if applicable)
* ASCII diagram showing relationships
*
* @see docs/concepts/<relevant-doc>.md
* @see <related-entity>.tsp
*/
import "../../common/base.tsp";
import "../../common/scalars.tsp";
// other imports...
/**
* Entity Name
*
* Detailed description.
*
* ## Properties
*
* | Property | Type | Required | Description |
* |----------|------|----------|-------------|
* | ... | ... | ... | ... |
*
* @example
* ```json
* { ... }
* ```
*/
@doc("One-line description for OpenAPI")
model EntityName extends BaseEntity {
/**
* Property description.
* @example "example value"
*/
@doc("One-line property description")
propertyName: PropertyType;
}Base Types
Choose the right base:
| Base Type | Use When |
BaseEntity | Standard entity with id, createdAt, updatedAt |
SoftDeletableEntity | Entity that can be soft-deleted (adds deletedAt) |
AuditableEntity | Entity needing audit trail (adds createdBy, updatedBy) |
Enum Definition Pattern
/**
* @module Shep.Common.Enums.<EnumName>
*/
/**
* Enum description
*/
@doc("One-line enum description")
enum EnumName {
@doc("Description of this value")
ValueOne,
@doc("Description of this value")
ValueTwo,
}Documentation Requirements
- Module JSDoc at file top with
@module, relationships,@seelinks - Model JSDoc with property table and JSON examples
- Property JSDoc with
@exampletags @doc()decorator on every model and property (for OpenAPI)
Validation Commands
After creating/modifying TypeSpec:
pnpm tsp:compile # Verify compilation
pnpm tsp:format # Format TypeSpec filesQuick Reference
| Task | Location | Example |
| New entity | tsp/domain/entities/<name>.tsp | feature.tsp |
| New enum | tsp/common/enums/<name>.tsp | lifecycle.tsp |
| New value object | tsp/domain/value-objects/<name>.tsp | gantt.tsp |
| Agent model | tsp/agents/<name>.tsp | feature-agent.tsp |
Common Mistakes
- Missing
@doc()decorators - Required for OpenAPI generation - Forgetting index.tsp exports - Add to directory's index.tsp
- Wrong import paths - Use relative paths from current file
- Missing examples - Always include
@examplewith realistic JSON
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

