agentleFS
MoizIbnYousafMoizIbnYousaf/marketing-cli/CLAUDE.md

marketing-cli

CLAUDE.md33 starsChanged 6 months agoMITView on GitHub

[!IMPORTANT] For runtime CLI usage (commands, flags, output formats), read CONTEXT.md first. For /cmo runtime indexes, read skills/cmo/rules/cli-runtime-index.md, skills/cmo/rules/publish-index.md, and skills/cmo/rules/studio-api-index.md. For /axi (AXI catalog router), read skills/axi/SKILL.md and skills/axi/rules/. For agent/skill contributor guidance, read AGENTS.md. This file is the project's development contract: architecture, standards, and rules. A TypeScript/Bun agent-native marketing playbook CLI. 76 marketing skills (74 playbook + /cmo + /axi), 7 agents (4 research + 3 review), 24 commands, 2 upstream catalogs (postiz, openseo). The Studio dashboard (Next.js…

  • Reads credentials
  • Installs packages

We split this CLAUDE.md into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Progressive Enhancement: Every skill works at zero context.

    line 75
  2. Very specific:

    Drop-in skills: Add a skill: drop SKILL.md + update skills-manifest.json.

    line 78
  3. Very specific:

    Drop-in agents: Add an agent: drop .md in agents/ + update agents-manifest.json.

    line 79
  4. Very specific:

    All validators return { ok, message } and never throw.

    line 97
  5. Distinctive:

    Every command handler must:

    line 116
  6. Distinctive:

    When a skill mirrors content from an upstream OSS source (the firecrawl pattern, now also Remotion), it MUST ship:

    line 145
  7. Very specific:

    Add to the tools array in src/commands/doctor.ts

    line 242
  8. Distinctive:

    Add a row to the Ecosystem table above

    line 243

≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

mktg: Agent-Native Marketing Playbook CLI

[!IMPORTANT] For runtime CLI usage (commands, flags, output formats), read CONTEXT.md first. For /cmo runtime indexes, read skills/cmo/rules/cli-runtime-index.md, skills/cmo/rules/publish-index.md, and skills/cmo/rules/studio-api-index.md. For /axi (AXI catalog router), read skills/axi/SKILL.md and skills/axi/rules/. For agent/skill contributor guidance, read AGENTS.md. This file is the project's development contract: architecture, standards, and rules.

What This Is

A TypeScript/Bun agent-native marketing playbook CLI. 76 marketing skills (74 playbook + /cmo + /axi), 7 agents (4 research + 3 review), 24 commands, 2 upstream catalogs (postiz, openseo). The Studio dashboard (Next.js + Bun API) ships inside the same tarball and is launched via mktg studio.

ComponentCountPurpose
mktg CLI24 commandsInfrastructure: setup, health, skill management, catalog registry, verification, and orchestration
/cmo skill1 orchestratorRoutes every marketing request to the right skill
/axi skill1 orchestratorRoutes agent-tool work to AXI-catalog CLIs (gh-axi, chrome-devtools-axi, …)
brand/ directory10 memory files (+ SCHEMA.md)Persistent marketing memory, compounds across sessions
Marketing skills76 total (74 playbook + /cmo + /axi)The playbook, installed to ~/.claude/skills/
Marketing agents7Parallel sub-agents for research + independent review, installed to ~/.claude/agents/
Upstream catalogs2External OSS projects mktg builds on (postiz = 30+ social providers via REST API, AGPL-firewalled; openseo = SEO data plane via research_adapters + MCP)
Studio dashboard1Next.js + Bun API workspace member at studio/, bundled in the tarball, launched via mktg studio

Repo Layout

This is a bun-workspaces monorepo with one publishable package: marketing-cli. The studio/ subfolder is a workspace member; its source ships inside the marketing-cli tarball, so npm i -g marketing-cli installs the CLI and the dashboard together. The workspace exists because Studio is a Next.js app with its own build pipeline.

