Skip to content

Commit 3fa8f49

Browse files
committed
docs(tool-guides): add skills/sub-agents/teams and improve hooks guidance
1 parent e789912 commit 3fa8f49

File tree

13 files changed

+389
-34
lines changed

13 files changed

+389
-34
lines changed

AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,11 @@ guide-LLiMes is a framework for building LLM coding guidelines that improve outp
2121
- Start with 3 must-have guidelines.
2222
- Expand incrementally as repeat failure patterns appear.
2323
- Add should-have and nice-to-have guidance when the pain justifies the extra context cost.
24+
25+
## Authoring Pattern (Default)
26+
27+
For tool or feature documentation, structure content in this order:
28+
29+
1. Problem: current user pain or failure pattern.
30+
2. Value: what improves after applying the guidance.
31+
3. When to use: concrete decision cues and scenarios.

CONTRIBUTING.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,31 @@ PR checklist:
6868
- No duplicated rules when automation/checks already enforce behavior
6969
- References and internal links are valid
7070

71+
## Default Writing Pattern
72+
73+
For feature/tool sections, prefer this order:
74+
75+
1. **Problem**: what pain or failure pattern the reader has now
76+
2. **Value**: what improves if they apply this guidance
77+
3. **When to use**: decision cues and concrete scenarios
78+
79+
This structure keeps content user-outcome driven instead of feature-list driven.
80+
81+
Reusable mini-template:
82+
83+
```markdown
84+
## Why this matters
85+
[problem]
86+
87+
## What value it gives
88+
[outcome]
89+
90+
## When to use it
91+
- [scenario 1]
92+
- [scenario 2]
93+
- [scenario 3]
94+
```
95+
7196
## Review Criteria
7297

7398
Reviewers prioritize:
@@ -97,4 +122,3 @@ Open the local URL shown by Jekyll and verify navigation, links, and page readab
97122
- Assume good intent and review the idea, not the person
98123
- Prefer incremental improvements over broad speculative rewrites
99124
- Keep discussion anchored to improving output quality in real projects
100-

docs/00-introduction/tool-landscape.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ What varies is the file location, format details, and how much control you have
3232
- **Key feature**: Hierarchical — subdirectory CLAUDE.md files add context for that part of the codebase
3333
- **Limit**: ~150-200 effective instructions before reliability drops
3434

