Skip to content
Back to skills

Github Fine Grained Pat

ASecurity

Create least-privilege fine-grained GitHub personal access tokens. Use when the user wants a PAT template, recurring machine credential, private-repository token, or GitHub token rotation.

  • 81 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
toolsshellgitdocumentation

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add edmundmiller/dotfiles --skill github-fine-grained-pat --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Github Fine Grained Pat?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Github Fine Grained Pat
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/edmundmiller-github-fine-grained-pat/badge)](https://www.skillsdirectory.com/skills/edmundmiller-github-fine-grained-pat)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: github-fine-grained-pat
description: Create least-privilege fine-grained GitHub personal access tokens. Use when the user wants a PAT template, recurring machine credential, private-repository token, or GitHub token rotation.
---

# Fine-grained GitHub PAT

Create a narrowly scoped token and keep its value out of chat, logs, command arguments, and version control.

## 1. Define the grant

Confirm or infer:

- resource owner;
- exact repositories;
- required repository permissions;
- expiration;
- token name and purpose.

Default machine-read grant:

- only the named repositories;
- `contents=read`;
- 366-day expiration;
- no account permissions.

Do not grant all repositories or write access unless the task requires it.

## 2. Generate the template link

Build this URL with percent-encoded values:

```text
https://github.com/settings/personal-access-tokens/new?name=<name>&description=<description>&target_name=<owner>&expires_in=<days>&contents=read
```

Supported template fields are `name`, `description`, `target_name`, `expires_in`, and permission names. Repository selection cannot be prefilled. Say this explicitly, then list the repositories the user must select under **Only select repositories**.

Use GitHub's current permission parameter names. If the requested grant is broader than `contents=read`, verify the parameter in GitHub's official token documentation before constructing the link.

## 3. Create only when requested

If the user asks only for a link, stop after returning the link and repository checklist.

If the user asks the agent to create the token, use an authenticated browser session. Review the visible owner, repositories, expiration, and permissions immediately before generation. Creating the token is the requested external side effect; do not broaden its scope.

If authentication, reauthentication, CAPTCHA, or repository selection requires the user, leave the exact page open as a handoff and state the remaining action.

## 4. Capture safely

The token is shown once. Never print it, paste it into chat, or expose it in tool output.

When storage is in scope, save it directly into the requested secret manager. Prefer a dedicated item whose title identifies the machine and purpose. Record these non-secret fields beside it:

- GitHub resource owner;
- selected repositories;
- granted permissions;
- expiration date;
- consuming service or host.

Do not place the token in `flake.nix`, committed `nix.conf`, shell history, or a Nix store path.

## 5. Verify the boundary

Verify without displaying the token:

- authorized repository requests succeed;
- one unselected private repository request fails;
- the consumer reads the secret through its intended runtime path;
- no command or log contains the token value.

Report scope and verification only, never the credential.

Files in this skill

  • README.md245 B
  • SKILL.md2.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.