feature-architecture

Organize Next.js projects into feature-based architecture with barrel exports.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/madlado87/agentes --skill feature-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: feature-architecture
Source: https://github.com/madlado87/agentes/tree/main/.github/skills/feature-architecture
Command: npx skills add https://github.com/madlado87/agentes --skill feature-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ensures a consistent feature-based structure for Next.js projects, keeping domain logic under src/features and thin routes under src/app.

Core Features & Use Cases

  • Feature modules: Organize domain code into isolated features with dedicated folders for schemas, types, components, queries, hooks, stores, mocks, and constants.
  • Barrel exports & imports: Create a single barrel index per feature to expose public APIs and enforce import boundaries.
  • Guidelines & decision tree: Provide rules for where code belongs, naming conventions, and navigation integration to support scalable teamwork.

Quick Start

Create or align a new feature with the defined structure and ensure a barrel index exports the feature publicly.

Frequently Asked Questions about feature-architecture

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

FAQPage Schema
How do I structure a Next.js project by feature instead of file type?

Structure Next.js projects by colocating domain logic under src/features and keeping src/app as thin routes. This feature-based architecture isolates schemas, types, components, queries, hooks, stores, mocks, and constants within dedicated folders for scalable collaboration.

What is the best way to enforce import boundaries in a feature-based architecture?

The best way to enforce import boundaries is using barrel exports. Create a single barrel index per feature to expose its public API, ensuring other modules only import through this index rather than reaching into internal files directly.

How do I create a new feature module in Next.js?

Create a new feature module by setting up a dedicated folder under src/features for your domain logic, adding subfolders for schemas, types, and hooks, then integrating a barrel index export to expose the feature publicly.

Does feature-based architecture work with Next.js App Router?

Yes, feature-based architecture works with the Next.js App Router by keeping src/app thin. Route files act as navigational entry points while all domain logic, queries, and stores remain colocated under src/features.

When should I not use feature-based architecture in Next.js?

Avoid feature-based architecture for small Next.js projects where the overhead of creating dedicated folders and barrel exports for every domain module outweighs the collaboration benefits of strict import boundaries and colocated logic.

Why use barrel exports for domain modules in TypeScript?

Use barrel exports for domain modules to consolidate TypeScript imports and exports. A single index file exposes the public API of a feature, preventing deep import paths and maintaining clear structural boundaries between isolated modules.