project-structure

Organize React/Next.js/TypeScript projects by feature-based architecture.

280|36|Updated Jan 24, 2026
One-click install
npx skills add https://github.com/flpbalada/my-opencode-config --skill project-structure-flpbalada
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: project-structure
Source: https://github.com/flpbalada/my-opencode-config/tree/main/skills/project-structure
Command: npx skills add https://github.com/flpbalada/my-opencode-config --skill project-structure-flpbalada

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides teams to structure React/Next.js/TypeScript projects using a feature-based architecture, helping keep codebases scalable and maintainable.

Core Features & Use Cases

  • Top-down structure guidance: Defines a recommended top-level layout (src/app, src/features, src/components, src/lib, src/utils, etc.) to organize code by feature/domain rather than by file type.
  • Feature module isolation: Encourages self-contained feature modules with clear boundaries to reduce cross-feature coupling.
  • Unidirectional data flow guidance: Enforces import directions to prevent circular or global dependencies and to improve composability.
  • Use this skill when starting a new project, reorganizing an existing codebase, or evaluating where to place new code sections in a React/Next.js/TypeScript app.

Quick Start

Initialize a new project structure following the guide: create src/app for routing and providers, a src/features folder for domain modules, a shared src/components folder for reusable UI, and add a minimal example feature to validate the structure.

Frequently Asked Questions about project-structure

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

FAQPage Schema
How do I structure a React and Next.js project by features?

Structure a React and Next.js project by creating top-level directories like src/app, src/features, and src/components. This feature-based architecture organizes code by domain modules rather than file type, keeping your codebase scalable and maintainable as it grows.

What is feature-based architecture in TypeScript applications?

Feature-based architecture in TypeScript applications is a code organization pattern that groups files by domain modules. It defines self-contained feature folders with clear boundaries, preventing cross-feature coupling and ensuring modules remain isolated and maintainable.

How do I prevent circular dependencies in a Next.js codebase?

Prevent circular dependencies in a Next.js codebase by enforcing unidirectional import directions. This pattern restricts feature modules from importing each other directly, guiding shared code into designated folders like src/lib and src/utils to improve overall composability.

Does the feature-based architecture pattern work for existing codebases?

Yes, the feature-based architecture pattern works for existing codebases. You can reorganize your current project by migrating code into top-level structures like src/features and src/components, establishing clear boundaries to reduce coupling during the transition.

What is the best way to organize shared vs feature code in React?

The best way to organize shared vs feature code in React is to place reusable UI elements in src/components and domain-specific logic in src/features. This separation enforces unidirectional imports and prevents feature modules from directly depending on one another.

Why should I avoid barrel files in a TypeScript project structure?

Avoid barrel files in a TypeScript project structure because they often introduce circular dependencies and unnecessary coupling. Enforcing unidirectional imports and specifying concrete placement rules for shared code helps maintain strict feature module isolation.