architecting-structure
Enforces "Feature-First" architecture across standard frameworks. Use to scaffold new projects, refactor messy ones, or enforce clean file organization rules.
Best use case
architecting-structure is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Enforces "Feature-First" architecture across standard frameworks. Use to scaffold new projects, refactor messy ones, or enforce clean file organization rules.
Teams using architecting-structure should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/architecting-structure/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How architecting-structure Compares
| Feature / Agent | architecting-structure | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Enforces "Feature-First" architecture across standard frameworks. Use to scaffold new projects, refactor messy ones, or enforce clean file organization rules.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Code Structure Architect
## When to use this skill
- When the user asks to "set up the folders" for a new project.
- When the user asks to "clean up" or "refactor" a messy directory.
- When the user asks "where should I put this file?".
- When starting any new Next.js, Flutter, Python, or standard web project.
## Core Philosophy: Feature-First
We strictly follow **Feature-First Architecture (Vertical Slicing)**. Code that changes together stays together.
* **Bad (Type-First)**: `/components`, `/hooks`, `/services` (Separates logic by file type).
* **Good (Feature-First)**: `/features/auth`, `/features/dashboard` (Groups explicitly by user value).
## Workflow
### 1. Scaffolding (New Project)
1. **Identify Framework**: Detect if it's Next.js, Flutter, Python, etc.
2. **Apply Template**: Use the specific directory map below.
3. **Create Core**: Generate `core/` (shared logic) and `features/` (business logic) folders immediately.
### 2. Refactoring (Cleanup)
1. **Audit**: List all files.
2. **Group**: Identify "features" (e.g., "Login", "Profile", "Feed").
3. **Move**:
- Move generic UI (buttons, cards) -> `components/ui/`.
- Move shared utilities (dates, formatting) -> `utils/`.
- Move feature logic -> `features/<feature-name>/`.
4. **Export**: Create barrel files (`index.ts` / `barrier.dart`) only for the public API of a feature.
### 3. Enforcement (Check)
1. **Review**: Check if a new file is being created in the root or a 'dump' folder.
2. **Block**: "Stop. This belongs in `features/<name>`. Do not put logic in `pages/`."
## Framework Standards
### A. Next.js (App Router)
* `app/`: Routing layer **ONLY**. (page.tsx, layout.tsx, route.ts). NO LOGIC.
* `app/(auth)/login/page.tsx` -> Imports from `@/features/auth`
* `features/`: The brain.
* `features/auth/components/LoginForm.tsx`
* `features/auth/hooks/useLogin.ts`
* `features/auth/actions/login.ts` (Server Actions)
* `components/`: Shared dumb UI.
* `components/ui/button.tsx` (Shadcn)
* `components/layout/header.tsx`
* `lib/`: Singletons (Prisma, Stripe, Redis clients).
### B. Flutter (Clean + Riverpod)
* `lib/main.dart`: Entry point.
* `lib/core/`: Routing, Themes, Constants, Extensions.
* `lib/features/`:
* `features/auth/presentation/screens/`
* `features/auth/presentation/widgets/`
* `features/auth/data/repositories/`
* `features/auth/domain/models/`
* `lib/shared/`: Widgets used across multiple features.
### C. Python (FastAPI / General)
* `app/main.py`: App init.
* `app/core/`: Config, Security, DB session.
* `app/routers/`: V1 endpoints.
* `app/internal/`: Admin routes.
* `app/services/` (Optional): If logic is heavy.
* *Note*: Python often prefers flat structures initially. Group by "Domain" (e.g., `app/users/`, `app/items/`) if the app grows.
## Best Practices (Recommended)
1. **Filenames**:
- **JS/TS**: `camelCase` for variables/functions, `PascalCase` for Components/Classes, `kebab-case` for folders/routes.
- **Dart**: always `snake_case` for filenames.
- **Python**: always `snake_case`.
2. **Barrel Files**: Avoid them for internal usage (causes circular deps). Use them ONLY to expose a Feature's public API to the rest of the app:
- *Right*: `import { LoginForm } from '@/features/auth'` (where `features/auth/index.ts` exists).
- *Wrong*: `import { Button } from '@/components'` (import directly: `@/components/Button`).
## Self-Correction Checklist
Before creating a file, ask:
1. "Is this file specific to one feature (e.g., 'Delete Task Button')?" -> Put in `features/tasks/components`.
2. "Is this file generic (e.g., 'Red Delete Button')?" -> Put in `components/ui`.
3. "Is this file a page?" -> Put in `app/` (Next.js) or `screens/` (Flutter), but keep it empty (logic goes to feature).Related Skills
structure
Design data structures before implementation. Maps existing code or creates new types.
infrastructure-documenter
Expert guide for documenting infrastructure including architecture diagrams, runbooks, system documentation, and operational procedures. Use when creating technical documentation for systems and deployments.
Architecting Solutions
Analyzes problems and designs system architecture before implementation. Activates when user asks design questions, discusses architecture, or needs to break down complex features. Creates clear specifications following the brick philosophy of simple, modular, regeneratable components.
analyze-code-structure
Examine code organization and identify structural patterns. Use when reviewing module design.
agentic-structure
Collaborative programming framework for production-ready development. Use when starting features, writing code, handling security/errors, adding comments, discussing requirements, or encountering knowledge gaps. Applies to all development tasks for clear, safe, maintainable code.
abp-infrastructure-patterns
ABP Framework cross-cutting patterns including authorization, background jobs, distributed events, multi-tenancy, and module configuration. Use when: (1) defining permissions, (2) creating background jobs, (3) publishing/handling distributed events, (4) configuring modules.
architecting
Architects new features through the full lifecycle. Use when designing, planning, implementing, or extending features. Triggers on 'new feature', 'design', 'plan', 'implement', 'architect', 'prd', 'spec'.
data-structure-protocol
Give agents persistent structural memory of a codebase — navigate dependencies, track public APIs, and understand why connections exist without re-reading the whole repo.
architecting-data
Strategic guidance for designing modern data platforms, covering storage paradigms (data lake, warehouse, lakehouse), modeling approaches (dimensional, normalized, data vault, wide tables), data mesh principles, and medallion architecture patterns. Use when architecting data platforms, choosing between centralized vs decentralized patterns, selecting table formats (Iceberg, Delta Lake), or designing data governance frameworks.
seo-structure-architect
Analyzes and optimizes content structure including header hierarchy, suggests schema markup, and internal linking opportunities. Creates search-friendly content organization.
architecting-database-schema
Defines schema, attributes, indexes, and enums for Tourly collections. Use when setting up the database in Appwrite.
structured-prompt-writer
结构化AI提示词写作工具,内置395+提示词模板。支持详细模式和简单模式。用于创建专业的AI角色提示词、系统提示词或任务提示词。当用户需要:(1) 创建新的AI提示词/Prompt (2) 设计AI角色/Persona (3) 编写系统提示词 (4) 优化现有提示词结构时使用此技能。