Created
April 15, 2025 14:39
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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