---
description: Create a full-stack SmartStack project (Clean Architecture .NET + React/Vite/Tailwind)
argument-hint: <project-name> [description]
---

# Create SmartStack Project

Scaffold a complete full-stack project with:
- **Backend**: .NET 10 Clean Architecture (Domain, Application, Infrastructure, Api)
- **Frontend**: React 19 + TypeScript + Vite + Tailwind CSS

## Arguments

Parse from `$ARGUMENTS`:
- **name** (required): Project name in PascalCase (e.g., `MyProject`)
- **description** (optional): Project description

## Project Structure

```
{ProjectName}/
├── .gitignore
├── .claudeignore
├── README.md
├── CLAUDE.md
├── LICENSE
├── Directory.Build.props
├── {ProjectName}.sln
│
├── src/
│   ├── {ProjectName}.Domain/
│   │   ├── {ProjectName}.Domain.csproj
│   │   ├── Common/
│   │   │   ├── BaseEntity.cs
│   │   │   ├── IAuditableEntity.cs
│   │   │   └── IDomainEvent.cs
│   │   ├── Entities/
│   │   ├── Enums/
│   │   ├── Exceptions/
│   │   │   └── DomainException.cs
│   │   └── ValueObjects/
│   │
│   ├── {ProjectName}.Application/
│   │   ├── {ProjectName}.Application.csproj
│   │   ├── Common/
│   │   │   ├── Behaviors/
│   │   │   │   ├── ValidationBehavior.cs
│   │   │   │   └── LoggingBehavior.cs
│   │   │   ├── Interfaces/
│   │   │   │   ├── IApplicationDbContext.cs
│   │   │   │   └── ICurrentUserService.cs
│   │   │   └── Models/
│   │   │       └── Result.cs
│   │   ├── Features/
│   │   │   └── .gitkeep
│   │   └── DependencyInjection.cs
│   │
│   ├── {ProjectName}.Infrastructure/
│   │   ├── {ProjectName}.Infrastructure.csproj
│   │   ├── Persistence/
│   │   │   ├── ApplicationDbContext.cs
│   │   │   ├── Configurations/
│   │   │   │   └── .gitkeep
│   │   │   ├── Migrations/
│   │   │   │   └── .gitkeep
│   │   │   └── Seeding/
│   │   │       └── DatabaseSeeder.cs
│   │   ├── Services/
│   │   │   └── DateTimeService.cs
│   │   └── DependencyInjection.cs
│   │
│   ├── {ProjectName}.Api.Core/
│   │   ├── {ProjectName}.Api.Core.csproj
│   │   ├── Controllers/
│   │   │   └── BaseApiController.cs
│   │   ├── Extensions/
│   │   │   └── ServiceCollectionExtensions.cs
│   │   ├── Middleware/
│   │   │   └── ExceptionHandlingMiddleware.cs
│   │   └── Hubs/
│   │       └── NotificationHub.cs
│   │
│   └── {ProjectName}.Api/
│       ├── {ProjectName}.Api.csproj
│       ├── Properties/
│       │   └── launchSettings.json
│       ├── appsettings.json
│       ├── appsettings.Development.json
│       ├── appsettings.Production.json
│       └── Program.cs
│
├── web/
│   └── {project-name}-web/
│       ├── package.json
│       ├── tsconfig.json
│       ├── tsconfig.app.json
│       ├── tsconfig.node.json
│       ├── vite.config.ts
│       ├── eslint.config.mjs
│       ├── tailwind.config.js
│       ├── postcss.config.js
│       ├── index.html
│       ├── .env.example
│       └── src/
│           ├── main.tsx
│           ├── App.tsx
│           ├── index.css
│           ├── vite-env.d.ts
│           ├── components/
│           │   ├── layout/
│           │   │   ├── Header.tsx
│           │   │   ├── Sidebar.tsx
│           │   │   └── Footer.tsx
│           │   └── ui/
│           │       ├── Button.tsx
│           │       └── Card.tsx
│           ├── pages/
│           │   ├── HomePage.tsx
│           │   └── NotFoundPage.tsx
│           ├── hooks/
│           │   └── useApi.ts
│           ├── contexts/
│           │   ├── AuthContext.tsx
│           │   └── ThemeContext.tsx
│           ├── services/
│           │   └── api/
│           │       └── client.ts
│           ├── types/
│           │   └── index.ts
│           ├── utils/
│           │   └── helpers.ts
│           └── config/
│               └── constants.ts
│
├── tests/
│   └── {ProjectName}.Tests/
│       └── {ProjectName}.Tests.csproj
│
└── tools/
    └── .gitkeep
```

## Workflow

### 1. PARSE & VALIDATE

Extract from `$ARGUMENTS`:
```
name: PascalCase project name (e.g., "MyProject")
description: Optional description
```

Validate:
- Name is PascalCase: `^[A-Z][a-zA-Z0-9]*$`
- Directory doesn't exist
- Name is not a reserved word

### 2. CREATE ROOT STRUCTURE

Use Bash to create directories:
```bash
mkdir -p {ProjectName}/src
mkdir -p {ProjectName}/web
mkdir -p {ProjectName}/tests
mkdir -p {ProjectName}/tools
mkdir -p {ProjectName}/scripts
```

### 3. GENERATE BACKEND FILES

For each backend project, use Write tool to create:

#### 3.1 Directory.Build.props
```xml
<Project>
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <Version>1.0.0</Version>
    <Authors>{Author}</Authors>
    <Company>{Company}</Company>
  </PropertyGroup>
</Project>
```

#### 3.2 Solution File ({ProjectName}.sln)
Use `dotnet new sln` and `dotnet sln add` commands.

#### 3.3 Domain Project
- Create .csproj with MediatR.Contracts
- Create BaseEntity.cs, IDomainEvent.cs
- Create folder structure

#### 3.4 Application Project
- Create .csproj with MediatR, FluentValidation
- Create Result.cs, ValidationBehavior.cs
- Create DependencyInjection.cs

#### 3.5 Infrastructure Project
- Create .csproj with EF Core, SqlServer
- Create ApplicationDbContext.cs
- Create DependencyInjection.cs

#### 3.6 Api.Core Project
- Create .csproj with ASP.NET Core
- Create BaseApiController.cs
- Create ExceptionHandlingMiddleware.cs

#### 3.7 Api Project
- Create .csproj as entry point
- Create Program.cs with full bootstrap
- Create appsettings.json files

### 4. GENERATE FRONTEND FILES

#### 4.1 package.json
```json
{
  "name": "{project-name}-web",
  "private": true,
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc -b && vite build",
    "lint": "eslint .",
    "preview": "vite preview"
  },
  "dependencies": {
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "react-router-dom": "^7.0.0",
    "axios": "^1.7.0",
    "@microsoft/signalr": "^8.0.0",
    "lucide-react": "^0.400.0"
  },
  "devDependencies": {
    "@types/react": "^19.0.0",
    "@types/react-dom": "^19.0.0",
    "@vitejs/plugin-react": "^4.3.0",
    "typescript": "~5.6.0",
    "vite": "^6.0.0",
    "tailwindcss": "^4.0.0",
    "@tailwindcss/vite": "^4.0.0",
    "eslint": "^9.0.0"
  }
}
```

#### 4.2 vite.config.ts
```typescript
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'

export default defineConfig({
  plugins: [react(), tailwindcss()],
  server: {
    port: 5173,
    proxy: {
      '/api': 'http://localhost:5000'
    }
  }
})
```

#### 4.3 React Components
- Create App.tsx with router setup
- Create basic layout components
- Create context providers
- Create API client

### 5. GENERATE CONFIGURATION FILES

#### .gitignore
```
# .NET
bin/
obj/
*.user
*.suo
appsettings.Local.json

# Node
node_modules/
dist/
.env.local

# IDE
.vs/
.vscode/
.idea/

# OS
.DS_Store
Thumbs.db

# Logs
*.log
logs/
```

#### CLAUDE.md
```markdown
# {ProjectName} Architecture Memory

## Project Overview
{description}

## Technology Stack
- Backend: .NET 10, EF Core, Clean Architecture
- Frontend: React 19, TypeScript, Vite, Tailwind CSS
- Database: SQL Server

## Architecture
Clean Architecture with CQRS pattern.

## Conventions
- Use MediatR for commands/queries
- Use FluentValidation for validation
- Use Result<T> for operation results
```

### 6. INITIALIZE GIT & DOTNET

```bash
cd {ProjectName}
git init
dotnet new sln -n {ProjectName}
dotnet sln add src/{ProjectName}.Domain
dotnet sln add src/{ProjectName}.Application
dotnet sln add src/{ProjectName}.Infrastructure
dotnet sln add src/{ProjectName}.Api.Core
dotnet sln add src/{ProjectName}.Api
dotnet restore
```

### 7. DISPLAY SUCCESS

```
╔═══════════════════════════════════════════════════════════════╗
║              SMARTSTACK PROJECT CREATED                        ║
╠═══════════════════════════════════════════════════════════════╣
║  Name:      {ProjectName}                                      ║
║  Location:  {full-path}                                        ║
╠═══════════════════════════════════════════════════════════════╣
║  Backend:                                                      ║
║  ✓ {ProjectName}.Domain         (Core entities)                ║
║  ✓ {ProjectName}.Application    (CQRS, Use cases)              ║
║  ✓ {ProjectName}.Infrastructure (EF Core, Services)            ║
║  ✓ {ProjectName}.Api.Core       (Controllers, Middleware)      ║
║  ✓ {ProjectName}.Api            (Entry point)                  ║
╠═══════════════════════════════════════════════════════════════╣
║  Frontend:                                                     ║
║  ✓ {project-name}-web           (React + Vite + Tailwind)      ║
╠═══════════════════════════════════════════════════════════════╣
║  Next steps:                                                   ║
║  1. cd {ProjectName}                                           ║
║  2. dotnet build                                               ║
║  3. cd web/{project-name}-web && npm install                   ║
║  4. Configure appsettings.Local.json                           ║
║  5. dotnet ef database update                                  ║
║  6. dotnet run --project src/{ProjectName}.Api                 ║
║  7. npm run dev (in web folder)                                ║
╚═══════════════════════════════════════════════════════════════╝
```

## File Templates

### Domain/BaseEntity.cs
```csharp
namespace {ProjectName}.Domain.Common;

public abstract class BaseEntity
{
    public Guid Id { get; protected set; } = Guid.NewGuid();
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime? UpdatedAt { get; set; }
    public string? CreatedBy { get; set; }
    public string? UpdatedBy { get; set; }
}
```

### Application/Result.cs
```csharp
namespace {ProjectName}.Application.Common.Models;

public class Result<T>
{
    public bool IsSuccess { get; }
    public T? Value { get; }
    public string? Error { get; }

    private Result(bool isSuccess, T? value, string? error)
    {
        IsSuccess = isSuccess;
        Value = value;
        Error = error;
    }

    public static Result<T> Success(T value) => new(true, value, null);
    public static Result<T> Failure(string error) => new(false, default, error);
}
```

### Infrastructure/ApplicationDbContext.cs
```csharp
using Microsoft.EntityFrameworkCore;
using {ProjectName}.Application.Common.Interfaces;

namespace {ProjectName}.Infrastructure.Persistence;

public class ApplicationDbContext : DbContext, IApplicationDbContext
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ApplyConfigurationsFromAssembly(typeof(ApplicationDbContext).Assembly);
        base.OnModelCreating(modelBuilder);
    }
}
```

### Api/Program.cs
```csharp
using {ProjectName}.Application;
using {ProjectName}.Infrastructure;
using {ProjectName}.Api.Core.Extensions;

var builder = WebApplication.CreateBuilder(args);

// Add services
builder.Services.AddApplication();
builder.Services.AddInfrastructure(builder.Configuration);
builder.Services.AddApiCore();

builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddSignalR();

var app = builder.Build();

// Configure pipeline
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.MapHub<NotificationHub>("/hubs/notifications");

app.Run();
```

### Frontend/App.tsx
```tsx
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { AuthProvider } from './contexts/AuthContext';
import { ThemeProvider } from './contexts/ThemeContext';
import HomePage from './pages/HomePage';
import NotFoundPage from './pages/NotFoundPage';

function App() {
  return (
    <ThemeProvider>
      <AuthProvider>
        <BrowserRouter>
          <Routes>
            <Route path="/" element={<HomePage />} />
            <Route path="*" element={<NotFoundPage />} />
          </Routes>
        </BrowserRouter>
      </AuthProvider>
    </ThemeProvider>
  );
}

export default App;
```

## Execution Rules

1. **ALWAYS** create all directories before files
2. **USE** Write tool for each file (not batch)
3. **USE** Bash for dotnet commands
4. **VALIDATE** project name is PascalCase
5. **NEVER** overwrite existing directories
6. Create files in this order: root → backend → frontend → config

## Priority

Correctness > Completeness > Speed

---

User: $ARGUMENTS
