# How the Copyright Gate Prevents Publishing Skills Derived from Copyrighted Books

> Discover how the copyright gate in book-to-skill restricts publishing derived skills. Learn about fair use checks and private repository visibility for your content.

- Repository: [Virgilio Junior/book-to-skill](https://github.com/virgiliojr94/book-to-skill)
- Tags: how-to-guide
- Published: 2026-08-25

---

**The copyright gate in `book-to-skill` forces private repository visibility unless the user explicitly answers the bare word `public` and the source material passes a fair‑use eligibility check.**

The `virgiliojr94/book-to-skill` repository converts books into GitHub Copilot skills, but it builds in multiple safeguards to prevent accidental public distribution of content derived from copyrighted works. These protections are concentrated in **Step 11** of the workflow defined in [`SKILL.md`](https://github.com/virgiliojr94/book-to-skill/blob/main/SKILL.md), where a multi-layered gate system controls repository visibility.

---

## Where the Copyright Gate Lives

The publishing workflow is documented in [`SKILL.md`](https://github.com/virgiliojr94/book-to-skill/blob/main/SKILL.md) at lines L624–L628. Two sequential checks run before any `gh repo create` command executes:

1. **Visibility check** – requires the literal answer `public`
2. **Copyright gate** – verifies source material eligibility

Only when both checks pass does the tool append `--public` to the GitHub CLI command. Otherwise, it defaults to `--private` with user notification.

---

## The Two-Step Enforcement Mechanism

### Step 1: Bare-Word Visibility Verification

The tool prompts users with a strictly formatted question:

> "Private or public repository? Reply with one word: `private` or `public`."

The parser performs **exact string matching** on the response. Variations like "make it public," "public domain," or "yes public" all fail and trigger the private fallback. This design eliminates ambiguity in user intent.

```bash

# From SKILL.md line L624

visibility = ask_user("Private or public repository? Reply with one word: `private` or `public`.")
if visibility != "public":
    repo_visibility = "--private"

```

This strict parsing is tested in [`tests/test_publish_visibility_gate.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/tests/test_publish_visibility_gate.py), which verifies that only the isolated token `public` permits non-private repository creation.

### Step 2: Fair-Use Copyright Gate

When the visibility check returns `public`, the workflow proceeds to [`SKILL.md`](https://github.com/virgiliojr94/book-to-skill/blob/main/SKILL.md#L628) for source material verification:

```python

# Inside Step 11 publishing logic

if source_is_third_party_copyrighted():
    print("⚠️  Source is copyrighted – forcing private repo.")
    repo_visibility = "--private"
else:
    repo_visibility = "--public"

```

The gate enforces the README's stated policy: **skills generated from third-party copyrighted books must stay private**. Public repositories are permitted only for:

- User-original writing
- Openly-licensed source material
- Cases where the user explicitly confirms redistribution rights

---

## Technical Implementation of Repository Creation

The final `gh` command construction follows this decision tree:

```bash

# Pseudocode extracted from Step 11

if visibility_answer == "public" and copyright_ok:
    gh repo create <repo> --public --source . --push
else:
    gh repo create <repo> --private --source . --push

```

The `--public` flag never appears in the generated command unless both gates pass. This prevents command injection or flag manipulation from bypassing the policy.

---

## Pre-Push Safety Scan (Step 9.5)

Before any repository push occurs, the workflow runs [`tools/scan_generated_skill.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/tools/scan_generated_skill.py):

```bash
python -m tools.scan_generated_skill /home/user/.copilot/skills/book-to-skill

```

If this scanner detects policy violations—such as excessive verbatim reproduction from source material—it exits with a non-zero status code. The publishing script aborts immediately, ensuring that even theoretically private repositories never receive non-compliant content.

---

## Complete Workflow Example

Triggering the full conversion and publish sequence:

```bash

# Initial conversion

book-to-skill ./my-book.pdf

# ... steps 1-10 execute ...

# Step 11: Publishing prompt appears

# "Private or public repository? Reply with one word: `private` or `public`."

```

**Scenario A: Accidental public attempt on copyrighted book**

```

> public
⚠️  Source is copyrighted – forcing private repo.
Repository created as private.

```

**Scenario B: Valid public publication of original work**

```

> public
Source verification passed.
Repository created as public.

```

**Scenario C: Ambiguous response**

```

> I want it public
Unrecognized response. Defaulting to private.
Repository created as private.

```

---

## File Reference Summary

| File | Role in Copyright Protection |
|------|------------------------------|
| [`SKILL.md`](https://github.com/virgiliojr94/book-to-skill/blob/main/SKILL.md#L624-L628) | Contains visibility question and copyright gate logic |
| [`tools/scan_generated_skill.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/tools/scan_generated_skill.py) | Pre-push policy violation scanner |
| [`tests/test_publish_visibility_gate.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/tests/test_publish_visibility_gate.py) | Automated verification of gate behavior |
| [`README.md`](https://github.com/virgiliojr94/book-to-skill/blob/main/README.md) | Documents fair-use principles and redistribution policy |

---

## Summary

- **Exact-word parsing** of the visibility response prevents accidental public selection through phrasing variations or synonyms.
- **Source material verification** blocks public repositories when third-party copyrighted books are detected as the origin.
- **Command construction logic** physically prevents `--public` flag injection unless both gates explicitly permit it.
- **Pre-push scanning** via [`tools/scan_generated_skill.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/tools/scan_generated_skill.py) provides final content verification before any repository receives files.

---

## Frequently Asked Questions

### What happens if I type "make it public" instead of just "public"?

The tool rejects any response that is not the isolated bare word `public`. Your repository will be created as private, and you will receive notification that the unrecognized response triggered the default behavior.

### Can I override the copyright gate if I believe my use qualifies as fair use?

No. The current implementation in [`SKILL.md`](https://github.com/virgiliojr94/book-to-skill/blob/main/SKILL.md) does not provide override mechanisms for third-party copyrighted sources. Fair-use determinations require legal analysis that the automated tool cannot perform, so it conservatively forces private visibility for all in-scope copyrighted materials.

### Does the scanner examine the actual book content or just metadata?

[`tools/scan_generated_skill.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/tools/scan_generated_skill.py) analyzes the generated skill structure for policy violations including excessive verbatim reproduction. It does not re-scan the original PDF but evaluates whether the synthesized skill output complies with redistribution guidelines before any push occurs.

### Is there any way to convert a private skill to public later through GitHub directly?

While GitHub allows visibility changes through its web interface, doing so would violate the fair-use policy enforced by this tool. The `book-to-skill` workflow is designed to prevent creation of public repositories containing skill derivatives from copyrighted books at the infrastructure level, not merely as a UI suggestion.