spec-formatter
# Spec Formatter Skill
What this skill does
# Spec Formatter Skill
Deterministic formatting of specification documents in multiple output formats.
## Purpose
Converts structured spec data into consistent, well-formatted output documents.
## Supported Formats
- **Markdown** (default): Human-readable documentation
- **JSON**: Structured data for tooling
- **YAML**: Configuration-friendly format
## Markdown Template
```typescript
function formatMarkdown(spec: GeneratedSpec): string {
return `
# ${spec.title}
> Generated from session: ${spec.sessionId}
> Completeness: ${spec.metadata.completeness}%
> Generated: ${spec.metadata.generatedAt}
## Problem Statement
**Pain Point:** ${spec.problem.pain}
**Target User:** ${spec.problem.targetUser}
**Current Workarounds:**
${spec.problem.workarounds.map(w => `- ${w}`).join('\n')}
**Success Criteria:**
${spec.problem.successCriteria.map(c => `- ${c}`).join('\n')}
---
## User Flow
${formatUserFlow(spec.userFlow)}
---
## Features
### MVP Features
${formatFeatures(spec.features.mvp)}
### V2 Features
${formatFeatures(spec.features.v2)}
---
## Input/Output Contracts
### Inputs
| Field | Type | Required | Validation | Description |
|-------|------|----------|------------|-------------|
${formatInputTable(spec.contracts.inputs)}
### Outputs
| Field | Type | Nullable | Description |
|-------|------|----------|-------------|
${formatOutputTable(spec.contracts.outputs)}
${spec.contracts.api ? formatApiContracts(spec.contracts.api) : ''}
---
## Edge Cases
| Scenario | Expected Behavior | Priority |
|----------|-------------------|----------|
${formatEdgeCases(spec.edgeCases)}
---
## Assumptions
> These assumptions were made during clarification. Validate with stakeholders.
${spec.assumptions.map((a, i) => `${i + 1}. **${a.topic}**: ${a.assumption} _(${a.reason})_`).join('\n')}
---
## Open Questions
${spec.openQuestions.map(q => `- [ ] ${q}`).join('\n')}
---
_Generated by Spec Iterator MCP_
`.trim();
}
```
## Helper Functions
### Format User Flow
```typescript
function formatUserFlow(flow: UserFlowStep[]): string {
return flow.map((step, i) => {
let line = `${i + 1}. **${step.actor}**: ${step.action} → ${step.outcome}`;
if (step.alternatives) {
line += '\n' + step.alternatives.map(alt =>
` - _If ${alt.condition}_ → ${alt.outcome}`
).join('\n');
}
return line;
}).join('\n');
}
```
### Format Features
```typescript
function formatFeatures(features: Feature[]): string {
return features.map(f => `
#### ${f.name}
${f.description}
**Acceptance Criteria:**
${f.acceptanceCriteria.map(ac => `- [ ] ${ac}`).join('\n')}
**Priority:** ${f.priority}
`).join('\n---\n');
}
```
### Format Tables
```typescript
function formatInputTable(inputs: InputField[]): string {
return inputs.map(i =>
`| ${i.name} | ${i.type} | ${i.required ? 'Yes' : 'No'} | ${i.validation || '-'} | ${i.description} |`
).join('\n');
}
function formatOutputTable(outputs: OutputField[]): string {
return outputs.map(o =>
`| ${o.name} | ${o.type} | ${o.nullable ? 'Yes' : 'No'} | ${o.description} |`
).join('\n');
}
function formatEdgeCases(cases: EdgeCase[]): string {
return cases.map(c =>
`| ${c.scenario} | ${c.handling} | ${c.priority} |`
).join('\n');
}
```
## JSON Format
```typescript
function formatJson(spec: GeneratedSpec): string {
return JSON.stringify({
$schema: "https://spec-iterator.dev/schema/v1",
version: "1.0",
...spec
}, null, 2);
}
```
## YAML Format
```typescript
function formatYaml(spec: GeneratedSpec): string {
// Use a YAML library for proper formatting
return yaml.stringify({
version: "1.0",
...spec
});
}
```
## Data Types
```typescript
interface GeneratedSpec {
title: string;
sessionId: string;
problem: {
pain: string;
targetUser: string;
workarounds: string[];
successCriteria: string[];
};
userFlow: UserFlowStep[];
features: {
mvp: Feature[];
v2: Feature[];
};
contracts: {
inputs: InputField[];
outputs: OutputField[];
api?: ApiEndpoint[];
};
edgeCases: EdgeCase[];
assumptions: Assumption[];
openQuestions: string[];
metadata: {
completeness: number;
generatedAt: string;
sessionRounds: number;
};
}
interface UserFlowStep {
actor: string;
action: string;
outcome: string;
alternatives?: {
condition: string;
outcome: string;
}[];
}
interface Feature {
name: string;
description: string;
acceptanceCriteria: string[];
priority: 'critical' | 'important' | 'nice_to_have';
}
interface InputField {
name: string;
type: string;
required: boolean;
validation?: string;
description: string;
}
interface OutputField {
name: string;
type: string;
nullable: boolean;
description: string;
}
interface EdgeCase {
scenario: string;
handling: string;
priority: 'MVP' | 'V2';
}
```
## File Naming
```typescript
function generateFileName(requirement: string, format: string): string {
const slug = requirement
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-|-$/g, '')
.substring(0, 50);
const extension = format === 'markdown' ? 'md' : format;
return `${slug}-spec.${extension}`;
}
```
## Usage
```typescript
// In spec-compiler agent
const spec = compileSpec(session);
const formatted = formatMarkdown(spec);
const fileName = generateFileName(session.requirement, 'markdown');
writeFile(`outputs/specs/${fileName}`, formatted);
```
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.