PathComponentLaunched via
(root)marketing-cli (CLI: skills, agents, brand memory, /cmo)mktg <command>
studio/Studio dashboard (Next.js + Bun API + Drizzle)mktg studio

Architecture

src/
├── cli.ts              # Entry point, command router, global flag parsing
├── types.ts            # All shared TypeScript types
├── commands/           # One file per command (init, doctor, status, setup, list, etc.)
├── core/
│   ├── output.ts       # JSON/TTY formatting, --fields filtering, size warnings
│   ├── args.ts         # Canonical --flag value parsing (flagValue/flagValues)
│   ├── project-assess.ts # Project health/next-step assessment (status/plan)
│   ├── url-validation.ts # SSRF guard: public-URL validation, one-hop redirect, size cap
│   ├── publish/postiz/ # Postiz raw-fetch client, markers, media, adapter, admin (single client; studio imports it)
│   ├── errors.ts       # Structured errors, exit codes 0-6, sandboxPath()
│   ├── brand.ts        # Brand dir management + freshness assessment
│   ├── skills.ts       # Skill registry, install, integrity verification
│   ├── skill-add.ts    # External skill chaining (mktg skill add)
│   ├── agents.ts       # Agent registry, install to ~/.claude/agents/
│   └── transcribe.ts   # whisper.cpp + yt-dlp + ffmpeg pipeline
skills/                  # 76 SKILL.md files installed to ~/.claude/skills/
skills-manifest.json     # Definitive skill list with metadata
agents/                  # 6 agent .md files installed to ~/.claude/agents/
agents-manifest.json     # Definitive agent list with metadata
catalogs-manifest.json   # Upstream catalog registry (postiz v1, openseo; parallel to skills/agents)
studio/                  # Studio dashboard workspace member (ships inside the tarball)
├── app/                 # Next.js dashboard
├── server.ts            # Bun API server
├── server/http.ts       # HTTP helpers for the API
└── server/routes/       # activity, brand, content, publish, signals
├── bin/mktg-studio.ts   # Local launcher (mktg studio resolves this first)
├── components/          # React UI
└── package.json         # Workspace package.json: Next.js deps + build scripts (no separate publish)

Key Principles

[!IMPORTANT] These principles are non-negotiable. Every PR, skill, and command must uphold them.

  1. Progressive Enhancement: Every skill works at zero context. Brand memory enhances, never gates.
  2. Agent-native: Built for agents to run, not humans. Predictability over discoverability.
  3. Self-bootstrapping: mktg init installs everything on any machine.
  4. Drop-in skills: Add a skill: drop SKILL.md + update skills-manifest.json. No CLI code changes.
  5. Drop-in agents: Add an agent: drop .md in agents/ + update agents-manifest.json. No CLI code changes.
  6. Skills never call skills: Skills read/write files. /cmo orchestrates. Agents never call agents.
  7. Parallel by default: Foundation building spawns 3 research agents simultaneously.

Security Posture

[!IMPORTANT] The agent is not a trusted operator. All inputs from agent callers are treated as potentially adversarial.

ValidatorWhat it catchesReturns
rejectControlChars()Control characters in skill names, brand content{ ok, message }
validateResourceId()?, #, %, spaces, slashes in resource IDs{ ok, message }
detectDoubleEncoding()%25XX bypass attempts before path resolution{ ok, message }
validatePathInput()Combined pipeline: control chars → double encoding → sandboxPath{ ok, message }
sandboxPath()Absolute paths, .. traversal, symlink escape{ ok, message }
parseJsonInput()Oversized payloads (>64KB), prototype pollution{ ok, message }

All validators return { ok, message } and never throw. Error messages explain what failed and why.

Agent DX Score: 21/21

[!IMPORTANT] Every code change must maintain this score. Tests enforce it.

