Skip to content

Tech Debt: Consolidate skill rendering/parsing paths and harden TOML safety #1976

@RbBtSn0w

Description

@RbBtSn0w

Summary

Track non-PR-specific technical debt in skill/command rendering paths. These issues were identified during review of #1971 but are not introduced by #1971 and should be handled separately.

Why this issue exists

Current behavior works for most paths, but rendering/parsing responsibilities are duplicated across modules (agents.py, presets.py, init-time skill generation). This increases drift risk and makes edge-case handling inconsistent.

Scope (non-blocking for #1971)

  1. src/specify_cli/agents.py — TOML prompt rendering should safely handle triple-quotes in body
  • render_toml_command() uses TOML multiline strings with """ delimiters.
  • If body includes """, output can become invalid TOML.
  • Add escaping or safer serialization strategy.
  1. src/specify_cli/agents.py — avoid in-place mutation in _adjust_script_paths
  • Method currently mutates passed frontmatter object.
  • Consider defensive copy to reduce side-effect risk during future refactors.
  1. src/specify_cli/presets.py — deduplicate frontmatter parsing logic
  • _register_skills() and _unregister_skills() each manually parse frontmatter.
  • Prefer shared parser (CommandRegistrar.parse_frontmatter) or a shared utility.
  1. Consolidate skill rendering logic across code paths
  • Skill generation currently exists in multiple places (init conversion, extensions, presets, packaging scripts).
  • Define one canonical renderer contract and re-use it to prevent behavior drift.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions