# Nf Direnv

> This skill should be used when the user asks to "set up direnv", "configure .envrc", "add gh token to env", or runs `/nf-direnv` in a git repo. Picks a gh account (inferred from the git remote owner), writes `.envrc` with a dynamic `$(gh auth token --user <account>)` export, runs `direnv allow`, and ensures `.envrc` is gitignored.

- **Type:** Skill
- **Install:** `agentstack add skill-llawliet11-claude-skills-toolkit-nf-direnv`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [llawliet11](https://agentstack.voostack.com/s/llawliet11)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [llawliet11](https://github.com/llawliet11)
- **Source:** https://github.com/llawliet11/claude-skills-toolkit/tree/main/nf-direnv

## Install

```sh
agentstack add skill-llawliet11-claude-skills-toolkit-nf-direnv
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# nf-direnv

Set up `.envrc` in the current git repo with `GH_TOKEN` derived from a chosen `gh` account. The token stays dynamic — no plaintext in the file, rotation is automatic.

## Workflow

1. **Check + list accounts** — run `scripts/setup.sh check`. Returns JSON `{direnv, git, accounts, default, remote}`.
   - `direnv: false` → STOP. Tell user `brew install direnv`.
   - `git: false` → STOP. Skill needs a git repo.
   - `accounts: []` → STOP. Tell user `gh auth login` first.

2. **Pick account** — present `accounts` via AskUserQuestion. Pre-select `default` (script infers it from remote owner; empty string means no confident default — make the user choose).

3. **Preview** — run `scripts/setup.sh preview `. Show output verbatim (BEFORE / AFTER / DIFF). Ask user to confirm before writing.

4. **Apply** — on confirm, run `scripts/setup.sh apply `. Script writes `.envrc`, runs `direnv allow`, and ensures `.envrc` is in `.gitignore`.

5. **Commit `.gitignore`** — if the script reported it added `.envrc`, ask user to commit per your project's git conventions (branch check, ticket ID, prefix). NEVER commit `.envrc` itself.

## Account → owner mapping

`scripts/setup.sh` maps git-remote owner → default account:

| Owner pattern | Account |
|---|---|
| `acme*`, `Acme*` | `acme-bot` |
| `widgetco*`, `WidgetCo*` | `widgetco-bot` |
| `my-personal-account` or no remote | `my-personal-account` |
| (unknown) | empty — user must pick |

Edit `infer_default` in `scripts/setup.sh` when adding a new account or org.

## Rules

- NEVER hardcode tokens. The script always emits `$(gh auth token --user ...)` so direnv resolves at load time.
- NEVER proceed past steps 2 and 3 without explicit user confirmation.
- `.envrc` MUST stay gitignored — per-developer config; account choice varies per machine.
- If `gh auth token` fails when direnv loads, user runs `gh auth login` then `direnv reload`.

## Resources

- `scripts/setup.sh` — orchestrator with subcommands `check` | `preview ` | `apply `. Handles preflight, account inference, in-place GH_TOKEN replacement, idempotent `.gitignore`.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [llawliet11](https://github.com/llawliet11)
- **Source:** [llawliet11/claude-skills-toolkit](https://github.com/llawliet11/claude-skills-toolkit)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-llawliet11-claude-skills-toolkit-nf-direnv
- Seller: https://agentstack.voostack.com/s/llawliet11
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
