Terminal Output logo

Terminal Output

Organization
swamp-club
terminal-output

Terminal output design system for swamp CLI commands. Use when creating or modifying any CLI command output, render function, or presentation layer code. Ensures consistent formatting, coloring, and structure across all swamp commands in both "log" (human-readable) and "json" (structured) output modes. Triggers on output files in src/presentation/output/, render functions, writeOutput usage, OutputMode handling, or any CLI command that produces terminal output.

Overview

Publisherswamp-club
Repositoryswamp
Skill nameterminal-output
Stars
647
Forks
46
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by swamp-club on GitHub. Read the source before you install it.

Installation

Install the Terminal Output AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/swamp-club/swamp/tree/main/.claude/skills/terminal-output
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/swamp-club/swamp.git /tmp/swamp
mkdir -p .claude/skills
cp -r /tmp/swamp/.claude/skills/terminal-output .claude/skills/terminal-output
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Terminal Output in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Terminal Output on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Terminal Output is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Terminal Output Design System

Consistent, human-readable terminal output for the swamp CLI.

Two Output Modes

Every command must support both modes, controlled by --json flag:

  • "log" (default) - Clean, colored, human-readable plain text
  • "json" - Structured JSON for scripting and automation

The mode is available as ctx.outputMode from createContext() in src/cli/context.ts.

Which Stream

stdout is the command's output. stderr is interaction and diagnostics.

Goes to stdoutGoes to stderr
writeOutput() prose (log mode)Interactive prompts
console.log(JSON…) (json mode)Spinners and progress indicators
A command's bare value (see below)LogTape records, warnings, errors

A few commands put a value on stdout — something a caller pipes, captures or redirects, not prose about the result:

  • swamp invite link and swamp first-rule — the URL, for | pbcopy
  • swamp vault read-secret — the secret bytes, for > key.pem

Those commands are listed in src/cli/stdout_contract.ts, which runCli consults to keep log records off their stdout. For them stdout is byte-exact: swamp-club#1768 removed even the trailing newline. Anything else written there is corruption, not clutter. Two bugs came from ignoring this — swamp-club#2254 (a log record ahead of the URL) and swamp-club#2260 (a confirmation prompt ahead of the secret).

When adding output, ask what it is, not where it is convenient. A question for the user is interaction: prompt through src/cli/prompt_helpers.ts, which writes to stderr. A wizard's narration is interaction too. Only the result belongs on stdout.

integration/prompt_stream_rules_test.ts pins every raw Deno.stdout.write(...) in src/; a new one fails that test unless it is the command's value. swamp-club#2259 tracks inverting the default so log-mode prose goes to stderr as well.

Architecture

src/cli/commands/<command>.ts     → Command logic, builds data object
src/presentation/output/<name>_output.ts → Render function, formats output
src/infrastructure/logging/logger.ts     → writeOutput() + LogTape loggers

Output File Pattern

Each command has a dedicated output file that exports:

  1. A data interface describing the output shape
  2. A render function that branches on OutputMode
typescript
import { bold, cyan, dim } from "@std/fmt/colors";
import { writeOutput } from "../../infrastructure/logging/logger.ts";
import type { OutputMode } from "./output.ts";

export interface ExampleData {
  name: string;
  type: string;
}

export function renderExample(data: ExampleData, mode: OutputMode): void {
  if (mode === "json") {
    console.log(JSON.stringify(data, null, 2));
  } else {
    const lines = [
      `${bold(cyan("Name:"))} ${bold(data.name)} ${dim(`(${data.type})`)}`,
    ];
    writeOutput(lines.join("\n"));
  }
}

Log Mode vs LogTape

See references/logtape.md for details on how LogTape and writeOutput() coexist and when to use each.

Key rule: Render functions use writeOutput() for user-facing output, never LogTape. LogTape is for debug/operational logging only.

Color Scheme

