Specification Toolkit for Marketing Operations - Transform marketing chaos into structured, AI-driven workflows.
A Spec-Driven Toolkit that enables marketing teams to:
β
Define marketing operations as structured YAML specifications
β
Validate plans, campaigns, and content against 45 business rules
β
Execute with 10 SDM workflow commands for guided specification creation
β
Analyze performance with AI-generated insights and optimization recommendations
v0.4.0 introduces a distributed directory structure with 10 SDM commands for specification-driven marketing operations:
specs/ β WHAT to achieve (Strategy specifications - Markdown)
config/ β Configurable parameters (YAML)
templates/ β Content templates (Markdown/Text)
data/ β Collected metrics (JSON)
src/ β HOW to execute (Executable code - TypeScript) β
Complete workflow: Specify β Plan β Tasks β Implement β [Execute Code] β Review β Optimize
Architecture inspired by: Anthropic's Code Execution with MCP
# Using pip
pip install marketing-spec-kit
# Using uv (recommended)
uv pip install marketing-spec-kit# Initialize a new project with AI-driven workflow
marketing_spec_kit init my-marketing-project
cd my-marketing-project
# The generator creates:
# β
memory/constitution.md - Marketing principles
# β
specs/README.md - Workflow guidance
# β
.marketingspeckit/commands/ - 10 SDM commands for AI
# Note: config/, templates/, data/, src/ created by /marketspec.implement
# Follow the AI-driven workflow
# Talk to AI: "Create a Q1 campaign using /marketspec.specify"
# AI generates:
# specs/001-q1/spec.md (Markdown specifications)
# config/001-q1.yaml (configuration - via /marketspec.implement)
# templates/001-q1/ (content templates - via /marketspec.implement)
# src/campaigns/001-q1.ts (executable code - via /marketspec.implement)New in v0.4.0: Distributed architecture with 10 commands (8 Core + 2 Extension)!
# Phase 1: Define WHAT (Specifications in specs/)
/marketspec.constitution # β memory/constitution.md
/marketspec.specify "Q1 Growth" # β specs/001-q1/spec.md
/marketspec.clarify # β specs/001-q1/clarifications.md
/marketspec.plan # β specs/001-q1/plan.md
/marketspec.checklist # β specs/001-q1/checklist.md
/marketspec.tasks # β specs/001-q1/tasks.md
/marketspec.analyze # β specs/001-q1/analysis.md
# Phase 2: Build HOW + DATA β
/marketspec.implement # Generates:
# β src/campaigns/001-q1.ts (executable code)
# β src/shared/mcp-tools/*.ts (MCP wrappers)
# β config/001-q1.yaml (configuration)
# β templates/001-q1/ (content templates)
# Phase 3: Execute Campaign (Run Generated Code)
npm install # Install dependencies
ts-node src/campaigns/001-q1.ts # Execute the campaign code
# β Code calls MCP tools (github-api, twitter-api, etc.)
# β Data collected in data/001-q1/
# Phase 4: Review & Optimize (Analysis in specs/)
/marketspec.review # β specs/001-q1/review.md
/marketspec.optimize # β specs/001-q1/optimize.mdKey Insight:
specs/= WHAT (Strategy specifications - Markdown)config/= Adjustable parameters (YAML)templates/= Content templates (Markdown/Text)data/= Collected metrics (JSON)src/= HOW (Executable code - TypeScript) β
See SDM Workflow Example for complete walkthrough!
marketing-spec-kit v0.4.0 uses a distributed directory structure:
Purpose: Define WHAT to achieve
| Document | Purpose | Generated By |
|---|---|---|
spec.md |
Requirements and objectives | /marketspec.specify |
clarifications.md |
Resolved ambiguities | /marketspec.clarify |
plan.md |
Marketing strategy | /marketspec.plan |
checklist.md |
Quality standards | /marketspec.checklist |
tasks.md |
Task breakdown | /marketspec.tasks |
analysis.md |
Consistency report | /marketspec.analyze |
review.md |
Performance report | /marketspec.review |
optimize.md |
Optimization recommendations | /marketspec.optimize |
Purpose: Configurable campaign parameters
| File | Purpose | Generated By |
|---|---|---|
{seq}-{name}.yaml |
Campaign configuration | /marketspec.implement |
Purpose: Reusable content templates
| Directory | Purpose | Generated By |
|---|---|---|
{seq}-{name}/ |
Campaign-specific templates | /marketspec.implement |
Purpose: Runtime collected metrics
| Directory | Purpose | Generated By |
|---|---|---|
{seq}-{name}/ |
Campaign data | Code execution |
Purpose: Define HOW to execute (code calling MCP tools)
| Directory | Purpose | Generated By |
|---|---|---|
campaigns/*.ts |
Campaign execution scripts | /marketspec.implement |
shared/mcp-tools/*.ts |
MCP tool wrappers | /marketspec.implement |
shared/utils.ts |
Helper functions | /marketspec.implement |
| Command | Description |
|---|---|
init <project-dir> |
Create a new marketing project (generates memory/, specs/, .marketingspeckit/) |
validate <file> |
Validate YAML files in config/ against business rules (optional) |
info |
Show toolkit version and statistics |
Note: Most work is done through SDM commands (via AI), not CLI.
New in v0.4.0: Distributed architecture (8 Core + 2 Extension commands)
| # | Command | Purpose | Output Layer | Output File |
|---|---|---|---|---|
| 1 | /marketspec.constitution |
Define marketing principles | memory/ |
constitution.md |
| 2 | /marketspec.specify |
Define marketing requirements | specs/ |
{seq}-{name}/spec.md |
| 3 | /marketspec.clarify |
Clarify objectives | specs/ |
{seq}-{name}/clarifications.md |
| 4 | /marketspec.plan |
Plan marketing strategy | specs/ |
{seq}-{name}/plan.md |
| 5 | /marketspec.checklist |
Generate quality standards | specs/ |
{seq}-{name}/checklist.md |
| 6 | /marketspec.tasks |
Break down tasks | specs/ |
{seq}-{name}/tasks.md |
| 7 | /marketspec.analyze |
Check consistency & coverage | specs/ |
{seq}-{name}/analysis.md |
| 8 | /marketspec.implement |
Generate code + configs β | src/ + config/ + templates/ |
campaigns/{seq}-{name}.ts + config + templates |
| # | Command | Purpose | Output Layer | Output File |
|---|---|---|---|---|
| 9 | /marketspec.review |
Analyze campaign results | specs/ |
{seq}-{name}/review.md |
| 10 | /marketspec.optimize |
Generate optimization recommendations | specs/ |
{seq}-{name}/optimize.md |
specs/ (Markdown): Human-readable specifications and reports
- WHAT to achieve (specifications, plans)
- Quality standards (checklists, analysis)
- Performance reports (review, optimize)
config/ (YAML): Campaign configurations
- Adjustable parameters
- KPIs, budgets, schedules
templates/ (Markdown/Text): Content templates
- Reusable content templates
- Channel-specific formats
data/ (JSON): Collected metrics
- Runtime data collection
- Performance tracking
src/ (TypeScript): Executable code β
- Campaign scripts (
campaigns/*.ts) - MCP tool wrappers (
shared/mcp-tools/*.ts) - Helper functions (
shared/utils.ts)
Standard Workflow (8 steps):
specify β clarify β plan β checklist β tasks β analyze β implement β [execute]
With Post-Campaign Analysis (10 steps):
specify β ... β implement β [execute campaign] β review β optimize
Quick Start (4 steps - minimal viable):
specify β plan β tasks β implement
SDM's Role: Clear separation of concerns with distributed directories
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 1: Define WHAT (Commands 1-7 β specs/) β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β /marketspec.specify β specs/001-q1/spec.md β β
β β /marketspec.clarify β specs/001-q1/clarifications.md β β
β β /marketspec.plan β specs/001-q1/plan.md β β
β β /marketspec.checklist β specs/001-q1/checklist.md β β
β β /marketspec.tasks β specs/001-q1/tasks.md β β
β β /marketspec.analyze β specs/001-q1/analysis.md β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 2: Build HOW + DATA (Command 8) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β /marketspec.implement β β
β β β src/campaigns/001-q1.ts (executable code) β β β
β β β src/shared/mcp-tools/*.ts (MCP wrappers) β β
β β β config/001-q1.yaml (configuration) β β
β β β templates/001-q1/ (content templates) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 3: Execute Campaign (Run Generated Code) β
β $ npm install β
β $ ts-node src/campaigns/001-q1.ts β
β β
β Code execution: β
β β’ Loads config from config/ β
β β’ Renders templates from templates/ β
β β’ Calls MCP tools (github-api, twitter-api, etc) β
β β’ Saves data to data/001-q1/ β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 4: Review & Optimize (Commands 9-10 β specs/) β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β /marketspec.review β specs/001-q1/review.md β β
β β /marketspec.optimize β specs/001-q1/optimize.md β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
[Feed into next campaign]
Key Insight:
- specs/ = WHAT to achieve (Strategy specifications - Markdown)
- config/ = Adjustable parameters (YAML)
- templates/ = Content templates (Markdown/Text)
- data/ = Collected metrics (JSON)
- src/ = HOW to execute (Executable code - TypeScript) β
Alignment with MetaSpec: specs/ β src/
Extended for marketing: + config/ + templates/ + data/
Inspired by: Anthropic's Code Execution with MCP
Code execution provides major advantages:
| Benefit | Description | Impact |
|---|---|---|
| Progressive Disclosure | Load tool definitions on-demand, not upfront | 98% token savings |
| Context Efficiency | Filter data in execution environment, not LLM context | Faster, cheaper |
| Control Flow | Use code loops/conditions instead of chaining tool calls | Lower latency |
| Privacy | Sensitive data stays in execution environment | Better security |
| Testable | Standard testing frameworks (Jest, pytest) | Higher quality |
| Version Control | Git tracks code changes | Better collaboration |
Example - Progressive Disclosure:
// Load only GitHub tools (not all 1000 tools)
import * as github from './mcp-tools/github';
// Get stars (data filtered in execution, not LLM)
const stars = await github.getStarCount({ repo: 'owner/repo' });
console.log(`Stars: ${stars}`); // Only count logged, not full response- π SDM Layer Overview
- π Complete Workflow Example
- ποΈ Architecture Decisions
- β Implementation Report
marketing-spec-kit can validate YAML files in config/ directory:
# Validate campaign configurations (optional)
marketing_spec_kit validate config/001-q1-campaign.yamlNote: Validation is optional in v0.4.0's distributed architecture:
specs/(Markdown): No formal validation (human-reviewed)config/(YAML): Can be validated against business rulessrc/(TypeScript): Use TypeScript compiler and linters
Validation rules cover entities like Campaign, Channel, Tool, ContentTemplate, etc.
After running /marketspec.implement, your project looks like:
my-marketing-project/
βββ memory/
β βββ constitution.md # Marketing principles
β
βββ specs/
β βββ 001-q1-campaign/
β βββ spec.md # Requirements (WHAT)
β βββ clarifications.md # Resolved questions
β βββ plan.md # Strategy architecture
β βββ checklist.md # Quality standards
β βββ tasks.md # Task breakdown
β βββ analysis.md # Consistency report
β βββ review.md # Performance report (after execution)
β βββ optimize.md # Optimization recommendations
β
βββ config/
β βββ 001-q1-campaign.yaml # Campaign configuration
β
βββ templates/
β βββ 001-q1/
β βββ blog-post-template.md # Blog template
β βββ tweet-template.md # Twitter template
β
βββ data/
β βββ 001-q1/
β βββ github-stars.json # Collected data
β βββ traffic.json
β
βββ src/
βββ campaigns/
β βββ 001-q1-campaign.ts # Main execution script (HOW)
βββ shared/
βββ mcp-tools/
β βββ github.ts
β βββ twitter.ts
βββ config-loader.ts
βββ utils.ts
Example config/001-q1-campaign.yaml:
campaign:
id: "001-q1-campaign"
name: "Q1 Growth Campaign"
spec_ref: "specs/001-q1-campaign/spec.md"
kpis:
github_stars:
target: 500
baseline: 100
repo: "owner/repo"
tool: "github-api"
channels:
twitter:
frequency: "3 posts/day"
budget: 1000
template: "templates/001-q1/tweet-template.md"
budget:
total: 5000
content: 2000
paid_promotion: 3000Example src/campaigns/001-q1-campaign.ts:
import * as github from '../shared/mcp-tools/github';
import { loadConfig, saveData } from '../shared/utils';
async function execute() {
const config = await loadConfig('config/001-q1-campaign.yaml');
const stars = await github.getStarCount({ repo: config.kpis.github_stars.repo });
await saveData('data/001-q1/github-stars.json', { stars });
}See examples/ for complete examples, especially examples/q1-github-stars-campaign/ for a full working project.
marketing-spec-kit/ # The toolkit itself
βββ README.md # This file
βββ CHANGELOG.md # Version history
βββ AGENTS.md # AI Agent guide
βββ docs/
β βββ sdm-commands.md # SDM commands documentation
β
βββ templates/
β βββ sdm/
β βββ commands/ # 10 SDM command definitions
β βββ marketspec.constitution.md
β βββ marketspec.specify.md
β βββ marketspec.clarify.md
β βββ marketspec.plan.md
β βββ marketspec.checklist.md
β βββ marketspec.tasks.md
β βββ marketspec.analyze.md
β βββ marketspec.implement.md β (generates src/ + config/ + templates/)
β βββ marketspec.review.md
β βββ marketspec.optimize.md
β
βββ src/marketing_spec_kit/
βββ generator.py # Project initialization
βββ cli.py # CLI (init, validate, info)
βββ validator.py # YAML validation (optional)
my-marketing-project/ # Created by `marketing_spec_kit init`
βββ memory/
β βββ constitution.md # Marketing principles
β
βββ specs/ # Specifications (Markdown)
β βββ {seq}-{name}/
β βββ spec.md # Requirements
β βββ plan.md # Strategy
β βββ tasks.md # Task breakdown
β βββ analysis.md # Consistency check
β βββ review.md # Performance report
β βββ optimize.md # Recommendations
β
βββ config/ # Configurations (YAML) - created by /marketspec.implement
β βββ {seq}-{name}.yaml β Campaign configuration
β
βββ templates/ # Content templates - created by /marketspec.implement
β βββ {seq}-{name}/
β βββ tweet-template.md
β βββ blog-post-template.md
β
βββ data/ # Collected metrics (JSON) - created by code execution
β βββ {seq}-{name}/
β βββ github-stars.json
β βββ traffic.json
β
βββ src/ # Executable code - created by /marketspec.implement
β βββ campaigns/
β β βββ {seq}-{name}.ts β Main execution script
β βββ shared/
β βββ mcp-tools/*.ts
β
βββ .marketingspeckit/
βββ commands/ # 10 SDM commands (copied from toolkit)
- AGENTS.md - Complete AI Agent workflow guide
- CHANGELOG.md - Version history and changes
- memory/constitution.md - Core principles (v1.3.0)
- specs/domain/ - Domain specification (v0.3.0)
- changes/ - Evolution proposals
This project follows Spec-Driven Development using MetaSpec:
- Specify First: Define changes in
specs/before coding - Validate Early: Run validation before implementation
- Document Changes: Use Evolution Proposals for breaking changes
- Test Thoroughly: Validate against all 45 rules
See .metaspec/README.md for development guide.
- β
Define strategy in human-readable Markdown (
specs/) - β
Generate executable code and configs (
src/,config/,templates/) - β
Track performance with post-campaign analysis (
review,optimize)
- β Guide campaign planning with 10 SDM commands
- β Generate executable TypeScript code automatically
- β Analyze performance and suggest optimizations
- β Validate campaign configuration YAML files (optional)
- β Extend with custom MCP tools for data collection
- β Build on distributed directory architecture
MIT License - see LICENSE for details.
Built with:
- MetaSpec - Spec-Driven Development framework
- Pydantic - Data validation
- Typer - CLI framework
- Rich - Terminal formatting
Generated by: MetaSpec 0.9.5
Version: 0.4.0
Last Updated: 2025-11-20
Architecture: Distributed directories (specs/ + config/ + templates/ + data/ + src/)
For questions or issues, please open an issue.