AxisStandardTest file
Machine-Readable OutputValid JSON from all commands. Auto-JSON when piped. Consistent error envelope.machine-readable-output.test.ts
Raw Payload Input--input accepts full JSON payload. Zero translation loss.raw-payload-input.test.ts
Schema Introspectionmktg schema returns responseSchema with typed fields, enums, nested detection.schema-introspection.test.ts
Context Window Discipline--fields dot-notation on all commands. 10KB response size warning.context-window-discipline.test.ts
Input HardeningAll 6 validators on all inputs. 52 fuzz tests.input-hardening.test.ts
Safety Rails--dry-run on ALL mutating commands. --confirm on destructive ops.safety-rails.test.ts
Agent Knowledge PackagingAGENTS.md, brand/SCHEMA.md, all skills versioned, OpenClaw frontmatter.Manual review

CLI Command Standards

Every command handler must:

RequirementImplementation
Typed returnCommandResult<T> with typed data
JSON output--json flag, auto-enabled when piped via !isTTY()
Dry run--dry-run for all mutating operations
Field filtering--fields with dot-notation
Destructive guard--confirm for destructive operations
Error guidancefix field on error/warning checks
Schema docsEntry in schema.ts with responseSchema
Streaming--ndjson option for list-like commands

Skill Standards

Every SKILL.md must:

RuleWhy
Under 500 linesOffload depth to references/ subdirectory
Frontmatter with name, descriptionPushy triggers that combat undertriggering
On Activation sectionRead brand/ files with fallback behavior
Anti-Patterns with WHYExplain why each pattern is wrong; "do Y instead" alone is incomplete
Progressive enhancementWork at L0 (zero context), better at L4 (full brand)
Use voice-profile.mdNEVER voice.md
Brand file refs use brand/ prefixConsistent path resolution in frontmatter reads

Upstream-Mirrored Skills

When a skill mirrors content from an upstream OSS source (the firecrawl pattern, now also Remotion), it MUST ship:

  • upstream.json provenance manifest (snapshot SHAs, per-file blob SHAs, source list) — the canonical record of which upstream blobs the mirror tracks.
  • scripts/check-upstream.sh drift detector (emits {ok, in_sync, sources[].drift} JSON envelope; exit 0 in sync / 1 drift / 2 error).
  • Attribution footer in SKILL.md crediting upstream maintainers and linking the source repo.
  • Manifest source: "new" plus an upstream object recording the source repos and paths (see remotion-best-practices for the canonical example). The skill content was curated and mirrored — "new" matches the intent (we authored/curated it). The dedicated upstream object carries the upstream-mirror semantics: it tracks the source repos, paths, and provenance.

Mirrored content is verbatim. The skill's mktg-adapted SKILL.md is the only file that wraps upstream content with mktg conventions (drop-in frontmatter, brand-ground On Activation section). Drift checks treat adapted files specially via the note: "adapted-frontmatter" flag in upstream.json.

See marketing-cli/skills/remotion-best-practices/ for the canonical example. Phase 2 of /mktg-steal added mktg skill check-upstream and mktg skill upgrade CLI commands that fan across every skill with an upstream.json.

Brand File Standards

Per brand/SCHEMA.md: 10 memory files (plus the schema file itself), each with defined required sections.

RuleDetail
Canonical voice filevoice-profile.md (never voice.md)
Template detectionSHA-256 hash comparison in isTemplateContent()
Freshness: profiles30-day staleness window
Freshness: config90-day staleness window
Freshness: append-onlyNever stale
Skill-to-brand mappingCONTEXT_MATRIX maps skill layers to required brand files

Testing Standards

[!IMPORTANT] NO MOCKS. NO FAKE DATA. Real file I/O in isolated temp dirs. This is non-negotiable.

tests/                    # Unit tests per module
tests/integration/        # Per-command integration tests (all 7 DX axes)
tests/integration/cmo/    # CMO coherence tests (orchestrator visibility)
tests/e2e/                # Full pipeline soup-to-nuts tests
RuleDetail
Test frameworkbun:test imports only
File I/OReal operations in temp dirs via mkdtemp
AssertionsCheck REAL output from REAL operations
Skill countsNever hardcode; read from manifest or use toBeGreaterThanOrEqual
Run frequencybun test after every change, report results

Dev Notes

