새 기능을 만드는 순서와 desktop에서 게이트를 돌리는 순서는 그 일을 할 때만 필요하다. 지금은 루트 문서와 playbook을 세션이 스스로 찾아 읽어야 하고, cold-read 시험에서 desktop 절차 질문이 되풀이됐다. 소유자가 2026-11-07에 특정 시점 절차는 스킬로, 새 스킬은 모델이 부를 수 있게 하고 설명에 발동 조건을 문단으로 적기로 정했다(design-docs harness/01-harness-design.md 5.5절, 13절 Q9·Q18). - .claude/skills/new-feature: docs/work/new-feature.md와 docs/manual/의 실행 순서표(크기 → 받을 것 → 배치 → new-feature.sh --no-format → 안쪽부터 → 테스트 먼저 → 훅 알림 → desktop 검증 → 체크리스트). - .claude/skills/desktop-gates: operate.md 4.1·4.2와 gates.md의 실행 순서표(게이트 고르기 → 트리 정하기·패치 → worktree → flock·로그·rc → 테스트 수 → 잠금 대기 → 정리 → 보고 칸). - 두 스킬 모두 정본 문서를 가리키고 다르면 정본이 맞다고 적는다. 설명은 327자·268자로 목록 상한(1,536자) 안이다. - 설치된 스킬이 없던 skills-lock.json과 그 레이아웃 허용 항목을 지웠다. - test_claude_setup.py에 스킬 시험(목록, 모델 호출, 발동 조건, 정본 가리키기, skills-lock.json 없음)을 더했다. 버린 대안: 사용자 호출 전용 스킬(설계 권함, 소유자가 모델 호출로 정함), verify 스킬(내장 /verify와 이름이 겹친다. 검증 진입점 스크립트는 CI 재편 몫이라 여기서는 만들지 않는다). 위험: 스킬 목록이 컨텍스트 예산(창의 1%)에 닿아 있어, 두 설명이 다른 스킬 설명을 밀어낼 수 있다. 전역 스킬 정리는 소유자 전역 설정 세션 몫이다. 검증: unittest, check-docs(검사가 아직 없는 verify.sh 경로를 잡아 고쳤다), check-work-docs, check-repo-layout 모두 rc=0. BREAKING CHANGE: 루트 skills-lock.json이 없어진다. docs/upgrade/ 2026-11-harness.md 2절 6행.
96 lines
4.4 KiB
Python
96 lines
4.4 KiB
Python
"""`.claude/`의 서브에이전트 정의와 스킬이 소유자 결정(2026-11-07)대로인지 본다.
|
|
|
|
결과만 받는 일은 서브에이전트, 파일을 바꾸는 위임은 하위 세션이다(docs/work/delegate.md 4.3절).
|
|
새 스킬은 모두 모델이 부를 수 있고, 설명에 발동 조건을 문단으로 적는다.
|
|
|
|
python3 -m unittest discover -s scripts/tests
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import re
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
REPO = Path(__file__).resolve().parent.parent.parent
|
|
AGENTS = REPO / ".claude/agents"
|
|
SKILLS = REPO / ".claude/skills"
|
|
# Claude Code cuts a skill description at this many characters in the listing.
|
|
DESCRIPTION_LIMIT = 1536
|
|
WRITE_TOOLS = {"Edit", "Write", "MultiEdit", "NotebookEdit"}
|
|
|
|
|
|
def front_matter(path: Path) -> dict[str, str]:
|
|
text = path.read_text(encoding="utf-8")
|
|
match = re.match(r"^---\n(.*?)\n---\n", text, re.S)
|
|
if not match:
|
|
return {}
|
|
fields = {}
|
|
for line in match.group(1).splitlines():
|
|
key, _, value = line.partition(":")
|
|
fields[key.strip()] = value.strip()
|
|
return fields
|
|
|
|
|
|
class SubagentTest(unittest.TestCase):
|
|
def test_the_agent_tool_is_no_longer_denied(self) -> None:
|
|
settings = json.loads((REPO / ".claude/settings.json").read_text(encoding="utf-8"))
|
|
deny = settings.get("permissions", {}).get("deny", [])
|
|
self.assertFalse([rule for rule in deny if rule == "Agent" or rule.startswith("Agent(")])
|
|
|
|
def test_each_definition_names_itself_and_says_when_to_use_it(self) -> None:
|
|
definitions = sorted(AGENTS.glob("*.md"))
|
|
self.assertEqual([path.stem for path in definitions], ["arch-reviewer", "code-simplifier", "verify-api"])
|
|
for path in definitions:
|
|
fields = front_matter(path)
|
|
self.assertEqual(fields.get("name"), path.stem, path)
|
|
self.assertRegex(fields.get("description", ""), r"쓴다", path)
|
|
self.assertTrue(fields.get("tools"), f"{path} must list its tools; an empty list inherits every tool")
|
|
|
|
def test_no_subagent_can_edit_files(self) -> None:
|
|
for path in AGENTS.glob("*.md"):
|
|
tools = {tool.strip() for tool in front_matter(path).get("tools", "").split(",")}
|
|
self.assertFalse(tools & WRITE_TOOLS, f"{path} returns results only; it must not hold {tools & WRITE_TOOLS}")
|
|
|
|
def test_the_reviewers_have_no_shell_that_could_change_the_tree_except_read_commands(self) -> None:
|
|
self.assertNotIn("Bash", front_matter(AGENTS / "code-simplifier.md")["tools"])
|
|
reviewer = (AGENTS / "arch-reviewer.md").read_text(encoding="utf-8")
|
|
self.assertIn("파일을 쓰거나 고치지 않는다", reviewer)
|
|
|
|
def test_verify_api_runs_the_app_on_the_desktop_under_the_shared_lock(self) -> None:
|
|
text = (AGENTS / "verify-api.md").read_text(encoding="utf-8")
|
|
for fragment in ("docs/work/operate.md", "flock /tmp/claude-gates/heavy.lock", "scripts/bootstrap-local.sh",
|
|
"stash@{0}", "down"):
|
|
self.assertIn(fragment, text)
|
|
|
|
|
|
class SkillTest(unittest.TestCase):
|
|
CANON = {"new-feature": "docs/work/new-feature.md", "desktop-gates": "docs/work/operate.md"}
|
|
|
|
def test_the_repository_skills_are_the_two_the_manual_names(self) -> None:
|
|
self.assertEqual(sorted(path.parent.name for path in SKILLS.glob("*/SKILL.md")), sorted(self.CANON))
|
|
|
|
def test_each_skill_is_model_invoked_and_says_when_in_its_description(self) -> None:
|
|
for name in self.CANON:
|
|
fields = front_matter(SKILLS / name / "SKILL.md")
|
|
self.assertEqual(fields.get("name"), name)
|
|
self.assertNotIn("disable-model-invocation", fields)
|
|
description = fields.get("description", "")
|
|
self.assertLessEqual(len(description), DESCRIPTION_LIMIT, name)
|
|
self.assertIn("쓴다", description, f"{name}: say when to use it")
|
|
self.assertIn("부른다", description, f"{name}: say what the user says that calls it")
|
|
|
|
def test_each_skill_points_at_its_canonical_playbook_instead_of_copying_it(self) -> None:
|
|
for name, canon in self.CANON.items():
|
|
body = (SKILLS / name / "SKILL.md").read_text(encoding="utf-8")
|
|
self.assertIn(f"정본은 `{canon}`", body)
|
|
self.assertIn("정본이 맞다", body)
|
|
|
|
def test_the_uninstalled_skill_lock_is_gone(self) -> None:
|
|
self.assertFalse((REPO / "skills-lock.json").exists())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|