Apply the Apache License 2.0: a header in each source file, a LICENSE in every crate, module, and package, and a NOTICE of third-party software and licenses.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Apply Apache License?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/jabbott-iii-apply-apache-license-doctrina)
---
name: apply-apache-license
description: "Apply the Apache License 2.0: a header in each source file, a LICENSE in every crate, module, and package, and a NOTICE of third-party software and licenses."
argument-hint: "[pieces, such as \"headers notice\"; empty means all three] [check]"
disable-model-invocation: true
---
# Apply the Apache License 2.0
Requested: `$ARGUMENTS` (empty means all three pieces).
This skill puts a project under the Apache License, Version 2.0, the way the license's own appendix
describes, and keeps it there. It copies the license's text into every part of the project that is
built or published on its own, marks each source file the project wrote with its copyright holder
and license, and keeps a notice of the third-party software the project uses, with each license.
Run it again after a dependency changes or a file is added, and it updates what it wrote instead of
replacing it.
| Piece | Argument | Files | What it does |
| --- | --- | --- | --- |
| License copies | `license` | `LICENSE` in the root and in each unit's folder, each manifest's license field, and each README's license section | Gives every unit the license's full text, and tells each registry the license |
| Third-party notice | `notice` | `NOTICE` in the root and in each unit's folder, and `third-party-licenses/` | Lists the third-party software the project uses, with each version, license, and copyright, and keeps each license's text |
| Source headers | `headers` | each source file the project wrote | Puts the license's header, with the copyright holder and year, at the top of the file |
A unit is anything built or published on its own: a crate, a Go module, a Gradle or Maven
module, an npm or Python package, a gem, a library, or an app. Add `check` to the arguments to
change nothing and report only what is missing or out of date.
This skill follows the license's instructions and records facts. It doesn't settle legal
questions, such as whether a dependency's license allows the way the project uses it. It stops
and asks the user, who may need a lawyer for the answer.
Bold names are values from the "Project details" of the adopted rules:
- the **Project name** from `writing.md`;
- **Git access**, **Done checks**, **Never commit**, **Push effect**, **Scopes**, and
**Changes that travel together** from `commits.md`;
- **Platform**, **Manifests**, **Tree commands**, and **Approved exceptions** from
`dependencies.md`, where it is adopted;
- the units in the language rules: **Crates** and **Published crates** from `rust.md`;
**Modules** from `kotlin.md`, `java.md`, `android.md`, `kotlin-multiplatform.md`, and `lua.md`;
**Published modules** from `go.md`, `java.md`, and `kotlin.md`; **Packages** from `go.md`,
`python.md`, `typescript.md`, and `php.md`; **Published packages** from `python.md`,
`typescript.md`, `php.md`, and `csharp.md`; **Projects** from `csharp.md`; **Components** and
**Published libraries** from `c.md` and `cpp.md`; **Published rocks** from `lua.md`;
**Code layout** from `ruby.md` and `perl.md`; **Published gems** from `ruby.md`;
**Published distributions** from `perl.md`; **Packages and layout** from `flutter.md`; and
**Targets and modules** from `swift.md`;
- **Check commands** from the language rules; **Code generation** from `flutter.md` and `go.md`;
**Release** from `android.md`, `swift.md`, `flutter.md`, and `kotlin-multiplatform.md`;
**Release builds** from `go.md`; and **Deployment** from `csharp.md`;
- **Materials** and **License** from `teaching-materials.md`, where it is adopted;
- the **Decision log** from `roadmap-and-docs.md`, where it is adopted.
Where a value doesn't exist because a rule isn't adopted, work from what the repository has, and
say so in the report. `writing.md` governs the text of every file this skill writes.
## Ground rules
These hold for the whole run, and override anything a later step seems to allow:
- **Never relicense code.** Only a work's copyright holders can choose its license. Add the header
only to files the project wrote, and only after the user confirms, in step 3, that the holders
agree to Apache 2.0. Where the repository already has another license, or files carry another
license's header, stop and ask. Moving code to Apache 2.0 is the user's decision, and it needs
the agreement of everyone who holds copyright in that code.
- **Leave third-party notices alone.** Never add the Apache header to code the project didn't
write, such as vendored folders (copies of other projects kept in this repository), Git
submodules, and copied files. Never change or remove the copyright and license notices in that
code. The Apache Software Foundation (ASF) sets the same rule for its own projects, and section
4(c) of the license requires anyone who redistributes Apache-licensed code to keep its notices.
- **Never invent a holder.** The copyright holder comes from the user, or from the project's
existing `NOTICE` or headers once the user confirms it. Never take a name or an email address
from `git log`: a commit's author may not hold the copyright, and an address in the history is
personal data. Dates from Git are fine.
- **Copy license texts; never retype them.** `LICENSE` is the file at
`https://www.apache.org/licenses/LICENSE-2.0.txt`, fetched in this session, byte for byte. Each
third-party license comes from that package's own files at the version the project locks, never
from memory or a generic template, because the copyright lines differ from package to package.
- **Change only comments.** A header goes into a comment and changes no code. Keep each line that
must come first above it (step 6), and prove the change with the **Check commands**.
- **Make only read-only network calls:** fetching the license text, and reading package metadata
from registries. Ask before you install a tool, and follow `dependencies.md` for it where that
rule is adopted.
## 1. Set the scope
- The arguments name pieces by the **Argument** column, such as `headers notice`. Empty, or `all`,
means all three. `check` can go with any of them: run steps 2 and 9 only, and change nothing.
- Run `git status` before you start. If the tree has uncommitted changes you didn't make, leave
them alone and tell the user.
- Tell the user in one or two sentences which pieces you will do and in what order, and make a task
list whose last item is "Verify and report". Do `license` first, because the notice and the
headers point to it. Do `headers` last: it touches the most files, and its diff is easiest to
review on its own.
## 2. Survey the repository
1. **Read the adopted rules** in `.claude/rules/`, and note each value this run needs.
2. **Find the current license.** Look for `LICENSE`, `LICENCE`, `COPYING`, and `NOTICE`, with any
suffix such as `.md` or `-MIT`, in the root and in every unit's folder. Read each manifest's
license field, each README's license section, and the headers already in the files. This command
counts the lines that name each license with an SPDX identifier (a Software Package Data
Exchange identifier, a one-line, machine-readable name for a license):
```bash
git grep -h -I -o 'SPDX-License-Identifier: .*' | sort | uniq -c
```
It prints a count and an identifier per line, such as `2 SPDX-License-Identifier: Apache-2.0`,
and nothing when no file has one. Also search for headers without one, such as
`git grep -l -I 'Licensed under'`. Then sort the repository into one of three cases:
- **No license yet:** go on, once the user answers step 3.
- **Apache 2.0 already:** update what is missing or out of date.
- **Another license for the project's own code, or a mix of licenses:** stop, and ask the user
how to go on (see "Ground rules"). Third-party code under its own licenses doesn't count.
3. **List the units** from the values above, or, without them, from the manifests that
`git ls-files` lists: `Cargo.toml`, `go.mod`, `package.json`, `pyproject.toml`,
`build.gradle.kts`, `build.gradle`, `pom.xml`, `*.csproj`, `*.gemspec`, `composer.json`,
`*.rockspec`, `Makefile.PL`, `pubspec.yaml`, `Package.swift`, and the build files of each library
and app. For each unit, note its folder, where it is published, and what its release contains,
from the **Release**, **Release builds**, or **Deployment** where they exist:
| Release | Third-party code inside it |
| --- | --- |
| A library's source package: a crate, a Go module, an npm package, a Python source distribution, a gem, or a NuGet package of the project's own code | Only what is vendored or copied into the unit's folder. Users' package managers download its dependencies separately |
| A compiled program or app, a static library, a JavaScript bundle, a Python wheel with native libraries inside, a JAR that bundles its dependencies, or a container image | Everything compiled, linked, or bundled into it |
This table decides what each unit's `NOTICE` lists. The ASF's licensing guide says the
`LICENSE` and `NOTICE` in a release "must exactly represent the contents of the distribution
they reside in."
4. **Sort the files** that `git ls-files` lists, leaving out the **Never commit** paths:
| Kind | How to recognize it | Header |
| --- | --- | --- |
| The project's own source | Code, scripts, build files, continuous integration (CI) workflows, stylesheets, templates, and config files that allow comments | Yes |
| Third-party | Vendored folders, Git submodules (`git submodule status` lists them), files with another holder's copyright or another license, and code copied from elsewhere, often with a comment that names its source | Never |
| Generated | A marker such as Go's `// Code generated … DO NOT EDIT.`, `@generated`, or `<auto-generated>`, or a path in the **Code generation** | No. Put the header in the generator's template instead, where the project owns the text |
| No comment syntax | JSON, lock files, images, fonts, and other binary files | No. REUSE (step 7) can cover them |
| Exact bytes matter | Test fixtures and data whose exact content a test compares, and empty files | No |
| Short documents | `README`, `CHANGELOG`, `CONTRIBUTING`, and other prose | Only if the user says so in step 3. The ASF exempts short informational text files like these |
| Teaching materials | The **Materials** | Only as the **License** says; never the Apache header unless it names Apache 2.0 |
5. **List the third-party software.** Start from the **Tree commands** and the **Manifests**, or
from each package manager's own listing where `dependencies.md` isn't adopted. Add what no
package manager lists: vendored code, submodules, copied code, and fonts, images, and other
files from other projects. Leave out the **Platform**. For each component, note:
- its name and the exact version the lock file pins;
- where it comes from: a registry, or a URL;
- which units use it, and whether each unit's release contains it (the table in item 3);
- whether it is needed to run the code, or only to build or test it;
- its license and copyright, read as the next table shows, then confirmed against its files.
| Ecosystem | License from the metadata | License files |
| --- | --- | --- |
| Cargo | `license` and `license_file` for each package in `cargo metadata --format-version 1 --locked` | The folder that holds each package's `manifest_path` |
| Go | None: `go.mod` has no license field | The folder that `go list -m -json all` prints as each module's `Dir`, after `go mod download` |
| npm | `license` in each `node_modules/<package>/package.json` | That package's folder |
| Python | `License-Expression` from `importlib.metadata`, or `License` and the `License ::` classifiers in older metadata | The files that `License-File` names, in the package's `.dist-info/licenses/` |
| Maven and Gradle | The `<licenses>` element in each POM, in the local repository or Gradle's cache | The sources JAR, or `META-INF/` in the JAR |
| NuGet | The `<license>` element in each `.nuspec`, in the global packages folder | That package's folder |
| RubyGems | `gem specification <name> licenses` | The gem's folder; `gem contents <name>` lists its files |
| Composer | `composer licenses` | `vendor/<vendor>/<package>/` |
| Swift Package Manager | None | The checkout in `.build/checkouts/` |
| pub | None | The folder that `.dart_tool/package_config.json` gives as each package's `rootUri` |
| LuaRocks | `license` in the rockspec's `description` | The installed rock's folder |
| CPAN | `license` in each distribution's `META.json` | The distribution's folder |
Flag each component for the user when:
- its metadata has no license, or says `UNKNOWN`, `NOASSERTION`, or `SEE LICENSE IN …`;
- its metadata and its license files disagree, or it has no license file;
- its license isn't in Category A of the
[ASF's third-party license policy](https://www.apache.org/legal/resolved.html).
That policy is written for ASF projects, so use it as a reference, not a ruling. Category A
holds the licenses ASF products may include, such as MIT, BSD-2-Clause, BSD-3-Clause, ISC,
Apache-2.0, and Zlib. Category B holds those they may include only in compiled form and
with a label, such as MPL-2.0, EPL-2.0, and CDDL-1.0. Category X holds those they may not
include, such as the GPL, LGPL, and AGPL families, SSPL-1.0, BUSL-1.1, and licenses that
forbid commercial use;
- it is third party but not in the **Approved exceptions**, where `dependencies.md` is
adopted. That rule's "Dependencies already here" section says what to tell the user.
Record a choice of licenses, such as `MIT OR Apache-2.0`, as the package declares it, and keep
every license file it ships. Choosing one of them is the user's decision.
6. **Show the survey** in a short table: the license found, each unit and what its release
contains, the count of files of each kind from item 4, the third-party components, and each flag.
## 3. Ask what only the user can decide
Ask in one message, about the pieces in scope only, with a proposed answer for each, so the user
can accept it in a word:
| Question | Proposed answer |
| --- | --- |
| Who holds the copyright, written exactly as it should appear? | The holder in the existing `NOTICE` or headers, if there is one. Otherwise, none: the user names it. Some projects with many contributors and no contributor agreement write "The <project> Authors" and keep an `AUTHORS` file |
| Do all copyright holders of the project's own code agree to license it under Apache 2.0? | Only the user can answer. No header goes in until they confirm it |
| Which year goes in each header? | The year the file was first committed, left unchanged afterward |
| Which form of header: the license's full notice with an `SPDX-License-Identifier` line, the full notice alone, or the copyright and SPDX lines alone? | The full notice with the SPDX line |
| Do Markdown and other prose documents get headers? | No |
| Does `NOTICE` also list software that releases don't contain: dependencies that users' package managers download, and tools used only to build or test? | Yes, in a section of its own after the software releases contain, marked as not included. Section 4(d) of the license makes everyone who redistributes the project carry the notices in `NOTICE` that apply to what they distribute. The ASF keeps its own `NOTICE` files to what the law requires, because each addition burdens them; answer no to do the same |
| Should the project follow the REUSE specification, so that a tool can check every file's license? | No, unless the project wants that check |
| For each flagged component: keep it, replace it, or remove it? | Keep it for now, and list it in the report. Changing a dependency is a change of its own |
Where `roadmap-and-docs.md` is adopted, offer to record the license, the holder, and the header
form in the **Decision log**.
## 4. License copies (`license`)
1. **Fetch the license text** and check it:
```bash
curl -fsSL https://www.apache.org/licenses/LICENSE-2.0.txt | sha256sum
```
On December 3, 2026, the file was 11,358 bytes in 202 lines, starting with a blank line, and
the command printed:
```text
cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 -
```
On macOS, use `shasum -a 256` in place of `sha256sum`. If the hash differs, compare the new
text with the old before you use it, and tell the user.
2. **Write the root `LICENSE`** from that text, unchanged.
- Keep the name `LICENSE`, with no extension. GitHub, npm, and pkg.go.dev all recognize it.
Go also copies a file named exactly `LICENSE` from the repository's root into the module
archive of a Go module in a subfolder that has none of its own.
- Where the repository already has the license as `LICENSE.txt` or `LICENSE.md`, keep that
name, and ask before you rename it, because links may point to it.
- Add nothing to it. GitHub identifies a repository's license by comparing this file with the
license's text, through the Licensee library, so added text can stop it from recognizing the
license. Third-party license texts go in `third-party-licenses/` (step 5).
3. **Copy `LICENSE` into each unit's folder** that isn't the root, byte for byte. Use a copy, not
a symbolic link: Git on Windows checks a link out as a small text file that holds its target's
path unless symbolic links are turned on.
4. **Set each manifest's license field:**
| Manifest | Field |
| --- | --- |
| `Cargo.toml` | `license = "Apache-2.0"`, once in `[workspace.package]`, and `license.workspace = true` in each crate. Use `license`, not `license-file`, which Cargo's documentation keeps for nonstandard licenses |
| `package.json` | `"license": "Apache-2.0"` |
| `pyproject.toml` | `license = "Apache-2.0"` and `license-files = ["LICENSE", "NOTICE"]`, as Python Enhancement Proposal (PEP) 639 describes. Remove the `License ::` classifiers, which PEP 639 deprecates |
| `*.gemspec` | `spec.license = "Apache-2.0"` |
| `composer.json` | `"license": "Apache-2.0"` |
| `*.csproj`, or `Directory.Build.props` for all of them | `<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>` |
| `pom.xml`, or the POM that a Gradle build publishes | A `<license>` in `<licenses>`, with `<name>Apache-2.0</name>` and `<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>` |
| `*.rockspec` | `license = "Apache-2.0"` in `description` |
| `Makefile.PL` | `LICENSE => 'apache_2_0'`, the license's name in CPAN::Meta |
| `go.mod`, `Package.swift`, `pubspec.yaml`, and C and C++ build files | None. Their tools and registries read the `LICENSE` file |
5. **Update each README's license section,** which the language rules ask every published unit's
README to have: "Licensed under the Apache License, Version 2.0", with links to the unit's
`LICENSE` and `NOTICE`.
6. **Put both files in each package.** npm always includes `LICENSE`, and the `license-files`
above put the files into Python's packages, but other builds need it said. A JAR, for example,
holds `LICENSE` and `NOTICE` only where the build copies them into its `META-INF/`. Step 9
checks every package.
## 5. Third-party notice (`notice`)
### Write each `NOTICE`
Write the root `NOTICE` as plain text, the "NOTICE text file" that section 4(d) of the license
names. Start it with the **Project name** and the copyright line, then list the components:
```text
Example Project
Copyright 2026 Example Corp.
This product includes the third-party software listed below. Each entry
gives the software's license, as an SPDX expression, and where its license
files are.
========================================================================
Included in this distribution
========================================================================
example-parser 2.4.1
License: MIT OR Apache-2.0
Copyright (c) 2019 The Example Parser Authors
Source: https://example.com/example-parser
Used by: example-cli
License files: third-party-licenses/cargo/example-parser/LICENSE-MIT,
third-party-licenses/cargo/example-parser/LICENSE-APACHE
NOTICE from example-parser:
<its NOTICE text, unchanged>
========================================================================
Not included: downloaded separately, or used only to build or test
========================================================================
example-test-runner 1.8.0, used only to test
License: MIT
Source: https://example.com/example-test-runner
```
- Leave out the second section if the user answered no in step 3, and leave out a section that
would be empty.
- List the entries in each section in alphabetical order, so the diff between two runs shows only
what changed.
- Copy each copyright line from the component's license and `NOTICE` files. Never write one from a
package's author field alone. Where its files state none, write `Copyright: none stated`.
- Copy each component's own `NOTICE` text unchanged. Section 4(d) lets you leave out the notices
that don't apply to what the project distributes; where you aren't sure, keep them and ask.
- Copy every license and `NOTICE` file each included component ships into
`third-party-licenses/<ecosystem>/<name>/`, under its own file name. Where two versions of one
component ship different license files, add the version to the folder's name.
Then write a `NOTICE` in each unit's folder that isn't the root. Give it the same first lines, and
list only what that unit's release contains (step 2, item 3). A library's source package often
contains no third-party code, so its `NOTICE` holds only the project's lines and, if the user
chose it, the section of what isn't included.
### Check changed third-party files
Section 4(b) of the license requires every modified file of Apache-licensed code to "carry
prominent notices stating that You changed the files." For each vendored Apache-licensed
component, find the files the project changed, from its patch files or a diff against the release
it came from. Where a changed file has no such notice, propose one line below its existing
notices, such as `// Changed by Example Corp.: reads the length as unsigned.`, and ask before you
add it, because the file isn't the project's own.
### Apps that show their notices
Section 4(d) also accepts notices shown "within a display generated by the Derivative Works,"
such as an app's open-source licenses screen. Where a unit's **Release** ships an app, tell the
user. Flutter collects each package's `LICENSE` file when it builds an app, and
`showLicensePage` shows them. Don't build a screen unless the user asks for one.
## 6. Source headers (`headers`)
### The header
The header is the notice from the license's appendix, filled in with the holder and year from
step 3. In the proposed form, in `//` comments, it reads:
```text
// Copyright 2026 Example Corp.
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
- Take the wording from the appendix of the text you fetched in step 4, not from this example.
- Keep `http://`, as the appendix writes it, unless the repository's existing headers use
`https://`, which the ASF's own header policy also accepts. Use one form across the repository.
- The short form is the first two lines alone.
- Find each file's year from Git:
```bash
git log --follow --diff-filter=A --format=%ad --date=format:%Y -- src/parser.rs | tail -n 1
```
It prints the year of the commit that added the file, following renames, such as `2024`. A file
not committed yet takes the current year.
- Leave a file's existing Apache header as it is. Where it names another holder, such as a
contributor, keep it, and list it in the report. Where a file has a copyright line with no
license, ask before you add the license lines below it.
### Where it goes
Put the header at the top of the file, in the file's comment syntax, followed by one blank line.
Keep these lines above it, and keep the header out of these documentation comments:
| Files | Comment | Keep above the header | Watch for |
| --- | --- | --- | --- |
| Rust | `//` | Nothing | Not `//!` or `///`, which rustdoc reads as documentation |
| Go | `//` | Nothing: a `//go:build` line may follow the header, because Go allows comments before it | A blank line between the header and `package`. Without it, `go doc` shows the header as the package's documentation |
| C and C++ | `//` or `/* */`, as the file already uses | Nothing | Not `/**`, `/*!`, `///`, or `//!`, which Doxygen reads |
| Java, Kotlin, JavaScript, and TypeScript | `//` or `/* */` | Nothing | Not `/**`, which Javadoc, KDoc, and JSDoc read |
| C#, Swift, and Dart | `//` | Nothing | Not `///`, which their documentation tools read |
| CSS | `/* */` | An `@charset` rule, which must come first | — |
| PHP | `//` or `/* */` | The `<?php` tag | The header goes before `declare(strict_types=1);`, which comments may come before |
| Python | `#` | A shebang (`#!`), and an encoding comment, which Python reads only on line 1 or 2 | Not a docstring. The module's docstring follows the header |
| Ruby | `#` | A shebang, and magic comments such as `# frozen_string_literal: true` | — |
| Perl | `#` | A shebang | Make the POD section `COPYRIGHT AND LICENSE` name the same holder and license |
| Lua and SQL | `--` | A shebang, in a Lua script | Not `---`, which LuaCATS and LDoc read |
| Shell scripts, Makefiles, YAML, TOML, and Dockerfiles | `#` | A shebang, and a Dockerfile's parser directives, such as `# syntax=`, which Docker stops looking for after the first comment, blank line, or instruction | — |
| HTML, XML, SVG, and Markdown | `<!-- -->` | An XML declaration (`<?xml … ?>`), which must come first, and front matter (a block between `---` lines), which site generators read only at the top | — |
For a language not in the table, use its line comment, and check its documentation for lines that
must come first and for comments its tools read as documentation.
### Apply the headers
1. Write a script in a temporary folder outside the repository. For each file from step 2 that
gets a header, it keeps the lines that must come first, adds the header and one blank line,
and leaves the rest of the file as it was. Make it keep each file's line endings, and keep a
UTF-8 byte order mark as the file's first bytes. Make it skip a file that already has a header,
so a second run changes nothing.
2. Run it on three files of different kinds, and show the user the diff. Then run it on the rest.
3. Check that the headers added lines and removed none (step 9).
Google's `addlicense` and the REUSE tool's `reuse annotate` also add headers. Both are third-party
tools: ask before you install either, and follow `dependencies.md` where it is adopted.
`addlicense` writes "Google LLC" as the holder unless its `-c` flag names another.
## 7. REUSE, where the user chose it
The [REUSE specification](https://reuse.software/spec-3.3/), from the Free Software Foundation
Europe, puts machine-readable license information on every file, so `reuse lint` can check that
no file lacks it. Version 3.3, from November 14, 2024, was the latest in December 2026.
- The header from step 6 already meets it. REUSE reads a copyright line that starts with
`Copyright`, though it recommends the `SPDX-FileCopyrightText:` tag, and reads the license from
the `SPDX-License-Identifier` line.
- Put the license's text in `LICENSES/Apache-2.0.txt` too, and the license of every vendored file
in `LICENSES/<SPDX identifier>.txt`. The folder must hold no license that no file uses.
- Keep the third-party texts in `third-party-licenses/`, never in `LICENSES/`, which may hold only
license files named by their identifiers.
- Cover each file without a header, and each `NOTICE`, in a `REUSE.toml` in the root:
```text
version = 1
[[annotations]]
path = ["NOTICE", "crates/*/NOTICE", "**/*.json", "Cargo.lock"]
SPDX-FileCopyrightText = "2026 Example Corp."
SPDX-License-Identifier = "Apache-2.0"
```
Without `precedence`, REUSE uses a file's own license information when it has some, and the
table's otherwise. Annotate each third-party file without a header, such as a component's
`NOTICE` in `third-party-licenses/`, with its own holder and license, never the project's. When
a file matches several tables, REUSE uses the last one, so put the third-party tables after the
project's.
- REUSE doesn't cover files named `LICENSE`, `LICENCE`, or `COPYING`, with or without a suffix,
or `REUSE.toml` itself.
## 8. Keep it current
The notice and the headers drift as the project changes. On a later run:
- Rebuild the third-party list from the lock files, and show the user what changed since the
last `NOTICE`: components added and removed, and changed versions, licenses, and copyright
lines. Keep the entries no tool lists, such as copied code and fonts, while what they describe
is still in the repository.
- Add headers to the files added since the last run, and copy `LICENSE` into new units.
- Offer to add these to the **Changes that travel together** in `commits.md`, so every later
change keeps them current: a change to a manifest or a lock file, and the `NOTICE` entries and
third-party license files it changes; and a new source file and its header. Change that value
only if the user agrees.
## 9. Verify
1. **The root `LICENSE` is the license's text.** This command prints nothing when the two match:
```bash
curl -fsSL https://www.apache.org/licenses/LICENSE-2.0.txt | cmp - LICENSE
```
Without the network, compare `sha256sum LICENSE` with the hash in step 4.
2. **Every unit's copy matches it.** Replace the folders with the units' folders. The command
prints nothing when every copy matches:
```bash
for d in crates/parser crates/cli; do
cmp -s LICENSE "$d/LICENSE" || echo "$d/LICENSE differs"
done
```
3. **Every file that needs a header has one.** Replace the patterns with the kinds of files that
get headers, and leave out the skipped paths with patterns such as `':!vendor/'`:
```bash
git grep -L -I -e 'SPDX-License-Identifier: Apache-2.0' \
-e 'Licensed under the Apache License, Version 2.0' -- '*.rs' '*.sh' ':!vendor/'
```
It prints each tracked file that has neither line, and nothing when every file has one.
4. **The headers removed nothing.** Run this command while the headers are the only uncommitted
changes, or name their files after `--`. It prints each changed file that lost a line, with the
lines added and removed, and nothing when every change only added lines:
```bash
git diff --numstat | awk '$2 != 0'
```
5. **The code still builds and passes its tests:** run the **Check commands**.
6. **Each package holds `LICENSE` and `NOTICE`:** run the check in each language rule's "Before
finishing" section that lists a package's files, such as `cargo package --list` in `rust.md`.
For a JAR, `jar tf <file>.jar` lists its files.
7. **The notice is complete.** Every component the **Tree commands** list for a unit's release
has an entry at its locked version, and every entry still describes something the project
uses. This command prints each license file that `NOTICE` names but that doesn't exist:
```bash
grep -o 'third-party-licenses/[^ ,]*' NOTICE | sort -u | while read -r f; do
[ -f "$f" ] || echo "missing: $f"
done
```
8. **REUSE, where chosen:** run `reuse lint` where the user approved installing it. It reports
each file without license information, and each license in `LICENSES/` that no file uses.
9. **Every changed manifest still parses,** with the checks in "Before finishing" in `writing.md`.
Preview the changed READMEs, and run the **Done checks**.
## 10. Commit only as the project allows
Follow the **Git access** level in `commits.md`, and leave the changes uncommitted unless the user
asked for a commit and that level allows it. Either way, end the report with copy-ready commit
messages, as `commits.md` describes, one for each piece, in this order:
1. the `LICENSE` copies, the manifests' license fields, and the READMEs' license sections;
2. `NOTICE` files and `third-party-licenses/`;
3. the headers;
4. `REUSE.toml` and `LICENSES/`, where chosen;
5. any change to the **Changes that travel together** in `.claude/rules/commits.md`.
Use `chore` for each, and a scope only where one of the **Scopes** fits. Where the project had no
license before, say in the first commit's body that it now has one, because that changes what
others may do with the code. Before a push the user asked for, say what the **Push effect** sets
off.
## 11. Report
End with a summary that contains:
- **Scope:** the pieces done, and those left out and why.
- **Survey:** the license found, each unit and what its release contains, and the count of files
of each kind.
- **Decisions:** each answer from step 3, and each question the user left open.
- **Files:** each file written or changed, by piece, with the number of headers added.
- **Third-party software:** a table of each component, its version, its license, the units whose
releases contain it, and whether it is flagged.
- **For you to decide:** each flagged component, each file under another license or holder, and
each vendored file that may need a notice of changes.
- **Not covered:** license screens in apps, packages whose builds still leave out `LICENSE` or
`NOTICE`, and anything else waiting for the user.
- **Checks:** each check from step 9, with its real result, and each one you couldn't run, and
why.
- **Commit messages:** in `text` blocks, as `commits.md` describes, with no attribution lines.