nextjs-scope-rule

Analyze import usage to recommend Local or Shared placement in Next.js projects.

Updated Jan 18, 2026
One-click install
npx skills add https://github.com/cr8297408/personal-agents-manager-tools --skill nextjs-scope-rule
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-scope-rule
Source: https://github.com/cr8297408/personal-agents-manager-tools/tree/main/nextjs-scope-rule
Command: npx skills add https://github.com/cr8297408/personal-agents-manager-tools --skill nextjs-scope-rule

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill determines the optimal placement of components and logic in a Next.js project to enforce the Scope Rule.

Core Features & Use Cases

  • Analyze how often a component or hook is imported across features using the provided tools to count usage.
  • Recommend Local vs Shared placement based on usage, and provide exact move commands when refactoring.
  • Prevent premature abstraction by encouraging local placement unless a second feature requires the artifact.

Quick Start

Tell the rule the artifact name and usage context, e.g., ProductCard used in Dashboard and Checkout pages; the rule will return a local vs shared recommendation along with exact move commands.

Frequently Asked Questions about nextjs-scope-rule

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

FAQPage Schema
How do I decide whether a Next.js component should be local or shared?

Move Next.js components by analyzing import usage across features and counting distinct route groups. The rule outputs exact move commands for refactoring files once a second feature requires the shared artifact.

What is the Scope Rule for Next.js architecture?

The Scope Rule for Next.js architecture determines optimal placement of components and logic by analyzing import usage. It enforces local placement by default and recommends shared usage only when multiple route groups require the artifact.

How do I prevent premature abstraction when refactoring Next.js components?

Prevent premature abstraction during Next.js refactoring by keeping components local by default. Analyze import usage across features and only move files to shared placement when a second route group requires the artifact.

When should I move a hook to a shared directory in a Next.js project?

Move a hook to a shared directory in a Next.js project when import usage analysis shows a second feature or route group requires it. The Scope Rule enforces local placement until multiple distinct features need the artifact.

Can I get exact move commands for refactoring Next.js components across route groups?

Yes, you can get exact move commands for refactoring Next.js components. Provide the artifact name and usage context, and the Scope Rule returns concrete local vs shared recommendations along with precise file move actions.