Project Guidelines Skill (Example)
Add this skill
npx mdskills install sickn33/cc-skill-project-guidelines-exampleComprehensive project template with clear architecture, code patterns, and testing workflows
1---2name: cc-skill-project-guidelines-example3description: Project Guidelines Skill (Example)4author: affaan-m5version: "1.0"6---78# Project Guidelines Skill (Example)910This is an example of a project-specific skill. Use this as a template for your own projects.1112Based on a real production application: [Zenith](https://zenith.chat) - AI-powered customer discovery platform.1314---1516## When to Use1718Reference this skill when working on the specific project it's designed for. Project skills contain:19- Architecture overview20- File structure21- Code patterns22- Testing requirements23- Deployment workflow2425---2627## Architecture Overview2829**Tech Stack:**30- **Frontend**: Next.js 15 (App Router), TypeScript, React31- **Backend**: FastAPI (Python), Pydantic models32- **Database**: Supabase (PostgreSQL)33- **AI**: Claude API with tool calling and structured output34- **Deployment**: Google Cloud Run35- **Testing**: Playwright (E2E), pytest (backend), React Testing Library3637**Services:**38```39┌─────────────────────────────────────────────────────────────┐40│ Frontend │41│ Next.js 15 + TypeScript + TailwindCSS │42│ Deployed: Vercel / Cloud Run │43└─────────────────────────────────────────────────────────────┘44 │45 ▼46┌─────────────────────────────────────────────────────────────┐47│ Backend │48│ FastAPI + Python 3.11 + Pydantic │49│ Deployed: Cloud Run │50└─────────────────────────────────────────────────────────────┘51 │52 ┌───────────────┼───────────────┐53 ▼ ▼ ▼54 ┌──────────┐ ┌──────────┐ ┌──────────┐55 │ Supabase │ │ Claude │ │ Redis │56 │ Database │ │ API │ │ Cache │57 └──────────┘ └──────────┘ └──────────┘58```5960---6162## File Structure6364```65project/66├── frontend/67│ └── src/68│ ├── app/ # Next.js app router pages69│ │ ├── api/ # API routes70│ │ ├── (auth)/ # Auth-protected routes71│ │ └── workspace/ # Main app workspace72│ ├── components/ # React components73│ │ ├── ui/ # Base UI components74│ │ ├── forms/ # Form components75│ │ └── layouts/ # Layout components76│ ├── hooks/ # Custom React hooks77│ ├── lib/ # Utilities78│ ├── types/ # TypeScript definitions79│ └── config/ # Configuration80│81├── backend/82│ ├── routers/ # FastAPI route handlers83│ ├── models.py # Pydantic models84│ ├── main.py # FastAPI app entry85│ ├── auth_system.py # Authentication86│ ├── database.py # Database operations87│ ├── services/ # Business logic88│ └── tests/ # pytest tests89│90├── deploy/ # Deployment configs91├── docs/ # Documentation92└── scripts/ # Utility scripts93```9495---9697## Code Patterns9899### API Response Format (FastAPI)100101```python102from pydantic import BaseModel103from typing import Generic, TypeVar, Optional104105T = TypeVar('T')106107class ApiResponse(BaseModel, Generic[T]):108 success: bool109 data: Optional[T] = None110 error: Optional[str] = None111112 @classmethod113 def ok(cls, data: T) -> "ApiResponse[T]":114 return cls(success=True, data=data)115116 @classmethod117 def fail(cls, error: str) -> "ApiResponse[T]":118 return cls(success=False, error=error)119```120121### Frontend API Calls (TypeScript)122123```typescript124interface ApiResponse<T> {125 success: boolean126 data?: T127 error?: string128}129130async function fetchApi<T>(131 endpoint: string,132 options?: RequestInit133): Promise<ApiResponse<T>> {134 try {135 const response = await fetch(`/api${endpoint}`, {136 ...options,137 headers: {138 'Content-Type': 'application/json',139 ...options?.headers,140 },141 })142143 if (!response.ok) {144 return { success: false, error: `HTTP ${response.status}` }145 }146147 return await response.json()148 } catch (error) {149 return { success: false, error: String(error) }150 }151}152```153154### Claude AI Integration (Structured Output)155156```python157from anthropic import Anthropic158from pydantic import BaseModel159160class AnalysisResult(BaseModel):161 summary: str162 key_points: list[str]163 confidence: float164165async def analyze_with_claude(content: str) -> AnalysisResult:166 client = Anthropic()167168 response = client.messages.create(169 model="claude-sonnet-4-5-20250514",170 max_tokens=1024,171 messages=[{"role": "user", "content": content}],172 tools=[{173 "name": "provide_analysis",174 "description": "Provide structured analysis",175 "input_schema": AnalysisResult.model_json_schema()176 }],177 tool_choice={"type": "tool", "name": "provide_analysis"}178 )179180 # Extract tool use result181 tool_use = next(182 block for block in response.content183 if block.type == "tool_use"184 )185186 return AnalysisResult(**tool_use.input)187```188189### Custom Hooks (React)190191```typescript192import { useState, useCallback } from 'react'193194interface UseApiState<T> {195 data: T | null196 loading: boolean197 error: string | null198}199200export function useApi<T>(201 fetchFn: () => Promise<ApiResponse<T>>202) {203 const [state, setState] = useState<UseApiState<T>>({204 data: null,205 loading: false,206 error: null,207 })208209 const execute = useCallback(async () => {210 setState(prev => ({ ...prev, loading: true, error: null }))211212 const result = await fetchFn()213214 if (result.success) {215 setState({ data: result.data!, loading: false, error: null })216 } else {217 setState({ data: null, loading: false, error: result.error! })218 }219 }, [fetchFn])220221 return { ...state, execute }222}223```224225---226227## Testing Requirements228229### Backend (pytest)230231```bash232# Run all tests233poetry run pytest tests/234235# Run with coverage236poetry run pytest tests/ --cov=. --cov-report=html237238# Run specific test file239poetry run pytest tests/test_auth.py -v240```241242**Test structure:**243```python244import pytest245from httpx import AsyncClient246from main import app247248@pytest.fixture249async def client():250 async with AsyncClient(app=app, base_url="http://test") as ac:251 yield ac252253@pytest.mark.asyncio254async def test_health_check(client: AsyncClient):255 response = await client.get("/health")256 assert response.status_code == 200257 assert response.json()["status"] == "healthy"258```259260### Frontend (React Testing Library)261262```bash263# Run tests264npm run test265266# Run with coverage267npm run test -- --coverage268269# Run E2E tests270npm run test:e2e271```272273**Test structure:**274```typescript275import { render, screen, fireEvent } from '@testing-library/react'276import { WorkspacePanel } from './WorkspacePanel'277278describe('WorkspacePanel', () => {279 it('renders workspace correctly', () => {280 render(<WorkspacePanel />)281 expect(screen.getByRole('main')).toBeInTheDocument()282 })283284 it('handles session creation', async () => {285 render(<WorkspacePanel />)286 fireEvent.click(screen.getByText('New Session'))287 expect(await screen.findByText('Session created')).toBeInTheDocument()288 })289})290```291292---293294## Deployment Workflow295296### Pre-Deployment Checklist297298- [ ] All tests passing locally299- [ ] `npm run build` succeeds (frontend)300- [ ] `poetry run pytest` passes (backend)301- [ ] No hardcoded secrets302- [ ] Environment variables documented303- [ ] Database migrations ready304305### Deployment Commands306307```bash308# Build and deploy frontend309cd frontend && npm run build310gcloud run deploy frontend --source .311312# Build and deploy backend313cd backend314gcloud run deploy backend --source .315```316317### Environment Variables318319```bash320# Frontend (.env.local)321NEXT_PUBLIC_API_URL=https://api.example.com322NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co323NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...324325# Backend (.env)326DATABASE_URL=postgresql://...327ANTHROPIC_API_KEY=sk-ant-...328SUPABASE_URL=https://xxx.supabase.co329SUPABASE_KEY=eyJ...330```331332---333334## Critical Rules3353361. **No emojis** in code, comments, or documentation3372. **Immutability** - never mutate objects or arrays3383. **TDD** - write tests before implementation3394. **80% coverage** minimum3405. **Many small files** - 200-400 lines typical, 800 max3416. **No console.log** in production code3427. **Proper error handling** with try/catch3438. **Input validation** with Pydantic/Zod344345---346347## Related Skills348349- `coding-standards.md` - General coding best practices350- `backend-patterns.md` - API and database patterns351- `frontend-patterns.md` - React and Next.js patterns352- `tdd-workflow/` - Test-driven development methodology353
Full transparency — inspect the skill content before installing.