算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
windsurf-rules【设计与创意】Windsurf rules are Markdown files that tell the Cascade AI agent in the Windsurf IDE (now branded Devin Desktop) how to work in a project: stack, code style, architecture and things to avoid. Use when a user asks to set up .windsurfrules or .windsurf/rules, write global or workspace rules for Windsurf, scope a rule to certain files, share coding stan…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Rules are persistent instructions that Cascade (the AI agent in the Windsurf IDE) receives while it works. Windsurf is now published as Devin Desktop (by Cognition); the docs and UI use that name, but the same Cascade rules system, the .windsurf/ directory and the legacy .windsurfrules file are still supported, so this skill keeps the Windsurf name.
Rules come at four levels: a global file, per-rule files in the workspace, AGENTS.md files in any directory, and system-level files deployed by IT. Each workspace rule has an activation mode that decides when its text enters the context window, so a rule costs nothing until it is relevant.
| Scope | Location | Notes |
|---|---|---|
| Global | ~/.codeium/windsurf/memories/global_rules.md | One file, always on, all workspaces. Limit 6,000 characters. |
| Workspace | .devin/rules/*.md (preferred) or .windsurf/rules/*.md | One file per rule, each with an activation mode. Limit 12,000 characters per file. |
| Directory | AGENTS.md (or agents.md) in any folder | No frontmatter. Root file is always on; a subfolder file applies only to files inside that folder. |
| Legacy | .windsurfrules at the workspace root | Single plain Markdown file, still read. Prefer separate rule files for new work. |
| System (enterprise) | /etc/devin/rules/ (Linux), /Library/Application Support/Devin/rules/ (macOS), C:\ProgramData\Devin\rules\ (Windows) | Deployed by IT, read-only; Windsurf directories are the legacy fallback. |
Rules are discovered in the workspace, its subdirectories and parent directories up to the git root. Create rules from the UI (the Customizations icon in the Cascade panel, then Rules, then + Global or + Workspace) or write the files by hand and commit them.
Each file in .devin/rules/ starts with frontmatter whose trigger field picks the mode:
trigger: | When the rule reaches Cascade |
|---|---|
always_on | Full text in the system prompt on every message |
model_decision | Only the description is shown; Cascade reads the file when it judges it relevant |
glob | When Cascade reads or edits a file matching globs (for example src/**/*.ts) |
manual | Only when you type @rule-name in the Cascade input |
mkdir -p .devin/rules
---
trigger: always_on
---
# Stack and conventions
- Frontend: React 19, TypeScript strict mode, Vite, Tailwind CSS
- Backend: Node.js 22, Fastify, Prisma, PostgreSQL
- Named exports only; default exports just for page components
- Business logic in `src/services/`; components stay thin
- Environment variables are read only through `src/config/env.ts`
---
trigger: glob
globs: "**/*.test.ts"
---
- Use `describe`/`it` blocks with Vitest
- Mock external HTTP calls, never internal modules
- Test file sits next to the source: `Button.tsx` and `Button.test.tsx`
## Component pattern
export function UserCard({ userId, onSelect }: UserCardProps) { ... } // correct
export default function ({ user, click }) { ... } // avoid
useEffect for data fetching (use TanStack Query), no hardcoded API URLs, no hand-written migrations (use prisma migrate dev).my-shop/
AGENTS.md # always on: project-wide conventions
frontend/AGENTS.md # applies only when working under frontend/
backend/AGENTS.md
Plain Markdown, no frontmatter. The same file is also read by other agents (Codex, Claude Code and others), so it is a good place for rules you want shared across tools.
global_rules.md) hold personal habits that apply everywhere, for example "flag security concerns proactively" or "explain tradeoffs when several approaches exist".~/.codeium/windsurf/memories/, per workspace, never committed. They apply to the legacy Cascade agent only; the Devin Local agent does not keep memories. For anything the team should rely on, write a rule or AGENTS.md instead..devin/workflows/*.md, run as /workflow-name) are manual runbooks. Skills (.devin/skills/<name>/SKILL.md, with optional scripts and templates) are picked by the model or by @name. Use a skill when a task needs supporting files; use a rule for a constraint.User request: "Set up Windsurf rules for our FastAPI service so Cascade stops writing sync database code."
Create .devin/rules/backend.md:
---
trigger: glob
globs: "app/**/*.py"
---
# Backend API (Python 3.12, FastAPI, SQLAlchemy 2.0 async, Alembic)
- Use `async def` for route handlers and every database call
- Dependencies come from FastAPI `Depends()`; routers call services, services call repositories
- Pydantic v2 schemas live in `app/schemas/`, models in `app/models/`
- Settings come from a Pydantic settings class in `app/config.py`, validated at startup
- Never catch bare `Exception`; no business logic inside Pydantic validators
- Tests: pytest with pytest-asyncio; lint and format with Ruff
Result: the rule is applied when Cascade reads or edits a .py file under app/, and costs no context during frontend work.
User request: "Our repo has a 400-line .windsurfrules. Cascade ignores half of it."
Split it by topic into files under .devin/rules/: stack.md (trigger: always_on, under 60 lines), react.md (trigger: glob, globs: "src/**/*.tsx"), testing.md (trigger: glob, globs: "**/*.test.*") and release.md (trigger: manual, called with @release). Delete duplicated or generic lines, keep each file under 12,000 characters, then git add .devin/rules && git commit -m "Split Windsurf rules by topic". Result: less always-on text, so the lines that remain are followed more reliably.
.devin/rules/ for new rules; .windsurf/rules/ and .windsurfrules keep working. If both exist for the same workspace, .devin/ takes precedence.always_on sparingly, since it is paid on every message; scope the rest with glob, model_decision or manual.AGENTS.md to git so the team shares them; global rules and memories stay on one machine.AGENTS.md rules; the docs describe them as combined context, so conflicting lines confuse the model.