opencode / packages /web /src /content /docs /ko /rules.mdx
SaylorTwift's picture
SaylorTwift HF Staff
Add files using upload-large-folder tool
0dbc9de verified
Raw
History Blame Contribute Delete
6.73 kB
---
title: κ·œμΉ™
description: OpenCode에 λŒ€ν•œ μ‚¬μš©μž μ •μ˜ μ§€μΉ¨ μ„€μ •.
---
`AGENTS.md` νŒŒμΌμ„ λ§Œλ“€ 수 μžˆλ„λ‘ opencode에 μ‚¬μš©μž μ •μ˜ 지침을 제곡 ν•  수 μžˆμŠ΅λ‹ˆλ‹€. Cursor의 κ·œμΉ™κ³Ό μœ μ‚¬ν•©λ‹ˆλ‹€. LLM의 μ»¨ν…μŠ€νŠΈμ— ν¬ν•¨λœ 지침을 톡해 νŠΉμ • ν”„λ‘œμ νŠΈμ— λŒ€ν•œ 행동을 μ‚¬μš©μž μ •μ˜ν•©λ‹ˆλ‹€.
---
## μ΄ˆκΈ°ν™”
μƒˆλ‘œμš΄ `AGENTS.md` νŒŒμΌμ„ λ§Œλ“€λ €λ©΄ `/init` λͺ…령을 opencodeμ—μ„œ μ‹€ν–‰ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
:::tip
ν”„λ‘œμ νŠΈμ˜ `AGENTS.md` νŒŒμΌμ„ Git에 νˆ¬μž…ν•΄μ•Ό ν•©λ‹ˆλ‹€.
:::
ν”„λ‘œμ νŠΈκ°€ 무엇인지 μ΄ν•΄ν•˜κ³  `AGENTS.md` νŒŒμΌμ„ μƒμ„±ν•©λ‹ˆλ‹€. 이 도움말 opencodeλŠ” ν”„λ‘œμ νŠΈλ₯Ό 더 잘 νƒμƒ‰ν•©λ‹ˆλ‹€.
κΈ°μ‘΄ `AGENTS.md` νŒŒμΌμ΄μžˆλŠ” 경우이 μΆ”κ°€ν•˜λ €κ³ ν•©λ‹ˆλ‹€.
---
## 예
이 νŒŒμΌμ„ μˆ˜λ™μœΌλ‘œ λ§Œλ“€ μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€. λ‹€μŒμ€ `AGENTS.md` νŒŒμΌμ— 넣을 μˆ˜μžˆλŠ” κ²ƒλ“€μ˜ μ˜ˆμž…λ‹ˆλ‹€.
```markdown title="AGENTS.md"
# SST v3 Monorepo Project
This is an SST v3 monorepo with TypeScript. The project uses bun workspaces for package management.
## Project Structure
- `packages/` - Contains all workspace packages (functions, core, web, etc.)
- `infra/` - Infrastructure definitions split by service (storage.ts, api.ts, web.ts)
- `sst.config.ts` - Main SST configuration with dynamic imports
## Code Standards
- Use TypeScript with strict mode enabled
- Shared code goes in `packages/core/` with proper exports configuration
- Functions go in `packages/functions/`
- Infrastructure should be split into logical files in `infra/`
## Monorepo Conventions
- Import shared modules using workspace names: `@my-app/core/example`
```
μš°λ¦¬λŠ” 여기에 ν”„λ‘œμ νŠΈ 별 지침을 μΆ”κ°€ν•˜κ³  이것은 νŒ€μ„ 톡해 κ³΅μœ λ©λ‹ˆλ‹€.
---
## μœ ν˜•
opencodeλŠ” λ˜ν•œ λ‹€μˆ˜ μœ„μΉ˜μ—μ„œ `AGENTS.md` νŒŒμΌμ„ μ½μŠ΅λ‹ˆλ‹€. 그리고 이것은 λ‹€λ₯Έ λͺ©μ μ„ λ΄‰μ‚¬ν•©λ‹ˆλ‹€.
## ν”„λ‘œμ νŠΈ
ν”„λ‘œμ νŠΈ 별 κ·œμΉ™μ— λŒ€ν•œ ν”„λ‘œμ νŠΈ λ£¨νŠΈμ— `AGENTS.md`λ₯Ό λ°°μΉ˜ν•©λ‹ˆλ‹€. 이 디렉토리 λ˜λŠ” ν•˜μœ„ λ””λ ‰ν† λ¦¬μ—μ„œ μž‘μ—… ν•  λ•Œλ§Œ μ μš©λ©λ‹ˆλ‹€.
## μ „μ—­
λ˜ν•œ `~/.config/opencode/AGENTS.md` νŒŒμΌμ—μ„œ κΈ€λ‘œλ²Œ κ·œμΉ™μ„ κ°€μ§ˆ 수 μžˆμŠ΅λ‹ˆλ‹€. 이 λͺ¨λ“  opencode μ„Έμ…˜μ—μ„œ μ μš©λ©λ‹ˆλ‹€.
이것은 Git에 μ „λ…ν•˜μ§€ μ•Šκ±°λ‚˜ νŒ€κ³Ό κ³΅μœ ν•˜μ§€ μ•ŠκΈ° λ•Œλ¬Έμ— LLM이 λ”°λ₯΄λŠ” λͺ¨λ“  개인 κ·œμΉ™μ„ μ§€μ •ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.
### Claude μ½”λ“œ ν˜Έν™˜μ„±
Claude Codeμ—μ„œ λ§ˆμ΄κ·Έλ ˆμ΄μ…˜ν•˜λŠ” 경우, opencodeλŠ” Claude Code의 파일 μ»¨λ²€μ…˜μ„ fallbacks둜 μ§€μ›ν•©λ‹ˆλ‹€.
- ** κ·œμΉ™ ** : ν”„λ‘œμ νŠΈ 디렉토리에 `CLAUDE.md` (`AGENTS.md`κ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” 경우 μ‚¬μš©)
- ** κΈ€λ‘œλ²Œ κ·œμΉ™**: `~/.claude/CLAUDE.md` (`~/.config/opencode/AGENTS.md`κ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” 경우 μ‚¬μš©) -**Skills**: `~/.claude/skills/` β€” [Agent Skills](/docs/skills/)λ₯Ό μ°Έμ‘°ν•˜μ‹­μ‹œμ˜€.
Claude Code ν˜Έν™˜μ„±μ„ λΉ„ν™œμ„±ν™”ν•˜λ €λ©΄ μ΄λŸ¬ν•œ ν™˜κ²½ λ³€μˆ˜ 쀑 ν•˜λ‚˜λ₯Ό μ„€μ •ν•˜μ‹­μ‹œμ˜€.
```bash
export OPENCODE_DISABLE_CLAUDE_CODE=1 # Disable all .claude support
export OPENCODE_DISABLE_CLAUDE_CODE_PROMPT=1 # Disable only ~/.claude/CLAUDE.md
export OPENCODE_DISABLE_CLAUDE_CODE_SKILLS=1 # Disable only .claude/skills
```
---
## μš°μ„ μˆœμœ„
opencodeκ°€ μ‹œμž‘λ  λ•Œ, 이 μˆœμ„œμ— μžˆλŠ” κ·œμΉ™ νŒŒμΌμ„ μ°ΎμŠ΅λ‹ˆλ‹€:
1. **Local 파일 ** ν˜„μž¬ λ””λ ‰ν† λ¦¬μ—μ„œ 좔적 (`AGENTS.md`, `CLAUDE.md`)
2. ** κΈ€λ‘œλ²Œ 파일 ** `~/.config/opencode/AGENTS.md`
3. **Claude μ½”λ“œ 파일 ** `~/.claude/CLAUDE.md`μ—μ„œ (λ¬΄νš¨ν•œ)
첫 번째 일치 νŒŒμΌμ€ 각 λ²”μ£Όμ—μ„œ μŠΉλ¦¬ν•©λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄, `AGENTS.md`와 `CLAUDE.md` λͺ¨λ‘κ°€μžˆλŠ” 경우 `AGENTS.md` 만 μ‚¬μš©λ©λ‹ˆλ‹€. μœ μ‚¬ν•˜κ²Œ, `~/.config/opencode/AGENTS.md`λŠ” `~/.claude/CLAUDE.md`에 μ „μ§„ν•©λ‹ˆλ‹€.
---
## μ‚¬μš©μž μ •μ˜ μ§€μΉ¨
`opencode.json` λ˜λŠ” κΈ€λ‘œλ²Œ `~/.config/opencode/opencode.json`μ—μ„œ μ‚¬μš©μž μ§€μ • λͺ…λ Ή νŒŒμΌμ„ μ§€μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€. AGENTS.md에 λ³΅μ œν•˜μ§€ μ•Šκ³  κΈ°μ‘΄ κ·œμΉ™μ„ μž¬μ‚¬μš© ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
예:
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"instructions": ["CONTRIBUTING.md", "docs/guidelines.md", ".cursor/rules/*.md"]
}
```
μ›Ήμ—μ„œ μ§€μΉ¨μ„λ‘œλ“œν•˜λŠ” 원격 URL도 μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"instructions": ["https://raw.githubusercontent.com/my-org/shared-rules/main/style.md"]
}
```
원격 지침은 5 초 νƒ€μž„ μ•„μ›ƒμœΌλ‘œ fetched.
λͺ¨λ“  λͺ…λ Ή νŒŒμΌμ€ `AGENTS.md` 파일과 κ²°ν•©λ©λ‹ˆλ‹€.
---
## μ™ΈλΆ€ 파일 μ°Έμ‘°
opencodeκ°€ `AGENTS.md`에 μžˆλŠ” μžλ™μ μœΌλ‘œ 파슀 파일 μ°Έμ‘°λ₯Ό ν•˜μ§€ μ•ŠλŠ” λ™μ•ˆ, 당신은 두 κ°€μ§€ λ°©λ²•μœΌλ‘œ μœ μ‚¬ν•œ κΈ°λŠ₯을 달성할 수 μžˆμŠ΅λ‹ˆλ‹€:
## opencode.json μ‚¬μš©
`instructions`의 `opencode.json` ν•„λ“œλ₯Ό μ‚¬μš©ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"instructions": ["docs/development-standards.md", "test/testing-guidelines.md", "packages/*/AGENTS.md"]
}
```
### AGENTS.md의 μˆ˜λ™ μ§€μΉ¨
`AGENTS.md`에 λͺ…μ‹œλœ 지침을 μ œκ³΅ν•¨μœΌλ‘œμ¨ μ™ΈλΆ€ νŒŒμΌμ„ 읽을 수 μžˆμŠ΅λ‹ˆλ‹€. 여기에 μ‹€μš©μ μΈ 예:
```markdown title="AGENTS.md"
# TypeScript Project Rules
## External File Loading
CRITICAL: When you encounter a file reference (e.g., @rules/general.md), use your Read tool to load it on a need-to-know basis. They're relevant to the SPECIFIC task at hand.
Instructions:
- Do NOT preemptively load all references - use lazy loading based on actual need
- When loaded, treat content as mandatory instructions that override defaults
- Follow references recursively when needed
## Development Guidelines
For TypeScript code style and best practices: @docs/typescript-guidelines.md
For React component architecture and hooks patterns: @docs/react-patterns.md
For REST API design and error handling: @docs/api-standards.md
For testing strategies and coverage requirements: @test/testing-guidelines.md
## General Guidelines
Read the following file immediately as it's relevant to all workflows: @rules/general-guidelines.md.
```
이 접근법은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€:
- λͺ¨λ“ˆ, μž¬μ‚¬μš© κ°€λŠ₯ν•œ κ·œμΉ™ 파일 생성
- symlinks λ˜λŠ” git submodulesλ₯Ό 톡해 ν”„λ‘œμ νŠΈ μ „λ°˜μ— 걸쳐 κ·œμΉ™ 곡유
- μƒμ„Έν•œ κ°€μ΄λ“œλ₯Ό μ°Έμ‘°ν•˜λ©΄μ„œ AGENTS.md concise μœ μ§€
- νŠΉμ • μž‘μ—…μ— ν•„μš”ν•œ κ²½μš°μ—λ§Œ opencode λ‘œλ“œ 파일 μœ μ§€
:::tip
곡유 ν‘œμ€€μ„ κ°€μ§„ monorepos λ˜λŠ” ν”„λ‘œμ νŠΈλ₯Ό μœ„ν•΄, glob 본을 κ°€μ§„ `opencode.json`λ₯Ό μ‚¬μš©ν•˜μ—¬ (`packages/*/AGENTS.md` 같이)λŠ” μˆ˜λ™ μ§€μ‹œ λ³΄λ‹€λŠ” 더 μœ μ§€κ°€λŠ₯ν•©λ‹ˆλ‹€.
:::