Determine target files. From the user's request, resolve the set of files to process -- either a single path or every source file under a given directory.
Check each file for an existing header. Read the first 20 lines of each target file and look for the string
SPDX-License-Identifier.Skip files that already have a header. If
SPDX-License-Identifierappears in the first 20 lines, do not touch that file. Never add a second header to a file that already has one.Insert the header at the very top. For files that lack a header, insert these exact two lines as the first two lines of the file, above all existing content (including shebangs, comments, or blank lines):
// SPDX-License-Identifier: Apache-2.0 // Copyright (c) 2026 Acme CorpThe header must always be the very first thing in the file -- never insert it after existing content.
Report results. List which files were changed and which were skipped (already had a header).
Add License Header
Add the project's canonical SPDX license header to source files that are missing one. Use when asked to add a license header to a file or directory, e.g. "add the license header to src/foo.ts" or "make sure every file in src/ has our license header."
Add License Header by sociotechnica-org · e43eda6
npx skillmds@latest add sociotechnica-org/add-license-header-3 File contents
---name: add-license-header-3description: Add the project's canonical SPDX license header to source files that are missing one. Use when asked to add a license header to a file or directory, e.g. "add the license header to src/foo.ts" or "make sure every file in src/ has our license header."---1. **Determine target files.** From the user's request, resolve the set of files to process -- either a single path or every source file under a given directory.2. **Check each file for an existing header.** Read the first 20 lines of each target file and look for the string `SPDX-License-Identifier`.3. **Skip files that already have a header.** If `SPDX-License-Identifier` appears in the first 20 lines, do not touch that file. Never add a second header to a file that already has one.4. **Insert the header at the very top.** For files that lack a header, insert these exact two lines as the first two lines of the file, above all existing content (including shebangs, comments, or blank lines): ``` // SPDX-License-Identifier: Apache-2.0 // Copyright (c) 2026 Acme Corp ``` The header must always be the very first thing in the file -- never insert it after existing content.5. **Report results.** List which files were changed and which were skipped (already had a header).
sociotechnica-org/skillmaker-studio/tree/main/skills/william-draft-skill-md/runs/b78fca9b-95d0-4458-b592-a3aba0afda8e/artifacts/output commit e43eda6b07
Frequently asked questions
Run npx skillmds@latest add sociotechnica-org/add-license-header-3 in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Add the project's canonical SPDX license header to source files that are missing one. Use when asked to add a license header to a file or directory, e.g. "add the license header to src/foo.ts" or "make sure every file in src/ has our license header." It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
sociotechnica-org (@sociotechnica-org) published this skill. Their other Agent Skills are listed on their SkillMD profile.