Skip to content

Respect flat skill layouts — subdirectories are optional per spec #23

@philoserf

Description

@philoserf

Problem

The Agent Skills spec treats scripts/, references/, and assets/ as optional organizational directories. A valid skill can be completely flat:

my-skill/
├── SKILL.md
├── guide.md
├── extract.py
└── template.txt

The validator currently penalizes this layout in several ways:

  1. Root-level file warnings (structure/checks.go): Any file at root besides SKILL.md triggers an "unexpected file" warning, nudging authors toward subdirectories they may not need.

  2. Unknown directory warnings (structure/checks.go): Non-standard directories at root generate warnings suggesting they should be references/ or assets/, even though custom directory names are not spec violations.

  3. Orphan detection blind spot (structure/orphans.go): Orphan checking only inventories files inside references/, scripts/, and assets/. Root-level support files are invisible to orphan detection — unreferenced files at root are never flagged.

  4. "Non-standard" token accounting (structure/tokens.go): Files outside the three recognized directories are bucketed as "non-standard" with separate aggregate limits (25k soft / 100k hard). A flat skill with guide.md at root gets stricter treatment than the same file inside references/.

  5. Skill ratio penalty (structure/validate.go): If "non-standard" tokens exceed 10x "standard" tokens, the skill is flagged as possibly misconfigured. A flat skill with substantial reference material would hit this even though the layout is valid.

Proposed Changes

Treat recognized file types at root as first-class

  • .md files at root (beyond SKILL.md) should be treated equivalently to files in references/
  • .py, .sh, .js, .ts files at root should be treated equivalently to files in scripts/
  • Other files at root should be treated equivalently to files in assets/
  • Remove or downgrade the "unexpected file at root" warnings for files that have recognized extensions

Extend orphan detection to root-level files

  • Include root-level support files in the orphan inventory
  • Apply the same BFS reachability check from SKILL.md to these files

Unify token accounting

  • Count root-level support files under the same limits as their subdirectory equivalents (e.g., a root guide.md counts toward reference token limits, not "non-standard" limits)
  • Adjust checkSkillRatio() to not penalize flat layouts

Preserve hints without penalizing

  • It's still useful to inform authors that subdirectories exist for organization, but this should be Info-level, not Warning-level, and only when there are enough files that organization would genuinely help (e.g., 5+ support files at root)

Context

The spec explicitly says:

A skill is a directory containing at minimum a SKILL.md file

and presents the three subdirectories under "Optional directories." The validator should validate the spec, not enforce a preference for structured layouts over flat ones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions