Cogapp Markdown logo

Cogapp Markdown

Community
simonw
cogapp-markdown

Use cogapp to auto-generate sections of markdown documentation by embedding Python code that produces content. Use when a project needs to keep documentation in sync with code, such as embedding CLI --help output in README files, generating tables, or any content that should be derived from the code itself rather than manually maintained.

Overview

Publishersimonw
Repositoryskills
Skill namecogapp-markdown
Stars
43
Forks
4
Bundled files
Instructions only
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.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by simonw on GitHub. Read the source before you install it.

Installation

Install the Cogapp Markdown 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/simonw/skills/tree/main/cogapp-markdown
  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/simonw/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/cogapp-markdown .claude/skills/cogapp-markdown
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Cogapp Markdown 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 Cogapp Markdown 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 Cogapp Markdown 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.

cogapp for Markdown Documentation

Use cogapp to auto-generate sections of markdown files. Cog lets you embed Python code in markdown that produces output inline — the generated content lives in the file alongside the code that created it. Running cog -r regenerates the output, keeping docs in sync with code.

Install

bash
pip install cogapp

Or add "cogapp" to your [dependency-groups] dev dependencies in pyproject.toml.

Markdown Syntax

Use HTML comments as cog markers so the Python code is invisible when the markdown is rendered:

markdown
<!-- [[[cog
import cog
cog.outl("This content is generated by cog.")
]]] -->
This content is generated by cog.
<!-- [[[end]]] -->

The pattern is:

  1. <!-- [[[cog — opens the Python code block (hidden in rendered markdown)
  2. Python code that calls cog.out() or cog.outl() to produce output
  3. ]]] --> — closes the Python code block
  4. Generated output appears here (visible in rendered markdown)
  5. <!-- [[[end]]] --> — marks the end of the generated region

Running Cog

Regenerate all cog blocks in-place:

bash
cog -r docs/*.md

Or without installing — use uv run --with to run cog in a temporary environment:

bash
uv run --with cogapp cog -r docs/*.md

The -r flag replaces file contents in-place. Without it, cog writes to stdout.

Key Pattern: Embedding CLI --help Output

The most common use is keeping CLI documentation in sync with actual --help output.

For Click-based CLIs, use CliRunner to capture help output directly (no subprocess needed):

markdown
<!-- [[[cog
import cog
from mypackage import cli
from click.testing import CliRunner
runner = CliRunner()
result = runner.invoke(cli.cli, ["mycommand", "--help"])
help = result.output.replace("Usage: cli", "Usage: mypackage")
cog.out(
    "```\n{}\n```\n".format(help.strip())
)
]]] -->
<!-- [[[end]]] -->

The replace("Usage: cli", "Usage: mypackage") is needed because CliRunner reports the command name as cli instead of the real entry point name.

For argparse or other CLIs, use subprocess:

markdown
<!-- [[[cog
import cog
import subprocess
result = subprocess.run(["mycommand", "--help"], capture_output=True, text=True)
cog.out(
    "```\n{}\n```\n".format(result.stdout.strip())
)
]]] -->
<!-- [[[end]]] -->

GitHub Actions: Fail CI if Cog Hasn't Been Run

Add a step to your test workflow that checks all cog blocks are up to date. This fails CI if someone changes CLI behavior but forgets to regenerate the docs:

yaml
- name: Check if cog needs to be run
  run: |
    cog --check docs/*.md

cog --check exits with code 1 if any file would change. It does not modify files.

Use --check-fail-msg to tell developers how to fix it:

yaml
- name: Check if cog needs to be run
  run: |
    cog --check --check-fail-msg='Run "cog -r docs/*.md" to update' docs/*.md

If the project uses uv and cogapp is not a declared dependency, use uv run --with:

yaml
- name: Check if cog needs to be run
  run: |
    uv run --with cogapp cog --check docs/*.md

Other Patterns

Generating a Markdown Table

markdown
<!-- [[[cog
import cog
headers = ["Name", "Type", "Description"]
rows = [
    ["id", "int", "Primary key"],
    ["name", "str", "User name"],
]
cog.outl("| " + " | ".join(headers) + " |")
cog.outl("| " + " | ".join(["---"] * len(headers)) + " |")
for row in rows:
    cog.outl("| " + " | ".join(row) + " |")
]]] -->
<!-- [[[end]]] -->

Generating a Code Block

markdown
<!-- [[[cog
import cog
import json
data = {"key": "value", "count": 42}
cog.out("```json\n")
cog.outl(json.dumps(data, indent=2))
cog.out("```\n")
]]] -->
<!-- [[[end]]] -->

Multiple Blocks in One File

Each cog block is independent. You can have many blocks in one file — each gets its own <!-- [[[cog ... ]]] --> and <!-- [[[end]]] --> pair. Imports are shared across blocks within the same file.

Useful Flags

  • cog -r FILE — regenerate in-place
  • cog --check FILE — check without modifying (for CI)
  • cog --check --diff FILE — show what would change
  • cog -P FILE — use print() instead of cog.outl() in code blocks

Frequently asked questions

What does the Cogapp Markdown AI skill do?

Use cogapp to auto-generate sections of markdown documentation by embedding Python code that produces content. Use when a project needs to keep documentation in sync with code, such as embedding CLI --help output in README files, generating tables, or any content that should be derived from the code itself rather than manually maintained.

Why use Cogapp Markdown on TypingMind?

Because you install it once and use it with any model. Cogapp Markdown 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 Cogapp Markdown in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/simonw/skills/tree/main/cogapp-markdown. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Cogapp Markdown?

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 Cogapp Markdown?

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

Is the Cogapp Markdown AI skill free?

It is published on GitHub by simonw. 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 👇