TopicRule
Package managerbun for all operations
Code styleFunctional patterns, no classes. Named exports only.
File sizeKeep under 300 lines
Buildbun build src/cli.ts --outdir dist --target node
Type checkbun x tsc --noEmit
CommitsFrequently during long sessions to protect work

Upstream Catalogs

mktg treats selected OSS projects as upstream catalogs: we build on top of them via REST API rather than vendoring their code or linking their SDKs. This lets us inherit providers (postiz ships 30+ social channels; future catalogs like cal.com would ship 40+ calendar integrations) without owning the implementation burden or the license inheritance.

The current publish stack also includes mktg-native, a local-first workspace backend for X, TikTok, Instagram, Reddit, and LinkedIn queue/history state. Native provider/account state lives under .mktg/native-publish/ and is documented for /cmo in skills/cmo/rules/publish-index.md.

License firewall. A catalog's own license never touches mktg's code. For AGPL-licensed upstreams (e.g., postiz), we use transport: "http" and raw fetch; the upstream's npm package never gets installed. A package.json test asserts banned packages stay out of all dependency sections. mktg's license posture stays MIT-clean.

Runtime model. Catalogs are BYO: the user runs (or subscribes to) the upstream, mktg detects its env vars via mktg doctor, and mktg catalog info <name> --fields configured,missing_envs reports readiness. Hosted is the default path (less Docker complexity); self-host is documented as advanced.

CatalogUpstreamLicenseRuntime defaultRuntime fallbackEnv vars
postizgitroomhq/postiz-appAGPL-3.0 (firewalled via raw HTTP)https://api.postiz.com (hosted, Stripe-gated)Docker self-host (6 containers: Postgres + Redis + Temporal + Elasticsearch + app + worker)POSTIZ_API_KEY, POSTIZ_API_BASE

Adding a catalog: see AGENTS.md §Drop-in Catalog Contract. Catalogs extend mktg's publish adapters (social, email), research_adapters + mcp blocks (openseo: SEO data plane, OPENSEO_MCP_URL override), scheduling (future), and skills catalog without CLI code changes; they drop in via catalogs-manifest.json.

Distinct from Ecosystem. The Ecosystem table below lists local CLIs mktg shells out to (ffmpeg, firecrawl, gh). Catalogs are remote services with REST APIs. Different trust model, different install story, different version pinning.

Ecosystem

mktg orchestrates external tools but does not bundle them. mktg doctor detects missing tools and surfaces install commands.

CLIRoleInstall
firecrawl-cliWeb scrape, search, crawlnpm i -g firecrawl-cli + FIRECRAWL_API_KEY
ffmpegVideo assembly, encodingbrew install ffmpeg
remotionProgrammatic React videonpm i -g @remotion/cli
playwright-cliBrowser automationnpm i -g @playwright/cli
ghGitHub CLI (prefer gh-axi via /axi)brew install gh
gh-axiAgent-ergonomic GitHub CLI (AXI)npm i -g gh-axi or npx -y gh-axi
chrome-devtools-axiAgent-ergonomic browser CLI (AXI)npm i -g chrome-devtools-axi or npx -y chrome-devtools-axi
whisper-cliSpeech-to-textbrew install whisper-cpp
yt-dlpMedia downloadbrew install yt-dlp
summarizeText compressionnpm i -g @steipete/summarize
higgsfieldAI image + video generation (30+ models, Marketing Studio, Soul Characters)npm i -g @higgsfield/cli && higgsfield auth login (paid platform — optional)

MCP + Exa skills: Exa MCP for deep web research (wired via .mcp.json) plus first-class skills ported from exa-labs/agent-skills: exa-search, exa-contents, company-research, lead-generation, build-with-exa. Requires EXA_API_KEY (surfaced by mktg doctor).

Adding a new chained tool

  1. Add to the tools array in src/commands/doctor.ts
  2. Add a row to the Ecosystem table above
  3. Optionally ship a best-practices skill under skills/<tool>/ with a rules/ subdirectory
  4. Register the skill in skills-manifest.json

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

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.