# 필디스터디 AI 라이브러리 — AI 도우미용 안내
https://feeeldstudy.com/
회원의 부탁을 받은 AI가 지침·스킬을 올리는 방법입니다.
올리기 전에 반드시 회원에게 내용을 보여 주고 확인받으세요.

## 0. 올릴 수 있는 것
- 스킬: 폴더 하나를 .zip으로. 맨 위 폴더 안에 SKILL.md(name·description 머리말)와 README.md(사람용 소개)가 반드시 있어야 합니다.
- 지침: 글 또는 .md 파일 하나(204800바이트, 200KB 이하). JSON의 markdown으로 본문을 보냅니다.
- 실행 프로그램(.exe .dmg .app .pkg), 압축 안의 압축, 숨김 파일, .env·열쇠 파일은 올릴 수 없습니다.
- 비밀번호·개인정보로 보이는 내용이 있으면 올리지 말고 회원에게 알리세요. 서버는 스크립트를 실행하지 않습니다.
- `zip_bytes`: 10485760
- `unzipped_bytes`: 26214400
- `entries`: 200
- `file_bytes`: 5242880
- `ratio`: 100
- `text_scan_bytes`: 1048576

## 1. 계정 연결 (처음 한 번)
POST https://feeeldstudy.com/wp-json/ai-library/v1/device
```json
{"client_name":"My AI assistant"}
```
```json
{"device_code":"…","user_code":"ABCD-EFGH","verification_uri":"https://feeeldstudy.com/ai-library/connect/","verification_uri_complete":"https://feeeldstudy.com/ai-library/connect/?code=ABCD-EFGH","expires_in":600,"interval":5}
```
회원에게 verification_uri와 user_code(또는 verification_uri_complete)를 보여 주고 10분 안에 승인을 부탁하세요. 비밀번호를 요구하지 마세요.
POST https://feeeldstudy.com/wp-json/ai-library/v1/token
```json
{"device_code":"…"}
```
interval(기본 5초)마다 요청합니다. authorization_pending은 계속 기다리고, slow_down은 간격을 5초 늘립니다. access_denied면 중단, expired_token이면 회원에게 재연결을 물으세요.
```json
{"access_token":"fdai_…","token_type":"Bearer","scope":"submit read_own","expires_in":2592000}
```
권한은 30일 동안 검수 요청과 내 상태 보기뿐입니다. 토큰은 비밀로 보관하고 대화·로그·공개 파일에 남기지 마세요. 회원은 내가 올린 것 화면에서 연결을 끊을 수 있습니다.

## 2. 검색 설명 정하기
- title: 2~40자 이름. slug: 영어 소문자·숫자·하이픈, 3~64자, 새 항목만 변경할 수 있습니다.
- description: 권장 80~160자(서버 허용 20~160자). 누가·언제·무엇을 얻는지 쓰세요. 검색 결과·목록·상세에 그대로 보이며 관리자가 승인할 때 고칠 수 있습니다.
- category: 아래 분류 키 중 하나. tags: 5개 이하, 각 20자 이하.
- declared: reads(읽는 것), writes(만드는 것), network(none 또는 uses 등 인터넷 사용), deletes(지우는 것)를 정확히 적으세요.
초안과 파일 내용을 회원에게 보여 주고 확인받은 뒤 올리세요.
GET https://feeeldstudy.com/wp-json/ai-library/v1/categories
- `excel-area`: 엑셀·면적
- `law`: 법규
- `docs`: 문서·공문
- `meeting`: 회의·메일
- `image-render`: 이미지·렌더
- `portfolio`: 포트폴리오
- `etc`: 기타

## 3. 올리기
POST https://feeeldstudy.com/wp-json/ai-library/v1/submissions
Authorization: Bearer <access_token>
스킬은 multipart/form-data: file=<스킬.zip>, meta=<아래 JSON 문자열>로 보냅니다. Content-Type 경계는 HTTP 도구가 만들게 하세요.
```json
{"title":"면적표 정리","slug":"area-table","description":"회원에게 확인받은 검색 설명 (80~160자 권장)","category":"excel-area","tags":["면적표"],"declared":{"reads":"선택한 엑셀","writes":"새 엑셀","network":"none","deletes":"없음"}}
```
지침은 application/json: {"kind":"guide","markdown":"# 제목\n본문","meta":{…위 필드…}}. 기존 항목의 새 판은 item_id를 함께 보냅니다.
```json
{"id":123,"status":"pending_review","checks":[{"id":"structure","level":"ok","label":"…","detail":"…","file":null,"line":null,"snippet":null}],"my_url":"https://feeeldstudy.com/ai-library/my/"}
```

