Skip to content

Support custom directory names via --allow-dir flag #47

@mpolce-squareup

Description

@mpolce-squareup

Problem

Skills with domain-specific directory layouts (e.g. domains/, databases/) are incorrectly flagged by the token ratio check as "not structured as a skill" because only references/, scripts/, and assets/ are recognized as standard directories.

The countOtherFiles function in structure/tokens.go counts all files in unrecognized directories as "non-standard" tokens. When these exceed 25,000 tokens and are 10× the standard content, the checkSkillRatio check in validate.go emits a blocking error:

Error: this content doesn't appear to be structured as a skill — there are 92,973 tokens of non-standard content but only 5,432 tokens in the standard skill structure

This blocks skills that intentionally organize content into custom directories (e.g. a risk analysis skill with a domains/ directory containing per-domain reference files).

Proposed fix

Add an --allow-dir CLI flag (repeatable) that treats named directories as standard:

  • Excludes them from the non-standard ("other") token count in countOtherFiles
  • Suppresses the "unknown directory" structural warning in CheckStructure

Implementation

A working implementation with tests is available at: https://github.com/mpolce-squareup/skill-validator/tree/mpolce/allow-custom-dirs

Changes:

  • structure/validate.go: Add AllowDirs []string to Options
  • structure/tokens.go: countOtherFiles skips directories in AllowDirs
  • structure/checks.go: CheckStructure skips warning for directories in AllowDirs
  • cmd/check.go: Add --allow-dir StringSliceVar flag

All existing tests pass + 7 new tests added.

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