AGENT SKILL

windsurf-reference-architecture

Implement Windsurf reference architecture with best-practice project layout. Use when designing new Windsurf integrations, reviewing project structure, or establishing architecture standards for Windsurf applications. Trigger with phrases like "windsurf architecture", "windsurf best practices", "windsurf project structure", "how to organize windsurf", "windsurf layout".

License 许可
MIT
最近更新
2026-05-26
Stars
★ 0
Forks
0

01 前言 Front Matter

name
windsurf-reference-architecture
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
version
1.0.0
description
Implement Windsurf reference architecture with best-practice project layout. Use when designing new Windsurf integrations, reviewing project structure, or establishing architecture standards for Windsurf applications. Trigger with phrases like "windsurf architecture", "windsurf best practices", "windsurf project structure", "how to organize windsurf", "windsurf layout".
allowed-tools
Read, Grep
compatible-with
claude-code, codex, openclaw

03 SKILL.md 正文

Windsurf Reference Architecture

Overview

Project architecture optimized for Windsurf (Codeium) AI-assisted development. Covers workspace configuration, Cascade AI flow optimization, rules files for context, and team standardization patterns.

Prerequisites

  • Windsurf IDE installed
  • Team agreement on coding standards
  • Repository with consistent project structure
  • Understanding of Cascade AI flows

Architecture Diagram

┌──────────────────────────────────────────────────────┐
│              Windsurf Workspace                       │
│  ┌───────────────┐  ┌────────────────────────────┐    │
│  │ .windsurfrules│  │ .windsurf/settings.json    │    │
│  │ (AI context)  │  │ (IDE configuration)        │    │
│  └───────────────┘  └────────────────────────────┘    │
├──────────────────────────────────────────────────────┤
│              Cascade AI Engine                        │
│  ┌───────────┐  ┌───────────┐  ┌─────────────────┐   │
│  │ Inline    │  │ Chat      │  │ Multi-file      │   │
│  │ Complete  │  │ (Cascade) │  │ Edit            │   │
│  └───────────┘  └───────────┘  └─────────────────┘   │
├──────────────────────────────────────────────────────┤
│              Project Structure                        │
│  src/ │ tests/ │ docs/ │ .windsurf/ │ .windsurfrules │
├──────────────────────────────────────────────────────┤
│              Indexing Engine                           │
│  Semantic Index │ File Cache │ Dependency Graph       │
└──────────────────────────────────────────────────────┘

Instructions

Step 1: Create Windsurf Rules File

<!-- .windsurfrules - Project context for Cascade AI -->

# Project: MyApp

## Tech Stack
- Framework: Next.js 14 (App Router)
- Language: TypeScript (strict mode)
- Styling: Tailwind CSS v3
- State: Zustand
- Testing: Vitest + React Testing Library
- Database: PostgreSQL with Drizzle ORM

## Architecture Patterns
- Server Components by default, Client Components only when needed
- API routes in app/api/ using Route Handlers
- Shared types in types/ directory
- Business logic in services/ directory
- Database queries in db/ directory

## Coding Standards
- Named exports only, never default exports
- Use async/await, never raw Promises
- All functions must have JSDoc comments
- Error handling: use Result pattern, never throw in services
- Use zod for all runtime validation

Step 2: Configure Workspace Settings

{
  "codeium.indexing.excludePatterns": [
    "node_modules/**",
    ".next/**",
    "dist/**",
    "coverage/**",
    "*.min.js",
    "**/*.map"
  ],
  "codeium.autocomplete.enable": true,
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "biomejs.biome",
  "typescript.tsdk": "node_modules/typescript/lib",
  "files.associations": {
    "*.css": "tailwindcss"
  }
}

Step 3: Team Configuration Template

// .windsurf/team-config.json - Shared team settings
{
  "cascade": {
    "preferredModels": ["claude-sonnet", "gpt-4o"],
    "contextRules": {
      "maxContextFiles": 15,
      "preferOpenTabs": true,
      "includeTestFiles": true,
      "includeTypeDefinitions": true
    },
    "codeGeneration": {
      "language": "typescript",
      "strictMode": true,
      "includeTypes": true,
      "includeTests": false
    }
  },
  "formatting": {
    "tabSize": 2,
    "useTabs": false,
    "trailingComma": "all",
    "singleQuote": true,
    "printWidth": 100
  }
}

Step 4: Project-Specific Context Files

// .windsurf/patterns.md - Common patterns for Cascade
/**
 * API Route Pattern:
 * ```typescript
 * export async function GET(req: NextRequest) {
 *   const params = searchParamsSchema.parse(Object.fromEntries(req.nextUrl.searchParams));
 *   const result = await service.find(params);
 *   return NextResponse.json(result);
 * }
 * ```
 *
 * Service Pattern:
 * ```typescript
 * export async function findById(id: string): Promise<Result<Entity, AppError>> {
 *   const entity = await db.query.entities.findFirst({ where: eq(entities.id, id) });
 *   if (!entity) return err(new NotFoundError('Entity', id));
 *   return ok(entity);
 * }
 * ```
 */

Error Handling

Issue Cause Solution
Cascade ignores rules File not at project root Place .windsurfrules in workspace root
Slow indexing Large repo with no excludes Add node_modules and dist to excludes
Inconsistent suggestions No team config Create shared .windsurf/ directory
Wrong framework patterns Missing context Add framework details to rules file

Examples

Monorepo Rules File

<!-- .windsurfrules for monorepo -->
# Monorepo Structure
- packages/api - Express REST API (Node.js)
- packages/web - Next.js frontend
- packages/shared - Shared TypeScript types and utilities
- packages/db - Database schema and migrations (Drizzle)

When editing files in packages/api, use Express patterns.
When editing files in packages/web, use Next.js App Router patterns.
Always import from @repo/shared for shared types.

Resources

Output

  • Configuration files or code changes applied to the project
  • Validation report confirming correct implementation
  • Summary of changes made and their rationale

04 同仓库更多 Skills

SamuelChien
SamuelChien/mega-skills-collection

zustand-store-ts

Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zustand-store-creator

Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zero-trust-config-helper

Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zapier-integration-helper

Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zai-cli

Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

yt-research

Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.

★ 0