바이브코딩에선 System prompt 개념과 동일한 rule이란 개념이 존재
글로벌 규칙 (Global Rules) (global_rules.md): 모든 워크스페이스에 공통으로 적용됩니다.
Workspace (Local Rules) (.windsurfrules): 특정 워크스페이스에만 적용됩니다.
채팅창 우측 상단 - customization 누르면 rules 세팅 열림
global 규칙 추가는 코딩시에 항상 적용됨
아래는 work space - 부분 규칙 추가
python.md 라는 이름으로 규칙 추가
아래는 work space - 부분 규칙 설정 전략
Activation mode 종류
위 그림에선 glob로 선정했고 아래처럼 rule을 선정했다.
Activation mode
This rule applies to all *.py files.
Target : when code in Python 3.10+ features (structural pattern matching, union operators, parenthesized context managers) - Implement proper generic types where applicable # Core Development Standards ## Error Handling & Robustness - Implement comprehensive exception handling with specific exception types - Use context managers for resource management - Validate input parameters and return meaningful error messages - Log errors with appropriate severity levels using structured logging # Code Quality Guidelines ## Documentation & Comments - Write comprehensive docstrings for all public functions and classes - Add inline comments for complex algorithms and business logic ## Code Style & Formatting - Follow PEP 8 style guidelines strictly - Use consistent naming conventions (snake_case for functions/variables, PascalCase for classes) # Development Workflow ## Code Quality Verification - Execute linting with ruff or pylint - Format code with black - Verify no security vulnerabilities with bandit - Run static type checking with mypy ## Testing Strategy (context-dependent) ### Baseline Requirements (All Projects) - Validate edge cases and error conditions - Test happy path functionality ### Additional for Production - Integration tests with mocked external services - Performance benchmarks for critical paths - Load testing for concurrent operations ## Deployment Readiness - Test pip package detection and installation - Ensure both CLI and interactive modes function correctly # Development Tools (Optional) Formatting: black(코드 포매터) Linting: ruff(초고속 린터 코드 스타일 분석), pylint(종합 분석 도구) Security: bandit(보안 취약점 스캐너), safety(설치 패키지 보안 위험 관리) Performance: py-spy(프로세스 성능 분석), memory-profiler(메모리 사용량 분석) Test: pytest, coverage Dependency: Poetry ## Production Services - Apply all guidelines strictly - Full documentation and performance optimization - Implement monitoring and logging strategies ## Data Science Projects - Emphasize: Data validation, reproducible results - Use appropriate libraries (pandas, numpy, scikit-learn) - Document data processing steps and assumptions - Handle missing values and edge cases gracefully
프롬프트는 반복되는 말이 많으면 혼란을 가중 시키므로 그 부분을 조심히 한다.
Global Rule (User Rule) (프롬프트 강화 적용)
개발에 항상 적용되는 rule 프롬프트
# Role Professional software engineer developing production-ready services with clean architecture, applying SOLID principles and some GoF Design Patterns, and functional programming concepts optimized for automated development environments. 1. Core Development Standards ## Error Handling & Robustness - Implement exception handling with specific exception types - Validate input parameters - Log errors with appropriate severity levels using structured logging ## Performance & Optimization - Use context7 mcp - Profile code performance for critical paths - Use appropriate data structures and algorithms - Optimize for memory efficiency when handling large datasets - Avoid over-engineering: do not introduce unnecessary abstraction and complexity ## Security Considerations - Use environment variables for sensitive configuration - Implement proper authentication and authorization patterns - Avoid hardcoded secrets and credentials 2. Code Quality Guidelines ## Structure & Maintainability - Single Responsibility: One function, one clear purpose - Keep functions under 20 lines when possible - Use descriptive variable and function names (no abbreviations) - Organize code blocks logically - Organize imports/includes following language conventions - Group related functionality into cohesive modules/packages - Apply appropriate design patterns contextually ## Documentation & Comments - Include parameter types, return types, and example usage in comments - Add clear comments for complex logic and business decisions - Document design decisions and architectural choices ## Code Style & Formatting - Use consistent naming conventions - Maintain line length under 88 characters 3. AI-Assisted Development Guidelines - Provide clear, actionable code suggestions with rationale - Include alternative implementation approaches when relevant - Explain trade-offs between different solutions 4. Development Workflow ## Code Quality Verification - Perform static type checking where applicable ## Testing Strategy (context-dependent, optional) - Write unit tests for all core business logic - Include integration tests for external dependencies ## Deployment Readiness - Verify all dependencies are properly declared - Ensure proper configuration management - Validate environment setup 5. Context-Specific Applications ## Simple Scripts & Prototypes - Prioritize: Type hints, error handling, clean structure - Focus: Quick implementation with maintainable code
rules 선택창 옆에 Workflows가 존재
Workflows는 특정 명령어 설정으로 작업 순서 flows를 정하고 자동으로 작업 진행하는 기능(자유도에 약간의 제한 존재)
참조 링크:
https://www.paulmduvall.com/using-windsurf-rules-workflows-and-memories/
LLM의 이해도를 위하여 수정하려는 코드와 Rule을 언급하며 코드 수정
채팅에서 "@"를 쳐서 해당 코드 이름을 언급하던가, "+"를 클릭하여 필요 파일 선택
클로드코드는 함수나 클래스 하나 단위에서 문제 해결력 최고 -25년5월-
아래 링크는 바이브코딩 도구와 클로드코드를 함께 사용하는 방법이 기재 되있음.
https://velog.io/@path_creator/zed-ai-%EC%9C%88%EB%8F%84%EC%9A%B0-%EC%84%A4%EC%B9%98-%EB%B0%8F-%EC%84%B8%ED%8C%85
참조: https://apidog.com/kr/blog/windsurf-swe-1-kr/
browser 분석 기능 : 해당 브라우저 분석 기능을 클릭하고 해당 브라우저의 프론트앤드를 복사 활용 가능
plan mode 기능 : 현재 구성하려는 프로젝트의 설명을 듣고 이에 맞게 프로젝트의 작업 순서를 구성하여 단기, 시스템 프롬프트를 구성해준다.
ai 채팅창에서 우측 하단의 버튼을 누르고 이에 맞는 프롬프트를 넣으면 됨.
! 주의 : mcp 적용하기 이전에 plan mode가 발동되기 때문에 mcp 적용 이후 새채팅에서 플랜을 짜는식으로 전략을 쓰는 것이 유용
file - > preference -> windsurf setting -> mcp라 검색
open plugin store 메뉴 선택 -> 필요한 mcp 검색
여러 외부 mcp 설치법 리스트 모음
https://himcp.ai/ -- 분야별 MCP 정보 모음
https://smithery.ai/ -- 각 ai의 MCP 정보들과 설치법 + 웹에서 MCP를 테스트 할 수 있는 도구
https://github.com/modelcontextprotocol/servers/tree/main?tab=readme-ov-file -- 각 ai의 MCP 설치법 링크
MCP 설치 방법 3가지
mcp manage plugin json 파일 예제
{ "mcpServers": { "sequential-thinking": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-sequential-thinking" ], "env": {} }, "context7": { "command": "npx", "args": [ "-y", "@upstash/context7-mcp@latest" ], "disabledTools": [] }, "mcp-supermemory-ai": { "command": "npx", "args": [ "-y", "supergateway", "--sse", "https://mcp.supermemory.ai/4dfYOz_KTNMRWCqpcCLXq/sse" ] } }
추천 MCP 설치법
Super Memory
메모리를 체계적으로 저장하는 mcp로 외부에서 따로 설치
링크 : https://mcp.supermemory.ai/
DuckDuckGo Search Server
옛날 정보가 아닌 최근 정보 위주로 인터넷에 접근하여 결과를 보여주는mcp
https://smithery.ai/server/@nickclyde/duckduckgo-mcp-server
사이트에 접속하여, 해당 ai 도구에 맞게 설치
npx -y @smithery/cli@latest install @nickclyde/duckduckgo-mcp-server --client windsurf --key 8bee2c34-a3eb-4cfc-b687-455c6ec5c6ff
위 명령어 터미널이나 power shell에서 설치
sequential-thinking
프롬프트를 읽고 단계적으로 해석하거나 cot화 시키면서 프롬프트 강화하는 mcp -- 사용시 시간이 오래걸리는 단점 발생
아래처럼 mcp_config.json에 sequential-thinking을 추가하여 정착
{ "mcpServers": { "sequential-thinking": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"], "env": {} } }
Markdown Preview Mermaid Support
다이어그램이나 코드의 클래스 구조, 프로젝트의 도식화 등을 markdown 언어로 구성가능
Shortcut menu bar
https://marketplace.visualstudio.com/items?itemName=jerrygoyal.shortcut-menu-bar
indent-rainbow
코드의 들여쓰기 띄워쓰기를 색깔로 표시해주는 띄워쓰기 표시 도구
Code Spell Checker
코드의 잘못된 스펠링 밑줄 쳐줌
Bookmarks
북마크 가능한 익스텐션
Prettier
다른 일반적인 언어의 포맷터
Surround
제어문이나 조건문을 자동 생성
Bracket Pair Colorizer 2
코드의 괄호를 등차별로 다양한 색깔을 입혀줌
Output Colorizer
로그에 색깔을 입혀 가독성에 특화함
Better Colorizer
json이나 git등에 색깔을 입혀 가독성에 특화함
DotENV
env파일에 색깔을 입혀 가독성에 특화함
colorize
css나 프론트앤드에서 색깔 코드 자동으로 색깔로 변환된 하일라이트 쳐줌
Error Lens
실시간 오류를 하이라이트로 표시함
GitLens
VSCode 내에서 GIT 버젼 관리와 코딩을 동시에 수행하는데 가능
git graph
git hub 작업을 flow 그래프 형태로 협업 확인 가능
!!주의 : mcp는 chat 창에서 "@"를 붙이고 mcp 명칭을 불러 활용하는 경우가 많다. 자동으로 mcp가 발동되는 경우도 있지만 안그런경우도 많다.
목표: 트렌드 파악 및 기술 환경 분석
DuckDuckGo MCP 활용
프롬프트 예:
AI 백엔드 서비스에서 가장 많이 사용되는 Python 프레임워크 디렉토리 구조 찾아줘 USE DuckDuckGo MCP
Context7 + Sequential Thinking 조합 활용
프롬프트 예:
FastAPI의 최신 비동기 처리 방법과 WebSocket 구현 방법 알려줘. use context7
SQLAlchemy 2.0의 새로운 ORM 패턴과 성능 최적화 방법 설명해줘. use context7
Sequential Thinking
위에서 조사한 기술들을 바탕으로 실시간 데이터 분석 백엔드 아키텍처를 단계별로 설계해줘. Use Sequential Thinking
고려사항:
- 예상 동시 사용자: 10,000명
- 실시간 데이터 처리량: 초당 1,000건
- 데이터 지연시간: 100ms 이하
- 확장성과 유지보수성 중시
Supermemory에 설계 결정 저장
방금 설계한 아키텍처의 핵심 결정사항들을 내 프로젝트 메모리에 저장해줘:
- 선택한 기술 스택과 이유
- 성능 요구사항
- 아키텍처 패턴 결정 근거
"FastAPI + SQLAlchemy + Redis + Docker를 사용한 최신 프로젝트 구조와 설정 방법 알려줘. use context7"
"Poetry를 사용한 Python 의존성 관리와 가상환경 설정 최신 방법 보여줘. use context7"
"Docker Compose를 사용한 개발 환경 구성 베스트 프랙티스 알려줘. use context7"
"FastAPI의 dependency injection을 사용한 데이터베이스 연결 풀 최적화 방법 알려줘. use context7"
"FastAPI의 ** 서비스 코드 만들어줘. use context7"
사용 이점 :
활용하기에 앞서 auto-generate-memories를 끈다
이후 Workspace에서 memory-bank.md 생성
경로 예 : C:\Users\USER.....windsurf\rules에서 생성
아래처럼 5가지
decisionLog.md:
트리거: "중대한 아키텍처 결정이 내려질 때 (새 구성요소, 데이터 흐름 변경, 기술 선택 등)."
productContext.md:
트리거: "고수준 프로젝트 설명, 목표, 기능 또는 전체 아키텍처가 크게 변경될 때."
systemPatterns.md:
트리거: "새로운 아키텍처 패턴이 도입되거나 기존 패턴이 수정될 때."
activeContext.md:
트리거: "현재 작업 초점이 변경되거나 중요한 진전이 있을 때."
progress.md:
트리거: "작업이 시작되거나 완료되거나 상태가 변경될 때."
memory-bank.md 프롬프트
memory_system_rules:
primary_system: "memory-bank"initialization:
trigger: "first_interaction"
priority: "immediate"
required: true
actions:
- "Before doing ANYTHING else, read and fully internalize ALL rules in this file."
- "Check if memory-bank/ directory exists."
- "If memory-bank exists: Read all core files (productContext.md, activeContext.md, systemPatterns.md, decisionLog.md, progress.md). Set status to [MEMORY BANK: ACTIVE]."
- "If memory-bank does NOT exist: Inform user. Ask to create and provide yes and no response choices. If yes, create directory and core files with basic structure and populate files with initial content, based upon any available information. If no, set status to [MEMORY BANK: INACTIVE]."
- "Load context from memory-bank files if active."
- "Proceed with task or if no task is given, suggest 2-4 tasks based upon memory-bank/ content."validation:
- "Verify memory-bank status (ACTIVE/INACTIVE)."
- "If ACTIVE, confirm core files were read."system_validation:
startup:
- "Verify .windsurfrules loaded"
- "Check memory-bank accessibility if expected"
- "Confirm initialization sequence complete"memory_bank:
core_files:
activeContext.md:
purpose: "Track session state and goals (objectives, decisions, questions, blockers)"
productContext.md:
purpose: "Define project scope (overview, components, organization, standards)"
progress.md:
purpose: "Track work status (completed, current, next, issues)"
decisionLog.md:
purpose: "Record decisions (technical, architecture, implementation, alternatives)"
systemPatterns.md: # Optional but recommended
purpose: "Document recurring patterns and standards (coding, architecture, testing)"
file_handling:
read_all_at_startup: true # Implied by initialization actions
build_complete_context: true # Implied by initialization actionsgeneral:
status_prefix: "Begin EVERY response with either '[MEMORY BANK: ACTIVE]' or '[MEMORY BANK: INACTIVE]', according to the current state of the Memory Bank."memory_bank_updates:
frequency: "UPDATE MEMORY BANK THROUGHOUT THE CHAT SESSION, WHEN SIGNIFICANT CHANGES OCCUR IN THE PROJECT. Use judgment to determine significance."
decisionLog.md:
trigger: "When a significant architectural decision is made (new component, data flow change, technology choice, etc.)."
action: "Append new information (decision, rationale, implications) using insert_content. Never overwrite. Include timestamp."
format: "[YYYY-MM-DD HH:MM:SS] - [Summary of Decision]"
productContext.md:
trigger: "When the high-level project description, goals, features, or overall architecture changes significantly."
action: "Append new information or modify existing entries using insert_content or apply_diff. Append timestamp and summary as footnote."
format: "[YYYY-MM-DD HH:MM:SS] - [Summary of Change]"
systemPatterns.md:
trigger: "When new architectural patterns are introduced or existing ones are modified."
action: "Append new patterns or modify existing entries using insert_content or apply_diff. Include timestamp."
format: "[YYYY-MM-DD HH:MM:SS] - [Description of Pattern/Change]"
activeContext.md:
trigger: "When the current focus of work changes, or when significant progress is made."
action: "Append to the relevant section (Current Focus, Recent Changes, Open Questions/Issues) or modify existing entries using insert_content or apply_diff. Include timestamp."
format: "[YYYY-MM-DD HH:MM:SS] - [Summary of Change/Focus/Issue]"
progress.md:
trigger: "When a task begins, is completed, or its status changes."
action: "Append the new entry using insert_content. Never overwrite. Include timestamp."
format: "[YYYY-MM-DD HH:MM:SS] - [Summary of Progress Update]"umb: # Update Memory Bank command
trigger: "^(Update Memory Bank|UMB)$"
instructions:
- "Halt Current Task: Stop current activity."
- "Acknowledge Command: Respond with '[MEMORY BANK: UPDATING]'."
- "Review Chat History: Analyze the complete current chat session."
core_update_process: |
1. Current Session Review: Analyze chat history for relevant decisions, context changes, progress updates, clarifications etc.
2. Comprehensive Updates: Update relevant memory bank files based on the review, following the rules defined in 'memory_bank_updates'.
3. Memory Bank Synchronization: Ensure consistency across updated files.task_focus: "During UMB, focus ONLY on capturing information explicitly present in the current chat session (clarifications, decisions, progress). Do NOT summarize the entire project or perform actions outside this scope."
cross_mode_updates: "Capture relevant information from the chat session irrespective of conceptual 'modes' mentioned, adding it to the appropriate Memory Bank files."post_umb_actions:
- "State: Memory Bank fully synchronized based on current chat session."
- "State: Session context preserved for continuation."
원리 : 위 프롬프트는 여러 목적에 따른 프롬프트들을 생성하고 작업 변경사항이 생기면 자동으로 프롬프트들이 변형된다.
출처 : https://github.com/GreatScottyMac/cascade-memory-bank?tab=readme-ov-file
예시 최초의 프롬프트
first_interaction
python 3.10+
fastapi Pydantic v2 기반
uvicorn 0.29.0
python-dotenv 1.0.1 .env 기반 설정 관리
httpx 0.27.0 외부 API 호출용
pydantic 2.7.1 FastAPI 기본 모델
sqlalchemy 2.0.30 ORM
alembic 1.13.1 DB 스키마 관리
asyncpg 0.29.0 PostgreSQL 전용이며 도커에서 활용
위와 같은 프롬프트를 최조로 생성한다면 자동으로 메모리 관리 프롬프트 rule과 개발 관련 방법론 프롬프트 rule이 생성하여 목적에 따른 작업 기록틀을 memory-bank에 생성
아래처럼 해당 프로젝트의 memory-bank에서 새로운 rule들+기록 일지가 .md로 생성됨
앞으로 작업이 변경이 많아지거나 할때마다. 몇몇 기록이 자동 업데이트됨
추가 : 현재 memomry-bank.md는 더 강화가 가능한 rule로 개선이 가능하며 여러 목적을 가진 rule을 생성되도록 하는게 건강한 바이브코딩 설계 방향이다.