richfrem/agent-plugins-skills / plugins/agent-extension-authoring/.apm/skills/packaging-copilot-cowork-plugins
packaging-copilot-cowork-plugins
VerifiedCreates, validates and prepares Microsoft 365 Copilot Cowork plugin App Packages containing Agent Skills and optional remote MCP connectors. Use when scaffolding, converting, validating, provisioning, packaging or sharing a Cowork plugin. Not for APM package creation or installation (use packaging-with-apm).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.2 KB |
| evals/evals.json | config | 1.6 KB |
| evals/task-success.json | config | 3.1 KB |
| packaging-copilot-cowork-plugins-flow.mmd | other | 651 B |
| references/acceptance-criteria.md | markdown | 3.1 KB |
| references/cowork-capabilities-and-limits.md | markdown | 3.7 KB |
| references/cowork-deterministic-vs-generative.md | markdown | 3.5 KB |
| references/cowork-package-lifecycle.md | markdown | 13.9 KB |
| references/cowork-sandbox-findings.md | markdown | 7.0 KB |
| references/cowork-test-playbook.md | markdown | 3.6 KB |
| references/skill-install-routes.md | markdown | 4.7 KB |
| scripts/bundle_skill_companions.py | script | 19.8 KB |
| scripts/cowork_content_checks.py | script | 9.9 KB |
| scripts/cowork_markdown_utils.py | script | 4.8 KB |
| scripts/cowork_package_constants.py | script | 5.2 KB |
| scripts/package_cowork_plugin.py | script | 21.0 KB |
| scripts/scaffold_cowork_package.py | script | 13.4 KB |
| tests/test_bundle_and_scaffold.py | script | 10.9 KB |
| tests/test_content_checks.py | script | 8.9 KB |
| tests/test_package_cowork_plugin.py | script | 9.2 KB |
scripts/cowork_markdown_utils.py
View on GitHub"""
Copilot Cowork Markdown utilities
=================================
Purpose:
Shared, dependency-free Markdown helpers for the Cowork packaging scripts: walk
lines while respecting code fences, build GitHub-style heading anchors, and parse
the small YAML subset used in SKILL.md frontmatter (plain, quoted and folded scalars).
Key Input Dependencies:
Python standard library only; cowork_package_constants.py in this skill.
Key Functions:
normalize_newlines, iter_lines, first_heading, github_slug, heading_anchors,
split_frontmatter, parse_frontmatter.
Output:
Plain strings, sets and dictionaries consumed by cowork_content_checks.py and
bundle_skill_companions.py. Nothing is written to disk.
"""
from __future__ import annotations
import re
from typing import Dict, Iterator, List, Optional, Set, Tuple
from cowork_package_constants import CODE_FENCE_PREFIX, FRONTMATTER_DELIMITER
HEADING_PATTERN = re.compile(r"^(#{1,6}) +(.+?)\s*$")
FOLDED_MARKERS = (">", ">-", ">+", "|", "|-", "|+")
SLUG_STRIP_PATTERN = re.compile(r"[^\w\- ]")
# Convert Windows and old-Mac line endings to LF so line-based parsing is uniform.
def normalize_newlines(text: str) -> str:
"""Return text with LF line endings only."""
return text.replace("\r\n", "\n").replace("\r", "\n")
# Yield each line with a flag that is True while inside a fenced code block.
def iter_lines(text: str) -> Iterator[Tuple[bool, str]]:
"""Yield (in_code_block, line) pairs; fence lines are reported as code."""
in_fence = False
for line in normalize_newlines(text).split("\n"):
if line.lstrip().startswith(CODE_FENCE_PREFIX):
yield True, line
in_fence = not in_fence
else:
yield in_fence, line
# Return the text of the first level-one heading outside code fences.
def first_heading(text: str) -> Optional[str]:
"""Return the first H1 title, or None when the document has none."""
for in_code, line in iter_lines(text):
if not in_code and line.startswith("# "):
return line[2:].strip()
return None
# Build the anchor GitHub generates for a heading title.
def github_slug(title: str) -> str:
"""Return the GitHub-style anchor for a heading title."""
cleaned = SLUG_STRIP_PATTERN.sub("", title.replace("`", "").lower())
return cleaned.replace(" ", "-")
# Collect every heading anchor in a document, ignoring code fences.
def heading_anchors(text: str) -> Set[str]:
"""Return the set of heading anchors defined by a Markdown document."""
anchors: Set[str] = set()
for in_code, line in iter_lines(text):
if in_code:
continue
match = HEADING_PATTERN.match(line)
if match:
anchors.add(github_slug(match.group(2)))
return anchors
# Separate leading YAML frontmatter from the Markdown body.
def split_frontmatter(text: str) -> Tuple[Optional[str], str]:
"""Return (frontmatter_text, body); frontmatter_text is None when absent."""
lines = normalize_newlines(text).split("\n")
if not lines or lines[0].strip() != FRONTMATTER_DELIMITER:
return None, "\n".join(lines)
for index in range(1, len(lines)):
if lines[index].strip() == FRONTMATTER_DELIMITER:
return "\n".join(lines[1:index]), "\n".join(lines[index + 1:])
return None, "\n".join(lines)
# Remove surrounding single or double quotes from a scalar value.
def _unquote(value: str) -> str:
"""Strip one matching pair of surrounding quotes."""
if len(value) >= 2 and value[0] == value[-1] and value[0] in "'\"":
return value[1:-1]
return value
# Read a block scalar's indented continuation lines, folding them with spaces.
def _read_block(lines: List[str], start: int) -> Tuple[str, int]:
"""Return (folded_text, next_index) for the indented block beginning at start."""
parts: List[str] = []
index = start
while index < len(lines) and (not lines[index].strip() or lines[index].startswith((" ", "\t"))):
if lines[index].strip():
parts.append(lines[index].strip())
index += 1
return " ".join(parts), index
# Parse top-level `key: value` pairs, including quoted and folded scalars.
def parse_frontmatter(frontmatter: str) -> Dict[str, str]:
"""Parse the YAML subset used by SKILL.md frontmatter into a flat dictionary."""
result: Dict[str, str] = {}
lines = normalize_newlines(frontmatter).split("\n")
index = 0
while index < len(lines):
line = lines[index]
match = re.match(r"^([A-Za-z_][\w-]*):\s*(.*)$", line)
if not match:
index += 1
continue
key, value = match.group(1), match.group(2).strip()
if value in FOLDED_MARKERS or not value:
folded, index = _read_block(lines, index + 1)
result[key] = folded
continue
result[key] = _unquote(value)
index += 1
return result
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |