Skill

tsd

This skill should be used when the user asks to "write a TSD", "create a TSD", "write a Technical Specification Document", "document an API", "spec out an API", "write an API spec", "document a data model", "write a technical spec", "create interface documentation", or needs a comprehensive technical specification covering API endpoints, data models, interface contracts, error handling, and versioning (5-20 pages).

From common-engineering
Install
1
Run in your terminal
$
npx claudepluginhub irfansofyana/my-claude-code-marketplace --plugin common-engineering
Tool Access

This skill is limited to using the following tools:

AskUserQuestion Bash Read
Supporting Assets
View in Repository
assets/templates/examples.md
assets/templates/guidance.md
assets/templates/quality-checklist.md
assets/templates/template.md
references/REFERENCE.md
references/question-bank.md
references/writing-guidelines.md
Skill Content

TSD Skill

Create Technical Specification Documents (5-20 pages) that comprehensively define APIs, data models, interface contracts, error handling, versioning strategies, and technical implementation details.

Key principle: All information comes from the user. Do NOT scan the codebase to discover APIs or schemas. The Read tool is only for reading user-provided context files (existing specs, API definitions, tickets) that the user explicitly shares.

When to Use a TSD

  • Defining new API endpoints or modifying existing ones
  • Documenting data models and database schemas
  • Specifying interface contracts between services
  • Documenting integration points with external systems
  • Capturing technical implementation details before or after development

Workflow

Phase 1: Gather Context

Parse what the user already provided in their initial request. Extract:

  • Scope: What API, service, or data model is being specified?
  • Purpose: What does this system do?
  • Consumers: Who/what will use this API?
  • Constraints: Auth, versioning, backward compatibility

Only ask for what's genuinely missing.

Essential questions (use references/question-bank.md patterns, ask only if not already provided):

  1. System overview: "What does this service/API do? What problem does it solve?"
  2. API endpoints (for APIs): "Walk me through the endpoints — what operations does it support? (e.g., CRUD, streaming, webhooks)"
  3. Data models: "Describe the main data entities and their key fields. Any relationships between them?"
  4. Authentication/Authorization: "How do clients authenticate? Are there different permission levels?"
  5. Error handling: "What errors can occur? How should errors be communicated to consumers?"
  6. Versioning: "How will this API be versioned? How will breaking changes be handled?"
  7. Performance requirements: "Any latency, throughput, or SLA requirements?"
  8. Related context (optional): "Existing specs, OpenAPI definitions, or service contracts I should reference?"

If user seems uncertain about design choices: Offer research assistance via agent:web-research-specialist for industry patterns (REST vs GraphQL, pagination approaches, etc.).

Rich context (accept at any point):

  • OpenAPI/Swagger specs → use Read tool to load
  • Existing service code → user should paste key interfaces
  • Pasted schema definitions → incorporate directly

Phase 2: Generate & Iterate

Once sufficient context is gathered, generate the complete TSD draft using the template from assets/templates/template.md.

Content generation rules:

  • Use section headings from template.md exactly
  • Format API endpoints consistently: METHOD /path with request/response examples
  • Use code blocks for JSON schemas, request/response bodies
  • Use tables for field definitions (field, type, required, description)
  • Use italicized placeholders for missing info: Define error codes
  • Do NOT include checkboxes, HTML comments, guidance questions, or quality criteria in output

After presenting the full draft:

  1. Internally validate against assets/templates/quality-checklist.md — never show to user
  2. Ask targeted follow-ups for gaps (e.g., "Should I add example requests and responses for each endpoint?")
  3. Iterate based on feedback
  4. Save in requested format

Document Structure

Key sections (from assets/templates/template.md):

SectionPurpose
AbstractExecutive summary
OverviewPurpose, scope, system context
API Endpoints/MethodsDetailed specs per endpoint
Data Models/SchemasEntity definitions and relationships
Interface ContractsInputs, outputs, preconditions, postconditions
Error HandlingError types, codes, formats, retry logic
Versioning StrategyVersion scheme and backward compatibility
Security ConsiderationsAuth, encryption, data protection
Performance RequirementsLatency, throughput, SLAs
Testing RequirementsUnit, integration, contract testing
ExamplesComplete request/response examples
ReferencesRelated docs and standards
Change LogVersion history

Quality Principles

  • Every endpoint needs: method, path, description, request schema, response schema, error codes
  • Field definitions must include: name, type, required/optional, description, validation rules
  • Use concrete examples — abstract specs are hard to implement against
  • Document what happens on errors, not just the happy path
  • Be explicit about backward compatibility guarantees

Visual Aids

System context and data flow diagrams help consumers understand integration. When requested:

  1. Ask what the diagram should show (system context, entity relationships, sequence flows)
  2. Invoke common-engineering:mermaid skill
  3. Integrate into Overview or relevant section

Integration Points

CapabilityWhen to Use
agent:web-research-specialistResearch API design patterns, industry standards
common-engineering:mermaidSystem context, ER diagrams, sequence diagrams
document-skills:docxExport to Word format
document-skills:pdfExport to PDF format

Reference Files

FilePurpose
references/writing-guidelines.mdTechnical writing best practices
references/question-bank.mdAskUserQuestion patterns for this skill
assets/templates/template.mdDocument structure (use for output)
assets/templates/guidance.mdSection-by-section guidance (read, never copy to output)
assets/templates/quality-checklist.mdInternal validation (never show to user)
assets/templates/examples.mdCompleted examples for quality reference
Stats
Parent Repo Stars3
Parent Repo Forks0
Last CommitMar 18, 2026