Skip to content

Commit 1e08a70

Browse files
committed
simplify dotenv skill
1 parent 271df30 commit 1e08a70

1 file changed

Lines changed: 32 additions & 52 deletions

File tree

skills/dotenv/SKILL.md

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ description: Load environment variables from a .env file into process.env for No
55

66
# dotenv
77

8-
98
Dotenv is a zero-dependency module that loads environment variables from a `.env` file into [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). Storing configuration in the environment separate from code is based on [The Twelve-Factor App](https://12factor.net/config) methodology.
109

1110
[Watch the tutorial](https://www.youtube.com/watch?v=YtkZR0NFd1g)
1211

13-
12+
 
1413

1514
## Usage
1615

@@ -31,14 +30,34 @@ SECRET_KEY="YOURSECRETKEYGOESHERE"
3130
And as early as possible in your application, import and configure dotenv:
3231

3332
```javascript
33+
// index.js
3434
require('dotenv').config() // or import 'dotenv/config' if you're using ES6
3535
...
3636
console.log(process.env) // remove this after you've confirmed it is working
3737
```
38+
```sh
39+
$ node index.js
40+
◇ injected env (14) from .env
41+
```
42+
43+
That's it. `process.env` now has the keys and values you defined in your `.env` file.
44+
45+
 
3846

39-
That's it. `process.env` now has the keys and values you defined in your `.env` file:
47+
## Agent Usage
4048

49+
Install this repo as an agent skill package:
50+
51+
```sh
52+
npx skills add motdotla/dotenv
53+
```
54+
```sh
55+
# ask Claude or Codex to do things like:
56+
set up dotenv
57+
upgrade dotenv to dotenvx
58+
```
4159

60+
 
4261

4362
## Advanced
4463

@@ -138,7 +157,7 @@ console.log(typeof config, config) // object { BASIC : 'basic' }
138157

139158
> Note: Consider using [`dotenvx`](https://github.com/dotenvx/dotenvx) instead of preloading. I am now doing (and recommending) so.
140159
>
141-
> It serves the same purpose (you do not need to require and load dotenv), adds better debugging, and works with ANY language, framework, or platform. – [motdotla](https://mot.la)
160+
> It serves the same purpose (you do not need to require and load dotenv), adds better debugging, and works with ANY language, framework, or platform. – [motdotla](https://not.la)
142161
143162
You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#-r---require-module) to preload dotenv. By doing this, you do not need to require and load dotenv in your application code.
144163

@@ -180,7 +199,7 @@ console.log('DATABASE_URL', process.env.DATABASE_URL)
180199
```
181200
```sh
182201
$ dotenvx run --debug -- node index.js
183-
[dotenvx@0.14.1] injected env (2) from .env
202+
injected env (2) from .env · dotenvx@1.59.1
184203
DATABASE_URL postgres://username@localhost/my_database
185204
```
186205

@@ -201,7 +220,7 @@ console.log('DATABASE_URL', process.env.DATABASE_URL)
201220
```
202221
```sh
203222
$ dotenvx run --debug -- node index.js
204-
[dotenvx@0.14.1] injected env (1) from .env
223+
injected env (1) from .env · dotenvx@1.59.1
205224
DATABASE_URL postgres://yourusername@localhost/my_database
206225
```
207226

@@ -217,7 +236,7 @@ $ dotenvx set HELLO Production -f .env.production
217236
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
218237
219238
$ DOTENV_PRIVATE_KEY_PRODUCTION="<.env.production private key>" dotenvx run -- node index.js
220-
[dotenvx] injected env (2) from .env.production
239+
injected env (2) from .env.production · dotenvx@1.59.1
221240
Hello Production
222241
```
223242

@@ -250,7 +269,7 @@ $ dotenvx run -f=.env.local -f=.env -- node index.js
250269
Hello local
251270
```
252271

253-
[more environment examples](https://dotenvx.com/docs/quickstart/environments)
272+
[more environment examples](https://dotenvx.com/docs/quickstart/environments?utm_source=github&utm_medium=readme&utm_campaign=motdotla-dotenv&utm_content=docs-environments)
254273

255274
</details>
256275
<details><summary>Production</summary><br>
@@ -318,45 +337,7 @@ See [examples](https://github.com/dotenv-org/examples) of using dotenv with vari
318337

319338
</details>
320339

321-
322-
323-
## Agents
324-
325-
<img src="https://dotenvx.com/assets/img/as2/9.jpg" height="400" alt="dotenvx-as2" align="right"/>
326-
327-
> Software is changing, and dotenv must change with it—that is why I built [agentic secret storage (AS2)](https://dotenvx.com/as2). Agents run code without humans at terminals, so plaintext `.env` files are the wrong primitive.
328-
>
329-
> AS2 is built for autonomous software: encrypted by default, zero console access, and cryptography‑first delivery that keeps operators out of the loop.
330-
>
331-
> It is backed by [Vestauth](https://github.com/vestauth/vestauth), the trusted, pioneering auth layer for agents—giving each agent a cryptographic identity so requests are signed with private keys and verified with public keys. No shared secrets to leak.
332-
>
333-
> It's what I'm using now. - [motdotla](https://mot.la)
334-
335-
### Quickstart
336-
337-
Install vestauth and initialize your agent.
338-
339-
```bash
340-
npm i -g vestauth
341-
342-
vestauth agent init
343-
```
344-
345-
Your agent `set`s secrets with a simple `curl` endpoint:
346-
347-
```bash
348-
vestauth agent curl -X POST https://as2.dotenvx.com/set -d '{"KEY":"value"}'
349-
```
350-
351-
And your agent `get`s secrets with a simple `curl` endpoint:
352-
353-
```bash
354-
vestauth agent curl "https://as2.dotenvx.com/get?key=KEY"
355-
```
356-
357-
That's it! This new primitive unlocks secrets access for agents without human-in-the-loop, oauth flows, or API keys. It's the future for agents.
358-
359-
340+
&nbsp;
360341

361342
## FAQ
362343

@@ -504,7 +485,7 @@ require('dotenv').config({ override: true })
504485
</details>
505486
<details><summary>How can I prevent committing my `.env` file to a Docker build?</summary><br/>
506487

507-
Use the [docker prebuild hook](https://dotenvx.com/docs/features/prebuild).
488+
Use the [docker prebuild hook](https://dotenvx.com/docs/features/prebuild?utm_source=github&utm_medium=readme&utm_campaign=motdotla-dotenv&utm_content=docs-prebuild).
508489

509490
```bash
510491
# Dockerfile
@@ -578,7 +559,7 @@ Alternatively, just use [dotenv-webpack](https://github.com/mrsteele/dotenv-webp
578559

579560
</details>
580561

581-
562+
&nbsp;
582563

583564
## Docs
584565

@@ -645,7 +626,6 @@ HELLO=World
645626

646627
```sh
647628
$ node index.js
648-
[dotenv@17.0.0] injected env (1) from .env
649629
Hello World
650630
```
651631

@@ -763,13 +743,13 @@ Default: `false`
763743

764744
Override any environment variables that have already been set.
765745

766-
746+
&nbsp;
767747

768748
## CHANGELOG
769749

770750
See [CHANGELOG.md](CHANGELOG.md)
771751

772-
752+
&nbsp;
773753

774754
## Who's using dotenv?
775755

0 commit comments

Comments
 (0)