project-structure-and-packages

Enforces feature-first Flutter project layout with downward-only dependencies and pure-Dart package extraction.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/zakariaf/NearlyStop --skill project-structure-and-packages-zakariaf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: project-structure-and-packages
Source: https://github.com/zakariaf/NearlyStop/tree/main/.claude/skills/project-structure-and-packages
Command: npx skills add https://github.com/zakariaf/NearlyStop --skill project-structure-and-packages-zakariaf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Flutter codebases decay into unreviewable tangles: junk-drawer folders, cross-feature imports, MethodChannels scattered through widgets, and packages extracted before any logic earns them. This Skill makes structural defects greppable by enforcing a single-package feature-first layout, a downward-only dependency DAG, and pubspec manifests that act as audit artifacts. ## Core Features & Use Cases - Placement-by-failure rules: Deterministic guidance for where repositories, Notifiers, MethodChannels, value types, and tokens belong across lib/features/, core/, data/, services/, routing/, theme/, and l10n/. - Package extraction discipline: Criteria and wiring for extracting a generically-named pure-Dart package (meta-only deps, resolution: workspace, one public barrel over lib/src/) only when logic earns isolation. - Automated boundary checks: Two shell scripts flag junk-drawer folders, app-package barrels, MethodChannels outside services/native/, relative imports, cross-package lib/src/ imports, and Flutter/dart:io/wall-clock usage in pure roots. - Use Case: When adding a new repository or reviewing a diff, run the placement decision procedure and the check scripts before a PR to prove no feature imports another feature and lib/core/ stays Flutter-free. ## Quick Start Ask the assistant to decide where a new Dart class belongs in the Flutter project and to run the structure and import-boundary checks before committing.

Frequently Asked Questions about project-structure-and-packages

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

FAQPage Schema
How do I structure a Flutter project with feature-first folders?

Place each screen under lib/features/<feature>/ with presentation/ and a <feature>_notifier.dart, and keep the shared foundation split by technical role at the top level: core/, data/, services/, routing/, theme/, and l10n/. main.dart stays thin and only calls bootstrap().

When should I extract a Dart package from my Flutter app?

Extract a pure-Dart package only when logic is UI-free, worth testing headlessly with dart test, and the no-Flutter guarantee is worth making a build error. Typical candidates are money math, entities, and deterministic algorithms; below that bar the code stays in lib/core/.

Where should a MethodChannel go in a Flutter app?

Every MethodChannel construction belongs in lib/services/native/ so it can be faked and found in review. The check_structure.sh script fails the build if a MethodChannel appears anywhere outside services/native/.

Can one Flutter feature folder import another feature folder?

No, features never import features. Share code by lifting it down to core/, data/, or services/, or let the two surfaces meet via a route. A cross-feature import is treated as a design defect, not a style issue.

Why does check_import_boundaries.sh miss my pure package?

Auto-detection only matches directories named core or ending in _core. A pure package with a plain generic name like money or scheduling must be passed explicitly via PURE_DIR, for example PURE_DIR=packages/money scripts/check_import_boundaries.sh.

Should a Flutter app use barrel files or lib/src/?

No, barrels and lib/src/ are package conventions only. An app package has no external importers, so barrels add analyzer cost and circular-import risk for no benefit; only extracted packages expose one public barrel over a private lib/src/.