Import from @std/fmt/colors. Whether colors are emitted at all is decided once per invocation by applyColorPolicy in src/cli/context.ts, called from the top of runCli before the Cliffy command is constructed — early enough to reach --version and --help, which Cliffy answers during parsing and which never reach globalAction (swamp-club#2414). Colors are off when --no-color is passed, when NO_COLOR is set to any value including empty, or when stdout is not a terminal, so piped and redirected output carries no escape sequences.

Two things this does not cover: LogTape's pretty sink colors through its own colors option rather than this flag (see references/logtape.md), and the policy is process-wide, so a piped stdout also un-colors diagnostics on stderr.

ElementStyleExample
Section headers/keysbold(cyan(...))Created: Path:
Primary valuesbold(...)my-model
Sub-section headerscyan(...)Input Attributes:
Metadata/typesdim(...)(string) *required
Enum valuesdim(...)[a, b, c]
Type annotationsdim(...)(command/shell)
Pass indicatorgreen(...)PASSED, checkmark
Fail indicatorred(...)FAILED, cross
Separatorsdim("-")method - description

Layout Rules

Lines Array Pattern

Always build output as a string[] and join at the end:

typescript
const lines: string[] = [];
lines.push(`${bold(cyan("Header:"))} ${value}`);
// ...
writeOutput(lines.join("\n"));

Spacing

  • Blank line before each new section (Input Attributes, Methods, Jobs)
  • Blank line between entries in "validate all" / list-style output
  • Blank line before summary/result lines in multi-entry output
  • No blank lines between items within a section (e.g., between methods)

Indentation Hierarchy

Top-level key: value                    ← no indent
  Second level (attributes, items)      ← 2 spaces
    Third level (sub-sections)          ← 4 spaces
      Fourth level (sub-items)          ← 6 spaces

Shared Formatters

Reuse these exported functions from type_describe_output.ts:

  • formatSchemaAttributes(schema, indent) - JSON Schema to attribute lines
  • formatMethodLines(methods) - Method descriptions with argument attributes

Reuse toMethodDescribeData(), buildDataOutputSpecs(), and zodToJsonSchema() from src/cli/commands/type_describe.ts to convert domain objects to presentation data. Data output specs are built at the type level via buildDataOutputSpecs(resources, files), not per-method.

Validation Output Pattern

For pass/fail validation results:

typescript
const checkmark = "\u2713"; // ✓
const cross = "\u2717"; // ✗
const arrow = "\u2192"; // →

// Passing
lines.push(`  ${green(checkmark)} ${name}`);

// Failing
lines.push(`  ${red(cross)} ${name}`);
lines.push(`    ${red(arrow)} ${errorMessage}`);

// Result
lines.push(
  passed
    ? `${bold(cyan("Result:"))} ${green("PASSED")}`
    : `${bold(cyan("Result:"))} ${red("FAILED")}`,
);

JSON Mode Rules

  • Use console.log(JSON.stringify(data, null, 2)) directly
  • The data interface defines the JSON shape - keep it clean and consistent
  • Include all fields (even optional ones when present) for scripting consumers
  • No colors, no formatting - just the data

Testing

  • Test file: <name>_output_test.ts next to the output file
  • Capture console.log output by stubbing it
  • Use stripAnsiCode from @std/fmt/colors for color-aware assertions
  • Test both "json" and "log" modes
  • For JSON mode: parse output and assert field values
  • For log mode: assert key strings are present in stripped output
typescript
import { assertStringIncludes } from "@std/assert";
import { stripAnsiCode } from "@std/fmt/colors";

Deno.test("log mode shows expected content", () => {
  const logs: string[] = [];
  const originalLog = console.log;
  console.log = (msg: string) => logs.push(msg);
  try {
    renderExample(testData, "log");
    const combined = stripAnsiCode(logs.join("\n"));
    assertStringIncludes(combined, "Expected:");
  } finally {
    console.log = originalLog;
  }
});

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Terminal Output AI skill do?

Terminal output design system for swamp CLI commands. Use when creating or modifying any CLI command output, render function, or presentation layer code. Ensures consistent formatting, coloring, and structure across all swamp commands in both "log" (human-readable) and "json" (structured) output modes. Triggers on output files in src/presentation/output/, render functions, writeOutput usage, OutputMode handling, or any CLI command that produces terminal output.

Why use Terminal Output on TypingMind?

Because you install it once and use it with any model. Terminal Output is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Terminal Output in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/swamp-club/swamp/tree/main/.claude/skills/terminal-output. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Terminal Output?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Terminal Output?

As many as you like. As long as a model supports skills, you can use Terminal Output with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Terminal Output AI skill free?

It is published on GitHub by swamp-club. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