35+
Claude Code also has strong workflow primitives:
36+
37+
- **[Hooks](../05-tool-guides/hooks.md)** for runtime quality enforcement
38+
- **[Skills](../05-tool-guides/skills.md)** for reusable task playbooks
39+
- **[Sub-agents](../05-tool-guides/sub-agents.md)** for delegated specialist execution
40+
- **[Agent teams](../05-tool-guides/agent-teams.md)** for teammate-style multi-agent collaboration
41+
3542
```
3643
my-project/
3744
├── CLAUDE.md # Project-wide guidelines

docs/05-tool-guides/agent-teams.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
layout: default
3+
title: Agent Teams
4+
nav_order: 5
5+
parent: Tool Guides
6+
---
7+
8+
# Agent Teams — Let Specialists Collaborate as a System
9+
10+
## Why Teams Are Helpful
11+
12+
A single agent can execute many tasks, but complex work often benefits from multiple specialists coordinating: architecture, implementation, QA, and documentation.
13+
14+
Agent teams help when:
15+
16+
- the task spans multiple disciplines
17+
- you need parallel work with role-specific quality bars
18+
- one coordinator should keep global constraints while specialists execute
19+
20+
This makes "agents talking to each other" explicit and structured instead of ad hoc.
21+
22+
## Claude Code Agent Teams
23+
24+
Claude Code supports team definitions in:
25+
26+
- `.claude/agents/team/**/*.md`
27+
28+
The tooling includes:
29+
30+
- `/agents` to manage agents
31+
- `/agents-team` to create and manage agent teams
32+
33+
Team packs can define:
34+
35+
- a main architecture/orchestrator agent
36+
- specialist teammate agents
37+
- collaboration patterns between teammates
38+
39+
## Team Design Pattern
40+
41+
Start with three roles:
42+
43+
1. **Coordinator** — owns goals, constraints, and final synthesis
44+
2. **Builder** — implements changes and reports verification
45+
3. **Reviewer** — validates risks, regressions, and policy alignment
46+
47+
Add more roles only when repeated bottlenecks appear.
48+
49+
## When to Use Teams vs Sub-Agents
50+
51+
Use **sub-agents** when one primary agent can still coordinate effectively and you only need targeted delegation.
52+
53+
Use **agent teams** when collaboration itself is the core challenge and role boundaries should be persistent.
54+
55+
## Common Mistakes
56+
57+
**Too many roles too early.** Start lean; scale roles from real pain points.
58+
59+
**Role overlap.** If two teammates own the same decision, accountability becomes unclear.
60+
61+
**No integration checkpoints.** Require merge checkpoints and explicit handoffs.
62+
63+
## References
64+
65+
- [Claude Code: Agent teams (official)](https://code.claude.com/docs/en/agent-teams)
66+
- [External References](../references.md)

docs/05-tool-guides/agents-md.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: AGENTS.md
4-
nav_order: 5
4+
nav_order: 8
55
parent: Tool Guides
66
---
77

docs/05-tool-guides/claude-code.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,13 @@ project/
8686

8787
## Key Features
8888

89-
**Skills**: Claude Code supports custom skills — reusable command patterns stored in `.claude/skills/`. Use these for repetitive workflows like "write tests for this module" or "review this PR."
89+
**Skills**: Capture repeatable workflows once and reuse them across tasks. This reduces prompt repetition and increases consistency. See the [Skills Guide](skills.md).
9090

91-
**Hooks**: Shell commands that run automatically before or after tool calls. Useful for enforcing guardrails programmatically (e.g., run linter after every file edit). See the [Hooks Guide](hooks.md).
91+
**Hooks**: Enforce deterministic checks around editing and execution. This closes the gap between instructions and actual runtime behavior. See the [Hooks Guide](hooks.md).
92+
93+
**Sub-agents**: Delegate larger work units to specialized agents while keeping the main chat focused on coordination and decisions. See the [Sub-Agents Guide](sub-agents.md).
94+
95+
**Agent teams**: Define teammate-style specialist collaboration for complex, multi-role tasks. See the [Agent Teams Guide](agent-teams.md).
9296

9397
**File references**: Use `@filename` in CLAUDE.md to reference other documentation files (up to 5 levels deep).
9498

docs/05-tool-guides/cursor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Cursor
4-
nav_order: 3
4+
nav_order: 6
55
parent: Tool Guides
66
---
77

docs/05-tool-guides/github-copilot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: GitHub Copilot
4-
nav_order: 4
4+
nav_order: 7
55
parent: Tool Guides
66
---
77

docs/05-tool-guides/hooks.md

Lines changed: 100 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,126 @@ parent: Tool Guides
99

1010
## Why This Matters
1111

12-
Guidelines describe what good output looks like. Hooks enforce it automatically while the model is working. This closes the gap between "the model was told" and "the model actually did it."
12+
Guidelines say what should happen. Hooks make it happen automatically while the model is editing code and running tools.
1313

14-
Hooks are especially useful for:
14+
Use hooks for:
15+
- **Post-edit quality checks** (format, lint, typecheck, tests)
16+
- **Safety boundaries** (protected paths, risky commands, secrets checks)
17+
- **Consistent workflows** (same checks every run, not reviewer-dependent)
1518

16-
- **Post-edit validation** — run lint, type checks, tests, policy checks
17-
- **Safety boundaries** — block risky commands or protected-path edits
18-
- **Workflow consistency** — apply formatting and project checks every time
19+
## Helpfulness Map (Problem -> Hook Value)
1920

20-
## What to Automate First
21+
| Team pain | Hook intervention | User-visible benefit |
22+
|---|---|---|
23+
| "The agent forgot lint/typecheck again" | `PostToolUse` checks after edits | Fewer review-round failures |
24+
| "Risky files changed without discussion" | `PreToolUse` policy guard | Earlier, clearer stop signals |
25+
| "Quality depends on who prompted better" | Standard hook scripts | More consistent output quality |
26+
| "Session quality drifts over time" | `Stop` / `SubagentStop` summaries | Better closure and handoff quality |
27+
28+
## Claude Code Hook Model (Vendor Reference)
29+
30+
Claude Code has first-class lifecycle hooks. In practice, this is the most complete built-in hook system across current coding-agent tools.
31+
32+
### Supported lifecycle events
33+
34+
- `PreToolUse` — before tool execution
35+
- `PostToolUse` — after tool execution
36+
- `Notification` — when Claude emits notifications
37+
- `UserPromptSubmit` — when the user submits a prompt
38+
- `Stop` — when Claude finishes responding
39+
- `SubagentStop` — when a subagent finishes
40+
- `PreCompact` — before context compaction
41+
42+
### Hook handler types
43+
44+
Claude supports multiple hook handler types:
45+
46+
- **Command hooks** — run shell commands/scripts
47+
- **Prompt hooks** — inject natural-language guidance at hook time
48+
- **Agent hooks** — invoke a subagent to evaluate or gate behavior
49+
50+
This makes hooks useful for both deterministic checks (scripts) and policy judgment flows (prompt/agent).
51+
52+
### Configuration locations
53+
54+
Claude supports hooks in multiple settings scopes:
2155

22-
Start with low-friction checks that are fast and deterministic:
56+
- `~/.claude/settings.json` (user scope)
57+
- `.claude/settings.json` (project scope)
58+
- local/project variants as documented by Anthropic
2359

24-
1. **Formatting and linting** after file edits
25-
2. **Type checks** before completion
26-
3. **Targeted tests** for modified modules
27-
4. **Policy checks** for protected files (migrations, CI, infra)
60+
### Matcher behavior
2861

29-
If a check is slow or flaky, keep it in CI first and move it into hooks only when stable.
62+
For tool events, each hook can target a matcher:
3063

31-
## Hook Design Pattern
64+
- exact tool name, for example `Bash`
65+
- pattern matcher, for example `Edit|Write`
66+
- wildcard matcher, `*`
3267

33-
Treat hooks as a staged quality gate:
68+
If multiple hooks match, Claude executes all matching hooks.
3469

35-
1. **Before action**: validate intent and boundaries
36-
2. **After action**: run local quality checks
37-
3. **On completion**: summarize failures and required fixes
70+
### Exit codes and control flow
3871

39-
Keep hook scripts idempotent and explicit about exit codes:
72+
Hook return codes have explicit behavior:
4073

41-
- `0` = pass
42-
- non-zero = fail and stop or request intervention
74+
- `0` = success
75+
- `2` = blocking error (show stderr to model)
76+
- other non-zero = non-blocking error
77+
78+
Hooks can also emit structured JSON to control behavior and messaging to the model/user.
79+
80+
### Minimal hook shape (illustrative)
81+
82+
```json
83+
{
84+
"hooks": {
85+
"PreToolUse": [
86+
{ "matcher": "Edit|Write", "hooks": [{ "type": "command", "command": "./scripts/check-policy.sh" }] }
87+
],
88+
"PostToolUse": [
89+
{ "matcher": "Edit|Write", "hooks": [{ "type": "command", "command": "./scripts/check-changed.sh" }] }
90+
]
91+
}
92+
}
93+
```
94+
95+
The key idea is simple: guard before risky actions, validate after edits.
96+
97+
## Cross-Tool Strategy
98+
99+
Not every tool has Claude-style lifecycle hooks. Use a layered approach:
100+
101+
1. **Native hooks when available** (Claude Code)
102+
2. **Wrapper scripts + pre-commit** for local deterministic checks
103+
3. **CI gates as final enforcement** for all tools
104+
105+
Practical mapping:
106+
107+
- **Claude Code**: native lifecycle hooks
108+
- **Cursor / Copilot / Codex-style workflows**: emulate hooks with command wrappers, task runners, pre-commit, and CI
109+
- **AGENTS.md**: policy only, no executable enforcement by itself
110+
111+
## What to Automate First
43112

44-
## Tool Notes
113+
1. Run formatter and linter after file edits
114+
2. Run type checks before task completion
115+
3. Run targeted tests for changed modules
116+
4. Add policy checks for protected files (migrations, CI, infra)
45117

46-
- **Claude Code**: Has first-class lifecycle hooks. Use hooks for deterministic checks around edits and commands.
47-
- **Cursor / Copilot**: No universal built-in lifecycle hooks. Use wrapper scripts, pre-commit hooks, and CI gates to emulate hook behavior.
48-
- **AGENTS.md**: Defines policy and boundaries, but does not execute checks by itself. Pair it with executable hooks or CI.
118+
Keep local hook checks fast and deterministic. Push heavy integration checks to CI.
49119

50120
## Common Mistakes
51121

52-
**Hook overload.** Too many heavy checks on every action hurts iteration speed and gets bypassed.
122+
**Hook overload.** Running slow full-suite checks on every action kills iteration speed.
53123

54-
**Non-deterministic checks.** Flaky scripts erode trust; keep hooks deterministic and fast.
124+
**Flaky checks.** Teams stop trusting the hook output if failures are non-deterministic.
55125

56-
**No fallback path.** If a hook fails, developers need clear remediation steps, not just "failed."
126+
**Unclear remediation.** A failure must say exactly what to do next.
57127

58-
**Policy drift.** Hook behavior and written guardrails must match; update both together.
128+
**Policy drift.** Keep written guardrails and executable checks synchronized.
59129

60130
## References
61131

132+
- [Claude Code: Automate workflows with hooks (official)](https://code.claude.com/docs/en/hooks-guide)
133+
- [Claude Code: Hooks reference (official)](https://code.claude.com/docs/en/hooks)
62134
- [External References](../references.md)

docs/05-tool-guides/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ For executable quality gates across tools, see [Hooks](hooks.md).
3636

3737
- **Using Claude Code?**[Claude Code Guide](claude-code.md)
3838
- **Want runtime quality gates?**[Hooks Guide](hooks.md)
39+
- **Want reusable workflows instead of repeated prompts?**[Skills Guide](skills.md)
40+
- **Working on bigger tasks and need delegation?**[Sub-Agents Guide](sub-agents.md)
41+
- **Need specialist agents collaborating as a system?**[Agent Teams Guide](agent-teams.md)
3942
- **Using Cursor?**[Cursor Guide](cursor.md)
4043
- **Using GitHub Copilot?**[GitHub Copilot Guide](github-copilot.md)
4144
- **Want a tool-agnostic format?**[AGENTS.md Guide](agents-md.md)

0 commit comments

Comments
 (0)