create-next-app-existing-dir

Scaffold a Next.js app in an existing directory with absolute paths.

2|Updated Feb 13, 2026
One-click install
npx skills add https://github.com/pmarashian/cursor-agent-skills --skill create-next-app-existing-dir
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-next-app-existing-dir
Source: https://github.com/pmarashian/cursor-agent-skills/tree/main/create-next-app-existing-dir
Command: npx skills add https://github.com/pmarashian/cursor-agent-skills --skill create-next-app-existing-dir

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill streamlines the process of initializing a Next.js application within a directory that already contains files, preventing common errors and saving development time.

Core Features & Use Cases

  • Handles Existing package.json: Automatically manages conflicts when create-next-app encounters an existing package.json.
  • Absolute Path Preference: Ensures reliable project scaffolding by using absolute paths for the target directory.
  • API-Only Setup Optimization: Facilitates setting up Next.js for API-only backends by stripping unnecessary UI files and clearing build artifacts.
  • Use Case: You need to add a Next.js frontend to an existing backend project. This Skill ensures a smooth setup without manual intervention for common issues.

Quick Start

Use the create-next-app-existing-dir skill to scaffold a Next.js app in the current directory, preferring an absolute path for the target.

Frequently Asked Questions about create-next-app-existing-dir

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

FAQPage Schema
How do I run create-next-app in an existing directory without file conflicts?

Next.js scaffolding in an existing directory requires managing conflicts with pre-existing files like package.json. This Skill resolves those conflicts automatically and uses absolute paths for the target directory to ensure reliable initialization.

Can I set up a Next.js API-only backend without generating UI components?

Setting up a Next.js API-only backend involves removing default UI components. This Skill optimizes that process by stripping unnecessary UI files and clearing the .next build cache before executing type checks.

Why does create-next-app fail when adding a frontend to an existing backend project?

create-next-app fails in existing backend projects when it encounters a pre-existing package.json. This Skill prevents these errors by automatically managing package.json conflicts during the scaffolding process.

What is the best way to initialize Next.js in a folder that already has files?

Initializing Next.js in a populated folder requires handling existing package.json files and using absolute target paths. This Skill streamlines that process, clearing the .next cache and stripping UI components for API-only setups.

Do I need to manually clear the .next cache when scaffolding an API-only Next.js app?

You do not need to manually clear the .next cache for an API-only Next.js app. This Skill clears build artifacts automatically before type checking and removes unnecessary UI components during setup.