agentleFS
Workshop-VenturesWorkshop-Ventures/skills/frontend-scaffolding/SKILL.md

frontend-scaffolding

Skill1 starsChanged 10 months agoMITView on GitHub

Scaffold a React frontend with Tailwind CSS, React Router, React Query, and standard project structure. Use when asked to "create a frontend", "scaffold webapp", "set up React app", or "initialize frontend structure".

  • Reads credentials
  • Installs packages

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check API connection: Ensure backend is running on http://localhost:3333

    line 134
  2. Very specific:

    API layer separation: Keep API functions in api/, hooks in hooks/

    line 140
  3. Distinctive:

    Type everything: Use TypeScript for all props and functions

    line 143
  4. Distinctive:

    Handle loading/error states: Always show appropriate UI

    line 145
  5. Distinctive:

    Consistent query keys: Use predictable patterns for cache invalidation

    line 147

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Frontend Scaffolding

Scaffold a React frontend with Tailwind CSS v4, React Router v6, React Query (TanStack Query), Axios API client, and established patterns.

Structure Overview

apps/webapp/src/
├── app/
│   └── app.tsx              # Main app component with routes
├── api/
│   ├── client.ts            # Axios client configuration
│   └── {resource}.ts        # Resource-specific API functions
├── components/
│   ├── common/              # Shared components (Button, Card, etc.)
│   ├── layouts/             # Layout components
│   └── nav/                 # Navigation components
├── pages/
│   └── Home.tsx             # Page components
├── hooks/
│   └── use{Resource}.ts     # React Query hooks
├── lib/
│   └── queryClient.ts       # React Query client
├── styles.css               # Global styles and Tailwind theme
└── main.tsx                 # Application entry point

Installation

npm install react react-dom react-router-dom axios @tanstack/react-query
npm install -D tailwindcss @tailwindcss/vite

Implementation Steps

1. Main Entry Point (main.tsx)

import { StrictMode } from 'react';
import * as ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { QueryClientProvider } from '@tanstack/react-query';

import App from './app/app';
import { queryClient } from './lib/queryClient';

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
  <StrictMode>
    <QueryClientProvider client={queryClient}>
      <BrowserRouter>
        <App />
      </BrowserRouter>
    </QueryClientProvider>
  </StrictMode>
);

2. React Query Client (lib/queryClient.ts)

import { QueryClient } from '@tanstack/react-query';

export const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      staleTime: 60 * 1000, // 1 minute
      retry: 1,
    },
  },
});

3. API Client (api/client.ts)

import axios from 'axios';

const API_BASE_URL = process.env.NX_API_URL || 'http://localhost:3333';

export const apiClient = axios.create({
  baseURL: API_BASE_URL,
  headers: { 'Content-Type': 'application/json' },
});

apiClient.interceptors.response.use(
  (response) => response,
  (error) => {
    const message = error.response?.data?.message || error.message || 'An error occurred';
    console.error('API Error:', message);
    return Promise.reject(error);
  }
);

4. App Component (app/app.tsx)

import { Route, Routes } from 'react-router-dom';
import Home from '../pages/Home';

export function App() {
  return (
    <Routes>
      <Route path="/" element={<Home />} />
    </Routes>
  );
}

export default App;

5. Global Styles, Components, and Hooks

See references/examples.md for complete code examples including:

  • Tailwind CSS v4 theme configuration with design tokens
  • Navigation components (NavButton, HeaderNav)
  • Common components (Button, Card, LoadingSpinner)
  • Example API module and React Query hooks
  • Page with data fetching pattern
  • Form with mutation pattern

Checklist

  1. Install dependencies: npm install
  2. Start frontend: just serve-webapp
  3. Test home page: Open http://localhost:4200
  4. Check API connection: Ensure backend is running on http://localhost:3333

Best Practices

  1. Use Tailwind CSS: Style with utility classes, no component libraries
  2. Design tokens in CSS variables: Define colors in :root, extend with @theme
  3. API layer separation: Keep API functions in api/, hooks in hooks/
  4. React Query for server state: Wrap API calls with useQuery and useMutation
  5. Keep pages thin: Extract route params, render feature components
  6. Type everything: Use TypeScript for all props and functions
  7. Import types from @{project}/types: Share types with backend
  8. Handle loading/error states: Always show appropriate UI
  9. Use className prop: Allow style overrides on components
  10. Consistent query keys: Use predictable patterns for cache invalidation

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.