modify gemini template

This commit is contained in:
NINI
2026-04-28 01:51:20 +09:00
parent 949e0ab13c
commit 38291723f0
32 changed files with 523 additions and 320 deletions
@@ -0,0 +1,29 @@
---
name: doc-drafter
description: Turns PRD requirements and ResearchNote evidence into reviewable Markdown drafts under drafts/.
kind: local
tools:
- read_file
- read_many_files
- grep_search
- glob
- write_file
- replace
model: inherit
temperature: 0.4
max_turns: 30
timeout_mins: 30
---
# Document Drafter
You are the drafting specialist for the Gemini CLI Markdown Document Harness.
## Responsibilities
- Read `GEMINI.md`, `docs/PRD.md`, `docs/ResearchNote.md`, `docs/ARCHITECTURE.md`, `docs/ADR.md`, and `docs/UI_GUIDE.md` before drafting.
- Create draft documents only under `drafts/`.
- Keep the document goal, audience, scope, and tone aligned with `docs/PRD.md`.
- Tie external claims to `docs/ResearchNote.md` sources.
- Preserve user feedback files and do not overwrite `final/` documents.
- If a PRD requirement is ambiguous, mark the ambiguity in the draft or report it to the parent agent.
@@ -0,0 +1,31 @@
---
name: doc-researcher
description: Researches PRD keywords, gathers trustworthy sources, and maintains docs/ResearchNote.md for the document harness.
kind: local
tools:
- read_file
- read_many_files
- grep_search
- glob
- google_web_search
- web_fetch
- write_file
- replace
model: inherit
temperature: 0.2
max_turns: 30
timeout_mins: 30
---
# Document Researcher
You are the research specialist for the Gemini CLI Markdown Document Harness.
## Responsibilities
- Read `GEMINI.md`, `docs/PRD.md`, `docs/ARCHITECTURE.md`, `docs/ADR.md`, and `docs/UI_GUIDE.md` before researching.
- Treat `docs/PRD.md` as the single source of document requirements.
- Prefer primary sources: official documentation, government or institutional publications, academic papers, and original company materials.
- Record search date, search terms, source URLs, source quality notes, core claims, conflicts, unresolved questions, and intended document usage in `docs/ResearchNote.md`.
- Mark uncertain claims as `확인 필요` instead of presenting them as facts.
- Do not write final prose in `final/`. Your primary output is `docs/ResearchNote.md` and concise research notes for the parent agent.
@@ -0,0 +1,25 @@
---
name: doc-reviewer
description: Reviews Markdown documents for PRD alignment, evidence quality, structure, and feedback coverage.
kind: local
tools:
- read_file
- read_many_files
- grep_search
- glob
model: inherit
temperature: 0.1
max_turns: 20
timeout_mins: 20
---
# Document Reviewer
You are the review specialist for the Gemini CLI Markdown Document Harness.
## Responsibilities
- Review changed Markdown files against `GEMINI.md`, `docs/PRD.md`, `docs/ResearchNote.md`, `docs/DraftFeedback.md`, `docs/FinalFeedback.md`, and `docs/UI_GUIDE.md`.
- Lead with concrete issues, ordered by severity, with file paths and line references when possible.
- Check PRD alignment, source traceability, draft/final separation, feedback preservation, and Markdown structure.
- Do not rewrite documents unless the parent agent explicitly asks you to make edits.
@@ -0,0 +1,25 @@
---
name: evidence-checker
description: Checks whether factual claims in drafts and final documents are supported by docs/ResearchNote.md sources.
kind: local
tools:
- read_file
- read_many_files
- grep_search
- glob
model: inherit
temperature: 0.1
max_turns: 20
timeout_mins: 20
---
# Evidence Checker
You are the evidence checking specialist for the Gemini CLI Markdown Document Harness.
## Responsibilities
- Compare `drafts/` and `final/` documents with `docs/ResearchNote.md`.
- Identify unsupported statistics, dates, legal or policy claims, product/version claims, and quotations.
- Report missing, weak, stale, or conflicting evidence.
- Prefer concise claim-to-source mapping over broad style feedback.
@@ -0,0 +1,19 @@
description = "Create review drafts under drafts/ from PRD and ResearchNote."
prompt = """
Use the document-harness Skill. Create all PRD deliverables under drafts/.
Drafts must stay inside PRD scope, answer the key questions, use the requested tone, and connect external factual claims to docs/ResearchNote.md. Mark weak or missing evidence instead of inventing support.
Use @doc-drafter when a focused drafting subagent is useful.
Additional user instructions:
{{args}}
Required context:
@{GEMINI.md}
@{docs/PRD.md}
@{docs/ResearchNote.md}
@{docs/DraftFeedback.md}
@{docs/UI_GUIDE.md}
"""
@@ -0,0 +1,18 @@
description = "Create final documents under final/ after draft feedback."
prompt = """
Use the document-harness Skill. Read docs/DraftFeedback.md and create final deliverables under final/.
If docs/DraftFeedback.md contains no actionable feedback or approval, mark the relevant phase step blocked instead of creating final documents. Do not overwrite drafts/. Preserve feedback files.
Additional user instructions:
{{args}}
Required context:
@{GEMINI.md}
@{docs/PRD.md}
@{docs/ResearchNote.md}
@{docs/DraftFeedback.md}
@{docs/FinalFeedback.md}
@{docs/UI_GUIDE.md}
"""
@@ -0,0 +1,17 @@
description = "Inspect docs/PRD.md and design or update a document harness phase."
prompt = """
Use the document-harness Skill.
Read the project context and determine whether docs/PRD.md is complete enough to start document work. If it is materially incomplete, explain the missing fields and stop. If it is complete enough, create or update an appropriate phase under phases/ using the template in .agents/skills/document-harness/references/phase-templates.md.
Additional user instructions:
{{args}}
Required context:
@{GEMINI.md}
@{docs/PRD.md}
@{docs/ARCHITECTURE.md}
@{docs/ADR.md}
@{docs/UI_GUIDE.md}
"""
@@ -0,0 +1,18 @@
description = "Research PRD keywords and update docs/ResearchNote.md."
prompt = """
Use the document-harness Skill. Research the topics required by docs/PRD.md and update docs/ResearchNote.md.
Prefer official, academic, government, institutional, or other primary sources. Record search date, search terms, source URLs, source quality notes, core findings, conflicts, unresolved questions, and intended document usage.
Use @doc-researcher when the task benefits from a focused research subagent.
Additional user instructions:
{{args}}
Required context:
@{GEMINI.md}
@{docs/PRD.md}
@{docs/ResearchNote.md}
@{docs/UI_GUIDE.md}
"""
@@ -0,0 +1,18 @@
description = "Review harness documents for PRD alignment, evidence, structure, and feedback coverage."
prompt = """
Use the document-review Skill. Review the current Markdown document harness outputs.
Lead with findings. Check PRD alignment, source traceability, heading structure, feedback preservation, draft/final separation, style quality, and validation readiness. Use @doc-reviewer or @evidence-checker if a focused subagent would improve the review.
Review target or extra instructions:
{{args}}
Required context:
@{GEMINI.md}
@{docs/PRD.md}
@{docs/ResearchNote.md}
@{docs/DraftFeedback.md}
@{docs/FinalFeedback.md}
@{docs/UI_GUIDE.md}
"""
@@ -0,0 +1,18 @@
description = "Summarize the current harness state and next required action."
prompt = """
Summarize the current Gemini CLI Markdown Document Harness state and identify the next required action.
Check PRD completeness, ResearchNote status, draft/final outputs, feedback files, and phase status files if present. Do not modify files unless explicitly requested.
Additional user instructions:
{{args}}
Required context:
@{GEMINI.md}
@{docs/PRD.md}
@{docs/ResearchNote.md}
@{docs/DraftFeedback.md}
@{docs/FinalFeedback.md}
@{docs/ARCHITECTURE.md}
"""
@@ -0,0 +1,59 @@
#!/usr/bin/env python3
"""Gemini CLI BeforeTool hook for obviously destructive shell commands."""
import json
import re
import sys
from typing import Any
DANGEROUS_PATTERNS = [
(r"\brm\s+-rf\b", "Recursive force deletion is blocked by the document harness."),
(
r"\bRemove-Item\b(?=.*\b-Recurse\b|\s-r\b)(?=.*\b-Force\b|\s-f\b)",
"PowerShell recursive force deletion is blocked by the document harness.",
),
(r"\bgit\s+reset\s+--hard\b", "Hard reset is blocked because it can discard user work."),
(r"\bgit\s+push\b.*\s--force(?:-with-lease)?\b", "Force push is blocked by the document harness."),
(r"\bDROP\s+TABLE\b", "Destructive database commands are blocked by the document harness."),
]
def iter_strings(value: Any):
if isinstance(value, str):
yield value
elif isinstance(value, dict):
for key, item in value.items():
yield str(key)
yield from iter_strings(item)
elif isinstance(value, list):
for item in value:
yield from iter_strings(item)
def emit(payload: dict) -> None:
print(json.dumps(payload, ensure_ascii=False))
def main() -> int:
raw = sys.stdin.read()
try:
data = json.loads(raw) if raw.strip() else {}
except json.JSONDecodeError:
data = {}
haystack = raw
if data:
haystack += "\n" + "\n".join(iter_strings(data.get("tool_input", data)))
for pattern, reason in DANGEROUS_PATTERNS:
if re.search(pattern, haystack, flags=re.IGNORECASE | re.DOTALL):
emit({"decision": "deny", "reason": reason, "suppressOutput": True})
return 0
emit({})
return 0
if __name__ == "__main__":
sys.exit(main())
@@ -0,0 +1,52 @@
#!/usr/bin/env python3
"""Gemini CLI AfterAgent hook that requests a retry when validation fails."""
import json
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def emit(payload: dict) -> None:
print(json.dumps(payload, ensure_ascii=False))
def main() -> int:
raw = sys.stdin.read()
try:
data = json.loads(raw) if raw.strip() else {}
except json.JSONDecodeError:
data = {}
result = subprocess.run(
[sys.executable, "scripts/validate_docs.py"],
cwd=ROOT,
capture_output=True,
text=True,
encoding="utf-8",
errors="replace",
)
if result.returncode == 0:
emit({})
return 0
details = "\n".join(part for part in [result.stdout.strip(), result.stderr.strip()] if part)
reason = (
"Document harness validation failed. Continue the turn, fix the listed "
f"issues, and run `python scripts/validate_docs.py` again.\n\n{details}"
)
if data.get("stop_hook_active"):
emit({"continue": False, "stopReason": reason, "suppressOutput": True})
else:
emit({"decision": "deny", "reason": reason, "suppressOutput": True})
return 0
if __name__ == "__main__":
sys.exit(main())
+44
View File
@@ -0,0 +1,44 @@
{
"context": {
"fileName": "GEMINI.md"
},
"skills": {
"enabled": true,
"disabled": []
},
"hooksConfig": {
"enabled": true,
"disabled": [],
"notifications": true
},
"hooks": {
"BeforeTool": [
{
"matcher": "run_shell_command",
"hooks": [
{
"name": "pre-tool-guard",
"type": "command",
"command": "python .gemini/hooks/pre_tool_guard.py",
"timeout": 5000,
"description": "Block obviously destructive shell commands."
}
]
}
],
"AfterAgent": [
{
"matcher": "*",
"hooks": [
{
"name": "validate-docs-after-agent",
"type": "command",
"command": "python .gemini/hooks/validate_docs_after_agent.py",
"timeout": 60000,
"description": "Run document harness validation after each agent response."
}
]
}
]
}
}