Add License Header

Add the project's canonical SPDX license header to a requested source file or to source files under a requested directory. Use when asked to add or ensure license headers on files that may not already have one.

sociotechnica-org Updated

File contents

Add License Header

  1. Determine the target files from the request:

    • For a file path, target that file.
    • For a directory, target every file beneath it whose extension matches the project's source extensions.
  2. Read the first 20 lines of every target file and look for SPDX-License-Identifier.

  3. If that string is present, skip the file. Never add a second SPDX license header.

  4. Otherwise, insert these exact lines at the very top of the file, before all existing content:

    // SPDX-License-Identifier: Apache-2.0
    // Copyright (c) 2026 Acme Corp
    

    Always put the header at the absolute beginning; never place it after a shebang, comment, or any other existing content.

  5. Report the files changed and the files skipped because they already had a header.

sociotechnica-org/skillmaker-studio/tree/main/skills/william-draft-skill-md/runs/87a630d0-dd1e-48b6-9372-52c07a40f811/artifacts/output commit 70782e41b1

Frequently asked questions

npx skillmds@latest add sociotechnica-org/add-license-header-2