### REST
| Method | URL | Request | Response |
|---|---|---|---|
| GET | https://feeeldstudy.com/wp-json/ai-library/v1/categories | — | [{key,label}] |
| POST | https://feeeldstudy.com/wp-json/ai-library/v1/device | {client_name} | {device_code,user_code,verification_uri,verification_uri_complete,expires_in,interval} |
| POST | https://feeeldstudy.com/wp-json/ai-library/v1/token | {device_code} | {access_token,token_type,scope,expires_in} |
| POST | https://feeeldstudy.com/wp-json/ai-library/v1/drafts | multipart file (+item_id) / JSON {kind:"guide",markdown,item_id?} | draft_view |
| POST | https://feeeldstudy.com/wp-json/ai-library/v1/drafts/<id> | JSON meta | draft_view |
| GET | https://feeeldstudy.com/wp-json/ai-library/v1/drafts/<id> | — | draft_view |
| POST | https://feeeldstudy.com/wp-json/ai-library/v1/drafts/<id>/submit | — | {id,status,my_url} |
| POST | https://feeeldstudy.com/wp-json/ai-library/v1/submissions | multipart file+meta / JSON {kind:"guide",markdown,meta,item_id?} | {id,status,checks,my_url} |
| GET | https://feeeldstudy.com/wp-json/ai-library/v1/submissions | — | own items[] |
| GET | https://feeeldstudy.com/wp-json/ai-library/v1/submissions/<id> | — | draft_view |
| POST | https://feeeldstudy.com/wp-json/ai-library/v1/items/<id>/report | JSON {reason} (cookie+nonce only) | {ok:true} |
`draft_view`: {id,slug,kind,state,version,version_status,source,checks,ok,files,total_bytes,readme_md,skill_md,prefill:{title,slug,description},meta:{title,slug,description,category,tags,declared},review_note,urls:{preview,my}}
`own items[]`: [{id,slug,kind,title,state,version,version_status,source,created,updated,installs,review_note,checks_block,url,edit_url}]
`files[]`: [{path,size,type,sha256}]
categories·device·token 외에는 로그인 쿠키와 X-WP-Nonce(wp_rest) 또는 Bearer가 필요합니다. Bearer는 submit(올리기), read_own(내 상태 보기)만 허용되며 report에는 쓸 수 없습니다. device는 IP당 시간 20회까지입니다.

## 4. 결과 알리기
- pending_review: “올렸습니다. 지금은 검수 대기이고, 필디스터디가 승인하면 공개됩니다.”라고 알리고 my_url을 주세요.
- rejected_auto: HTTP 200이어도 공개 성공이 아닙니다. checks의 파일·줄·사유를 회원에게 보여 주고 고친 뒤 다시 올리세요. 주의(warn)와 차단(block)을 구분하세요.
- changes_requested·rejected: review_note를 회원에게 보여 주고 수정 여부를 물으세요. published만 공개 중이며 hidden은 공개되지 않습니다.
`error`: {"code":"ca_ail_invalid_meta","message":"…","data":{"status":422,"fields":{"title":"…"}}}
- 400: 입력·파일을 확인하세요. 401: 재연결을 요청하세요. 403: 권한이 없습니다. 404: 항목을 찾을 수 없습니다. 422: fields 또는 검사 사유를 고치세요. 429: 하루 제한 뒤 기다리세요.
AI는 공개·삭제를 할 수 없습니다. 하루 10건까지.

## 5. 설치 방법
- 미리보기는 누구나 볼 수 있지만 설치·받기·복사는 로그인 회원만 가능합니다. 로그인한 회원의 상세 설치 상자에서 발급한 서명 zip 주소를 사용하세요(30분, 해당 회원 전용).
- AI에게 부탁: 상세 주소를 주고 “이 스킬을 설치해 줘. 설치 전에 SKILL.md 내용을 먼저 보여 줘.”라고 요청합니다.
`npx skills add <설치 zip 주소>`
- 파일 받기: zip을 받아 ChatGPT·Claude의 스킬 추가에서 올립니다. 설치 zip에는 README.md가 빠지고 SKILL.md·스크립트만 들어갑니다. 지침은 내용을 확인하고 복사하거나 .md로 받습니다.
- 웹 대화창 AI처럼 파일을 못 올리는 경우: zip을 만들어 회원에게 주고 회원이 아래 올리기 화면에서 올립니다. 토큰이나 비밀번호를 대화창에 붙이지 마세요.
https://feeeldstudy.com/ai-library/upload/
