Skip to content

feat(discovery): build_skill_md renderer for /skill.md agent surface#5

Merged
vvillait88 merged 4 commits intomainfrom
feat/skill-md-discovery
May 2, 2026
Merged

feat(discovery): build_skill_md renderer for /skill.md agent surface#5
vvillait88 merged 4 commits intomainfrom
feat/skill-md-discovery

Conversation

@vvillait88
Copy link
Copy Markdown
Contributor

Summary

  • Python port of node-commerce 1.2.0's `buildSkillMd` — renders a Claude-Skill-compatible `/skill.md` manifest with YAML frontmatter + markdown body.
  • Strictly agent-facing data: rails accepted, compatible clients per rail, identity requirements as outcomes, shipping policy, endpoints, triggers, support links. No internal posture (`fail_open`, mount strategy, KYC vendor, defense parameters, idempotency construction) leaks.
  • Per-rail compatible-clients table sources from the same SDK constant (`compatible_clients_by_rails`, extracted from `challenge/agent_instructions.py`) that drives the live 402 body's `compatible_clients` field — single source of truth across surfaces.
  • Adds `/skill.md` to `DEFAULT_DISCOVERY_PATHS` so the existing noindex middleware / discovery-path predicate auto-recognizes the new surface.
  • Updates `README.md` + `CLAUDE.md` to document the new builder.
  • Bump to 1.2.0 to match node-commerce parity.

Test plan

  • 35 unit tests covering every section, optional fields, output hygiene, and the no-internal-disclosure boundary
  • `uv run ruff check .` clean
  • `uv run ruff format --check .` clean
  • `uv run ty check` clean
  • `uv run vulture` clean
  • Coverage 95.38% (over 95% threshold)
  • CI green

vvillait88 and others added 4 commits May 2, 2026 09:38
Adds a new discovery builder mirroring node-commerce 1.2.0 — emits a
Claude-Skill-compatible manifest (YAML frontmatter + markdown body)
describing the merchant's agent-facing contract: payment rails,
compatible clients per rail, identity requirements as outcomes, shipping
policy, endpoints, triggers, support links.

Renders strictly agent-facing data — no fail_open, no mount-strategy
names, no KYC vendor names, no defense parameters, no idempotency
construction shape. Internal posture stays in merchant runtime config.

The compatible-clients-per-rail table sources from the same SDK constant
(compatible_clients_by_rails, extracted from challenge/agent_instructions.py)
that drives the live 402 body's compatible_clients field — single source
of truth across surfaces.

Adds /skill.md to DEFAULT_DISCOVERY_PATHS so the existing noindex
middleware / discovery-path predicate auto-recognizes the new surface.

Bump to 1.2.0 to match node-commerce parity.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors node-commerce — addresses spec violations + parity issues from
end-to-end review against https://agentskills.io/specification:

P0 — spec violations:
- description / license / compatibility / allowed-tools / metadata-values now
  emitted as YAML double-quoted scalars. Fixes the colon / quote / newline
  parse failure the spec explicitly warns about.
- metadata.version emitted as quoted string ("1") not int (1). Spec requires
  metadata values to be strings.

P1 — validation + exports:
- Validate name against the spec regex (1-64 chars, lowercase alphanumeric +
  hyphens, no leading / trailing / consecutive hyphens).
- Validate description length ≤1024 + non-empty.
- Validate compatibility length ≤500.
- Title-block parity fix: tagline + intro now join with blank lines instead
  of being glued together (previously diverged from node output).
- Re-export RailKey + compatible_clients_by_rails from agentscore_commerce
  .discovery (added to __all__).

P2 — additional spec fields:
- Surface optional license, compatibility, allowed_tools frontmatter fields.
- Move homepage from top-level to metadata.homepage (spec-compliant).

P3 — edge cases:
- Drop compatible_clients overrides for rails not in accepted_rails.
- Escape pipe characters in markdown table cells.
- Add /SKILL.md (uppercase) to DEFAULT_DISCOVERY_PATHS for canonical-cased
  alias.

Tests: 49 cases covering spec violations + edge cases + validation throws.
Coverage 95.45% (over 95%).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirror node-commerce parity-lock test. End-to-end review flagged version:
0 as potential parity drift; verified both pass 0 through unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors node-commerce CodeQL fix. Prior implementation escaped \`|\` but not
\`\\\`, so an input like \`a\\|b\` rendered as literal-backslash + cell-terminator
— breaking the markdown table row.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vvillait88 vvillait88 merged commit 5d9f219 into main May 2, 2026
7 checks passed
@vvillait88 vvillait88 deleted the feat/skill-md-discovery branch May 2, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant