Skip to content
Skills Library
Programming · Building & coding

template-code-generator

/template-code-generator

Generate boilerplate code and project templates/skeletons automatically. Use when: (1) Creating new projects from scratch (React app, FastAPI backend, Express API), (2) Generating repetitive code patterns (CRUD endpoints, models, controllers), (3) Scaffolding components, services, or modules, (4) Creating test boilerplate, (5) Setting up monorepo structures. Provides project templates and code generation patterns for common development tasks.

Repository
Skills-4-SE ↗
Licence
Apache-2.0
Last repository change
21.08.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 21.08.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Generate boilerplate code and project templates/skeletons automatically. Use when: (1) Creating new projects from scratch (React app, FastAPI backend, Express API), (2) Generating repetitive code patterns (CRUD endpoints, models, controllers), (3) Scaffolding components, services, or modules, (4) Creating test boilerplate, (5) Setting up monorepo structures. Provides project templates and code generation patterns for common development tasks.

Original author description

Generate boilerplate code and project templates/skeletons automatically. Use when: (1) Creating new projects from scratch (React app, FastAPI backend, Express API), (2) Generating repetitive code patterns (CRUD endpoints, models, controllers), (3) Scaffolding components, services, or modules, (4) Creating test boilerplate, (5) Setting up monorepo structures. Provides project templates and code generation patterns for common development tasks.

How it works

  1. Quick Start
  2. Project Templates
  3. Code Generation Patterns
  4. Generation Workflow
  5. Best Practices
  6. Common Scenarios
  7. Reference Documentation
Original SKILL.md headings · 404 lines, 1,074 words
SKILL.md preview
---
name: template-code-generator
description: "Generate boilerplate code and project templates/skeletons automatically. Use when: (1) Creating new projects from scratch (React app, FastAPI backend, Express API), (2) Generating repetitive code patterns (CRUD endpoints, models, controllers), (3) Scaffolding components, services, or modules, (4) Creating test boilerplate, (5) Setting up monorepo structures. Provides project templates and code generation patterns for common development tasks."
---

# Template Code Generator

Generate boilerplate code and complete project skeletons automatically, accelerating development with battle-tested templates.

## Quick Start

### Generate Complete Projects

**React Application**:
```bash
# Use assets/react-app as template base
# Includes: Vite, TypeScript, React Router, standard structure
```

**FastAPI Backend**:
```bash
# Complete API structure with:
# - Route organization
# - CRUD patterns
# - Database models
# - Pydantic schemas
```

**Express/TypeScript API**:
```bash
# Production-ready structure:
# - Controllers/Services pattern
# - Middleware setup
# - Error handling
# - Type safety
```

See **[template_patterns.md](references/template_patterns.md)** for complete project structures.

### Generate Code Patterns

**CRUD Endpoints**:
```typescript
// Generates complete REST endpoints with validation
router.get('/', controller.getAll);
router.post('/', validate(schema), controller.create);
router.put('/:id', validate(schema), controller.update);
router.delete('/:id', controller.delete);
```

**React Components**:
```typescript
// Functional component with TypeScript props
export const ComponentName: React.FC<Props> = ({ prop1, prop2 }) => {
  return <div>{/* content */}</div>;
};
```

See **[code_patterns.md](references/code_patterns.md)** for all code generation patterns.

## Project Templates

### Web Applications

**React/TypeScript SPA**
- Vite build system
- React Router setup
- Custom hooks (useFetch, useAuth)
- Component structure (common, layout, pages)
- Type-safe API client
- Environment configuration

**Full-Stack Monorepo**
- Turborepo setup
- Frontend (React) + Backend (Express/FastAPI)
- Shared packages (types, utils, UI components)
- Coordinated build pipeline

### Backend Services

**FastAPI Application**
- Modular API structure (v1 routing)
- CRUD base classes
- Pydantic schemas
- Database models (SQLAlchemy/Prisma)
- Dependency injection
- Authentication/Authorization setup

**Express/TypeScript API**
- MVC architecture
- Service layer pattern
- Middleware (auth, validation, error handling)
- TypeORM/Prisma integration
- Request/response typing

### CLI Tools

**Python CLI (Click)**
- Command structure
- Subcommands pattern
- Configuration management
- Progress indicators
- Installation via setuptools

## Code Generation Patterns

### Classes and Models

**TypeScript Interface + Class**:
```typescript
interface User {
  id: number;
  email: string;
  name: string;
}

class UserModel implements User {
  constructor(
    public id: number,
    public email: string,
    public name: string
  ) {}

  toJSON(): User {
    return { id: this.id, email: this.email, name: this.name };
  }
}
```

**Python Dataclass**:
```python
@dataclass
class User:
    id: int
    email: str
    name: str
    created_at: datetime = field(default_factory=datetime.now)

    def to_dict(self) -> dict:
        return asdict(self)
```

### API Endpoints

**REST CRUD (Express)**:
```typescript
class UserController {
  async getAll(req: Request, res: Response) {
    const users = await userService.findAll();
    res.json(users);
  }

  async create(req: Request, res: Response) {
    const user = await userService.create(req.body);
    res.status(201).json(user);
  }

  // ... getById, update, delete
}
```

**FastAPI Endpoints**:
```python
@router.get("/", response_model=List[User])
def read_users(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
    return crud_user.get_multi(db, skip=skip, limit=limit)

@router.post("/", response_model=User)
def create_user(user_in: UserCreate, db: Session = Depends(get_db)):
    return crud_user.create(db, obj_in=user_in)
```

### Components

**React Functional Component**:
```typescript
interface ButtonProps {
  label: string;
  onClick: () => void;
  variant?: 'primary' | 'secondary';
}

export const Button: React.FC<ButtonProps> = ({ label, onClick, variant = 'primary' }) => {
  return (
    <button className={`btn btn-${variant}`} onClick={onClick}>
      {label}
    </button>
  );
};
```

**Custom Hook**:
```typescript
function useLocalStorage<T>(key: string, initialValue: T) {
  const [value, setValue] = useState<T>(() => {
    const stored = localStorage.getItem(key);
    return stored ? JSON.parse(stored) : initialValue;
  });

  useEffect(() => {
    localStorage.setItem(key, JSON.stringify(value));
  }, [key, value]);

  return [value, setValue] as const;
}
```

### Tests

**Jest Test Suite**:
```typescript
describe('UserService', () => {
  it('should create user', async () => {
    const userData = { email: 'test@example.com', name: 'Test' };
    const user = await userService.create(userData);
    expect(user.email).toBe(userData.email);
  });

  it('should throw on duplicate email', async () => {
    await expect(userService.create({ email: 'existing@test.com' }))
      .rejects.toThrow();
  });
});
```

**Pytest Suite**:
```python
class TestUserService:
    def test_create_user(self, db_session):
        user_data = UserCreate(email="test@example.com", name="Test")
        user = crud_user.create(db_session, obj_in=user_data)
        assert user.email == user_data.email

    def test_duplicate_email_raises_error(self, db_session):
        with pytest.raises(ValueError):
            crud_user.create(db_session, obj_in=duplicate_data)
```

## Generation Workflow

### 1. Identify Need

Determine what to generate:
- **Complete project**: Use project templates
- **Specific pattern**: Use code generators
- **Boilerplate**: Combine templates + patterns

### 2. Select Template/Pattern

Choose appropriate template:
- **Frontend**: React app template
- **Backend**: FastAPI or Express template
- **Full-stack**: Monorepo template
- **Code**: Specific pattern (CRUD, component, test)

### 3. Customize

Adapt template to requirements:
- Replace placeholder names
- Add/remove features
- Configure dependencies
- Update structure

### 4. Generate

Create the code:
- Copy template structure
- Generate code patterns
- Fill in details
- Add configurations

### 5. Verify

Check generated code:
- Syntax correctness
- Type safety
- Dependencies installed
- Tests passing

## Best Practices

### 1. Follow Project Conventions

Match existing code style:
```typescript
// Match naming: camelCase, PascalCase, snake_case
// Match structure: file organization, folder naming
// Match patterns: error handling, validation
```

### 2. Include Type Safety

Add type annotations:
```typescript
// TypeScript
interface Props { ... }
function component(props: Props): JSX.Element { ... }

// Python
def function(param: str) -> dict[str, Any]: ...
```

### 3. Generate Tests Alongside Code

Create test boilerplate with implementation:
```
src/
  services/userService.ts
tests/
  services/userService.test.ts
```

### 4. Use Consistent Patterns

Apply same patterns across codebase:
- Error handling approach
- Validation strategy
- Naming conventions
- File structure

### 5. Document Generated Code

Add comments explaining:
```typescript
/**
 * UserService handles all user-related operations.
 * Uses repository pattern for data access.
 */
export class UserService {
  // Implementation
}
```

## Common Scenarios

### Scenario 1: New React Component

**Request**: "Create a UserCard component that displays user info"

**Generate**:
```typescript
interface UserCardProps {
  user: {
    name: string;
    email: string;
    avatar?: string;
  };
  onEdit?: () => void;
}

export const UserCard: React.FC<UserCardProps> = ({ user, onEdit }) => {
  return (
    <div className="user-card">
      {user.avatar && <img src={user.avatar} alt={user.name} />}
      <h3>{user.name}</h3>
      <p>{user.email}</p>
      {onEdit && <button onClick={onEdit}>Edit</button>}
    </div>
  );
};
```

### Scenario 2: CRUD Endpoints

**Request**: "Generate CRUD endpoints for Product model"

**Generate**:
- Routes file with all endpoints
- Controller with CRUD methods
- Service layer implementation
- Validation schemas
- Test suite

### Scenario 3: New Project

**Request**: "Create a new FastAPI backend with PostgreSQL"

**Generate**:
- Complete project structure
- Database configuration
- Initial models and schemas
- CRUD base classes
- Authentication setup
- Docker configuration
- Tests setup

## Reference Documentation

### Project Templates
See **[template_patterns.md](references/template_patterns.md)** for:
- React/TypeScript Application
- FastAPI Backend
- Express/TypeScript API
- Python CLI Tool
- Full-Stack Monorepo
- Complete file structures and core files

### Code Patterns
See **[code_patterns.md](references/code_patterns.md)** for:
- Class generators (TypeScript, Python)
- API endpoint patterns (REST, GraphQL)
- Component generators (React, Vue)
- Test generators (Jest, pytest)
- Database models (TypeORM, SQLAlchemy)
- Service classes
- Middleware patterns
- Validation schemas (Zod, Pydantic)
Files in this package (4)
  • SKILL.md 9 KB
  • assets/react-app/package.json 1 KB
  • references/code_patterns.md 11 KB
  • references/template_patterns.md 17 KB

Versions

The database has no other skills named template-code-generator.

Database snapshot: 13.11.2026 · package version a6539057467f (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90scaffold
    Project scaffolding - generate boilerplate for common project types with best-practice defaults. Use for: scaffold, boilerplate, template, new project, init, create project, starter, setup, project structure, directory structure, monorepo, microservice, API template, web app…
  • 96base-template-generator
    Use this agent when you need to create foundational templates, boilerplate code, or starter configurations for new projects, components, or features. This agent excels at generating clean, well-str...
  • 100fastapi-templates
    Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
  • 100scaffolding-generator
    Pattern-aware code scaffolding that detects existing conventions and generates new components matching the codebase style. Use when asked to \"scaffold a component\", \"generate boilerplate\", \"create a new module\", \"bootstrap a service\", \"add a new endpoint\", \"create a…
  • 100fastapi-templates
    Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
  • 91stack-backend
    Backend conventions for the FastAPI + React stack (app/, Python 3.12, FastAPI, uv, pytest). Use when creating or changing endpoints, services, schemas, tests or Python dependencies.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.