dotenv-patterns

Load credentials from .env files using dotenv patterns for tests.

6|Updated Feb 20, 2025
One-click install
npx skills add https://github.com/zerobias-org/module --skill dotenv-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotenv-patterns
Source: https://github.com/zerobias-org/module/tree/main/.claude/skills/dotenv-patterns
Command: npx skills add https://github.com/zerobias-org/module --skill dotenv-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Environment file patterns, test data, and credential loading to keep tests secure and maintainable.

Core Features & Use Cases

  • Template-driven .env: Provides a safe template (.env.example) that developers copy to .env and never commit real credentials.
  • Centralized loading: Demonstrates loading credentials with dotenv in a dedicated integration test helper (test/integration/Common.ts) to prevent direct process.env access in production code.
  • Flexible patterns: Includes examples for multiple auth schemes and test data values, with CI/local development guidance.

Quick Start

Copy .env.example to .env, fill in your credentials, and run the test suite to load them with dotenv.

Frequently Asked Questions about dotenv-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I securely manage environment variables for integration tests?

Secure environment variables for integration tests by copying a provided .env.example template to .env, filling in credentials, and loading them via a dedicated test helper to prevent direct process.env access in production code.

What is the best way to load dotenv credentials in a CI workflow?

The best way to load dotenv credentials in a CI workflow is to use a centralized integration test helper that reads environment files, ensuring test data and auth schemes are consistently applied across both local development and CI environments.

How do I prevent committing real credentials in my .env file?

Prevent committing real credentials in your .env file by using a template-driven .env.example file that developers copy to .env, keeping the example safe to commit while the actual .env file with real credentials remains ignored.

Can I use dotenv patterns for multiple authentication schemes in test data?

Yes, you can use dotenv patterns for multiple authentication schemes in test data, as the pattern includes flexible examples for various auth values and provides guidance for both local development and CI workflows.

Why should I avoid direct process.env access in production code?

Avoid direct process.env access in production code to maintain security and maintainability, centralizing credential loading in a dedicated integration test helper instead, which keeps environment variable patterns consistent across tests.