Skip to content

Instantly share code, notes, and snippets.

@architjn
Created April 15, 2025 14:39
Show Gist options
  • Save architjn/a618843a226d0ffb3c53a5752a364352 to your computer and use it in GitHub Desktop.
Save architjn/a618843a226d0ffb3c53a5752a364352 to your computer and use it in GitHub Desktop.
Ensure that IDE installs the latest and correct packages using accurate syntax by default. Avoid relying on outdated model knowledge.
---
description:
globs:
alwaysApply: true
---
# πŸ“¦ Package Installation Rules
## 🌟 Goal
Ensure that IDE installs the **latest** and **correct** packages using **accurate syntax** by default. Avoid relying on outdated model knowledge.
---
## βœ… General Guidelines
1. **Always use the latest version** of a package unless explicitly specified.
2. **Do not hardcode version numbers** unless required β€” let the package manager resolve the latest version automatically.
3. **Avoid relying solely on internal AI memory or training data** β€” search the web (e.g., npmjs.com, GitHub, or official docs) for the most accurate and up-to-date package versions and usage syntax.
4. **When in doubt, check the official documentation or GitHub repository**.
---
## πŸ”„ Installing Packages – Use Correct Commands
### βœ… Correct Examples
```bash
# pnpm
pnpm add -D @typescript-eslint/eslint-plugin
# yarn
yarn add -D @typescript-eslint/eslint-plugin
# npm
npm install --save-dev @typescript-eslint/eslint-plugin
```
### ❌ Incorrect Example (Don't do this)
```bash
# Hardcoded version (not future-proof)
yarn add -D @typescript-eslint/[email protected]
```
---
## 🧠 Smart Suggestions (If Uncertain)
> πŸ” **If the AI is unsure about the latest package name or version**, it should:
- Prompt to **search the web** for the most accurate info.
- Or use the install command **without version numbers**.
---
## ⚠️ Known Issues & Fixes
### ❌ Incorrect CLI Syntax
**Incorrect:**
```bash
npx shadcn-ui@latest add button
```
**βœ… Correct:**
```bash
npx shadcn@latest add button
```
> βœ… Always refer to the [official documentation](mdc:https:/ui.shadcn.dev/docs/installation) to confirm command syntax.
---
## βœ… Package Manager Defaults
Use these defaults unless overridden:
| Task | Yarn | pnpm | npm |
|-------------------|-----------------------------|------------------------------|------------------------------|
| Add dev dependency| `yarn add -D <package>` | `pnpm add -D <package>` | `npm install --save-dev <package>` |
| Add regular dep | `yarn add <package>` | `pnpm add <package>` | `npm install <package>` |
---
## βœ… Final Checklist Before Installing
- [ ] Are you using the correct package name?
- [ ] Are you omitting hardcoded versions unless required?
- [ ] Did you confirm the latest syntax from official sources?
- [ ] If uncertain, are you searching the web or using generic install commands?
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment