{"id":24992,"plugin_id":"plugin_asdk_app_691f1f8f72408191afdbbdf8242bdf86","kind":"skill","collection_source":null,"comparison_source":null,"observed_at":"2026-09-30T23:18:59.149Z","digest":"d335720dc479dffa764b89b763e224679b503947797b67299d984c00fe4e3d79","against":5382,"payload":{"name":"netlify-cli-and-deploy","description":"Guide for using the Netlify CLI and deploying sites. Use when installing the CLI, linking sites, deploying (Git-based or manual), managing environment variables, or running local development. Covers netlify dev, netlify deploy, Git vs non-Git workflows, and environment variable management.","included_files":[{"relative_path":"LICENSE.txt","size_in_bytes":10776},{"relative_path":"agents/openai.yaml","size_in_bytes":325},{"relative_path":"assets/netlify-small.svg","size_in_bytes":1291},{"relative_path":"assets/netlify.png","size_in_bytes":2686}],"skill_md_contents":"---\nname: netlify-cli-and-deploy\ndescription: Guide for using the Netlify CLI and deploying sites. Use when installing the CLI, linking sites, deploying (Git-based or manual), managing environment variables, or running local development. Covers netlify dev, netlify deploy, Git vs non-Git workflows, and environment variable management.\n---\n\n# Netlify CLI and Deployment\n\n## Installation\n\n```bash\nnpm install -g netlify-cli    # Global (for local dev)\nnpm install netlify-cli -D    # Local (for CI)\n```\n\nRequires Node.js 18.14.0+.\n\n## Authentication\n\n```bash\nnetlify login       # Opens browser for OAuth\nnetlify status      # Check auth + linked site status\n```\n\nFor CI, set `NETLIFY_AUTH_TOKEN` environment variable instead.\n\n## Linking a Site\n\nCheck if already linked with `netlify status`. If not:\n\n```bash\n# Interactive\nnetlify link\n\n# By Git remote (if using Git)\nnetlify link --git-remote-url https://github.com/org/repo\n\n# Create new site\nnetlify init           # With Git CI/CD setup\nnetlify init --manual  # Without Git CI/CD\n```\n\nSite ID is stored in `.netlify/state.json`. Add `.netlify` to `.gitignore`.\n\n## Deploying\n\n### Git-Based Deploys (Continuous Deployment)\n\nSet up with `netlify init`. Automatic deploys trigger on push/PR:\n- Push to production branch → production deploy\n- Open PR → deploy preview with unique URL\n- Push to other branches → branch deploy\n\nBuild runs on Netlify's servers. Configure build settings in `netlify.toml`.\n\n### Manual / Local Deploys (No Git Required)\n\nBuild locally, then upload:\n\n```bash\nnetlify deploy          # Draft deploy (preview URL)\nnetlify deploy --prod   # Production deploy\nnetlify deploy --dir=dist  # Specify output directory\n```\n\nThis works without Git — useful for prototypes, local-only projects, or CI pipelines.\n\n## Local Development\n\n### Option 1: netlify dev\n\n```bash\nnetlify dev\n```\n\nWraps your framework's dev server and provides:\n- Environment variable injection\n- Functions and edge functions\n- Redirects and headers processing\n\n### Option 2: Netlify Vite Plugin (Vite-based projects)\n\nFor projects using Vite (React SPA, TanStack Start, SvelteKit, Remix), the Vite plugin provides Netlify platform primitives directly in the framework's dev server:\n\n```bash\nnpm install @netlify/vite-plugin\n```\n\n```typescript\n// vite.config.ts\nimport netlify from \"@netlify/vite-plugin\";\nexport default defineConfig({ plugins: [netlify()] });\n```\n\nThen run your normal dev command (`npm run dev`) — no `netlify dev` wrapper needed. This gives you access to Blobs, DB, Functions, and environment variables during development.\n\nSee the **netlify-frameworks** skill for framework-specific local dev guidance.\n\n## Environment Variables\n\n### CLI Management\n\n```bash\n# Set\nnetlify env:set API_KEY \"value\"\nnetlify env:set API_KEY \"value\" --secret              # Hidden from logs\nnetlify env:set API_KEY \"value\" --context production   # Context-specific\n\n# Get\nnetlify env:get API_KEY\n\n# List\nnetlify env:list\nnetlify env:list --plain > .env                        # Export to file\n\n# Import from file\nnetlify env:import .env\n\n# Delete\nnetlify env:unset API_KEY\n```\n\n### Context Scoping\n\nVariables can be scoped to deploy contexts:\n\n```bash\nnetlify env:set API_URL \"https://api.prod.com\" --context production\nnetlify env:set API_URL \"https://api.staging.com\" --context deploy-preview\nnetlify env:set DEBUG \"true\" --context branch:feature-x\n```\n\n### Accessing in Code\n\n- **Server-side (Functions)**: Use `Netlify.env.get(\"VAR\")` (preferred) or `process.env.VAR`\n- **Client-side (Vite)**: Only `VITE_`-prefixed vars via `import.meta.env.VITE_VAR`\n- **Client-side (Astro)**: Only `PUBLIC_`-prefixed vars via `import.meta.env.PUBLIC_VAR`\n\n**Never use `VITE_` or `PUBLIC_` prefix for secrets** — these are exposed to the browser.\n\n## Useful Commands\n\n| Command | Description |\n|---|---|\n| `netlify status` | Auth and site link status |\n| `netlify dev` | Start local dev server |\n| `netlify build` | Run build locally (mimics Netlify environment) |\n| `netlify deploy` | Draft deploy |\n| `netlify deploy --prod` | Production deploy |\n| `netlify dev:exec <cmd>` | Run command with Netlify environment loaded |\n| `netlify env:list` | List environment variables |\n| `netlify clone org/repo` | Clone, link, and set up in one step |\n"},"changes":[{"path":"/included_files","type":"changed","before":[{"relative_path":"assets/netlify-small.svg","size_in_bytes":1291},{"relative_path":"assets/netlify.png","size_in_bytes":2686}],"after":[{"relative_path":"LICENSE.txt","size_in_bytes":10776},{"relative_path":"agents/openai.yaml","size_in_bytes":325},{"relative_path":"assets/netlify-small.svg","size_in_bytes":1291},{"relative_path":"assets/netlify.png","size_in_bytes":2686}]}],"summary":"Fields changed: 1. /included_files.","summary_kind":"deterministic","summary_metadata":{}}