npm-package-check

npm-package-check is a cursor rule for Cursor from astrogirlnim/SkyFiMCP. It costs 0 tokens per session (444 once invoked), scanned A, original, MIT.

A set of rules for checking whether JavaScript and TypeScript projects have the NPM packages they need. NPM is the main package registry and installer for these projects.

In plain words
What is it for?
It is for checking package.json dependencies before importing packages in JavaScript or TypeScript code.
Why use it?
It helps catch missing packages before they cause errors when the program runs. It also points out the npm install command needed for a missing package.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It is for checking package.json dependencies before importing packages in JavaScript or TypeScript code.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/astrogirlnim/skyfimcp/npm-package-check
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/astrogirlnim/SkyFiMCP

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for npm-package-check

README.md
[![agentmods](https://agentmods.dev/badge/rules/astrogirlnim/skyfimcp/npm-package-check.svg)](https://agentmods.dev/rules/astrogirlnim/skyfimcp/npm-package-check)
Your own site
<a href="https://agentmods.dev/rules/astrogirlnim/skyfimcp/npm-package-check"><img src="https://agentmods.dev/badge/rules/astrogirlnim/skyfimcp/npm-package-check.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 444 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00444
Opus 5 $0.00000 $0.00222
Sonnet 5 $0.00000 $0.00089
Haiku 4.5 $0.00000 $0.00044

Measured 7d ago against content hash adb44cfcc006, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

npm-package-check scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/npm-package-check.mdc · 75 lines

What it actually says

NPM Package Check

// Description: Best practices for checking and installing NPM packages before use // Recommended Globs: **/*.{js,jsx,ts,tsx}, **/package.json

Overview

Ensure all required NPM packages are properly installed before use to prevent runtime errors.

Package Check Process

  1. Before requiring any npm package, check package.json dependencies
  2. If package exists in dependencies:
    • Output: "✓ {package_name} is already installed"
  3. If package NOT found:
    • Output terminal command: npm install {package_name}

Example Implementation

const fs = require('fs');
const path = require('path');

function checkPackage(packageName) {
  try {
    const packageJson = JSON.parse(
      fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8')
    );

    const deps = {
      ...packageJson.dependencies,
      ...packageJson.devDependencies
    };

    if (deps[packageName]) {
      console.log(`✓ ${packageName} is already installed`);
      return true;
    } else {
      console.log(`Installing ${packageName}...`);
      console.log(`Run: npm install ${packageName}`);
      return false;
    }
  } catch (error) {
    console.error('Error reading package.json:', error);
    return false;
  }
}

Usage Example

// Before importing a package
if (checkPackage('express')) {
  const express = require('express');
  // Use express...
} else {
  console.error('Please install express first');
  process.exit(1);
}

Best Practices

  • Always check packages before requiring them
  • Handle missing package.json gracefully
  • Consider both dependencies and devDependencies
  • Provide clear installation instructions
  • Exit gracefully if required packages are missing

Common Patterns

  • Pre-startup dependency check
  • Dynamic package loading
  • Development tooling setup
  • Build process validation
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 75 lines · 444 tokens per session scan A adb44cfcc006

Subscribe to this mod's changes

npm-package-check is a cursor rule published in the GitHub repository astrogirlnim/SkyFiMCP (1 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 444 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.