opencodekit 0.23.2 → 0.23.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -14
- package/dist/index.js +1 -1
- package/dist/template/.opencode/AGENTS.md +92 -19
- package/dist/template/.opencode/README.md +43 -6
- package/dist/template/.opencode/artifacts/harness-workflows/plan.md +317 -0
- package/dist/template/.opencode/command/audit.md +65 -0
- package/dist/template/.opencode/command/init.md +19 -2
- package/dist/template/.opencode/command/research.md +67 -16
- package/dist/template/.opencode/command/ship.md +55 -5
- package/dist/template/.opencode/command/verify.md +5 -5
- package/dist/template/.opencode/opencode.json +12 -0
- package/dist/template/.opencode/plugin/README.md +0 -6
- package/dist/template/.opencode/plugin/codesearch.ts +730 -0
- package/dist/template/.opencode/plugin/memory/tools.ts +6 -6
- package/dist/template/.opencode/plugin/session-summary.ts +0 -2
- package/dist/template/.opencode/plugin/srcwalk.ts +22 -157
- package/dist/template/.opencode/skill/code-review-and-quality/SKILL.md +1 -1
- package/dist/template/.opencode/skill/debugging-and-error-recovery/SKILL.md +1 -1
- package/dist/template/.opencode/skill/deep-module-design/SKILL.md +1 -1
- package/dist/template/.opencode/skill/defense-in-depth/SKILL.md +0 -2
- package/dist/template/.opencode/skill/development-lifecycle/SKILL.md +11 -9
- package/dist/template/.opencode/skill/manifest.json +77 -0
- package/dist/template/.opencode/skill/planning-and-task-breakdown/SKILL.md +1 -1
- package/dist/template/.opencode/skill/srcwalk/SKILL.md +10 -13
- package/dist/template/.opencode/tool/grepsearch.ts +92 -103
- package/dist/template/.opencode/workflows/audit-pattern.md +51 -0
- package/dist/template/.opencode/workflows/batch-implement.md +82 -0
- package/dist/template/.opencode/workflows/deep-research.md +58 -0
- package/dist/template/.opencode/workflows/development-lifecycle-workflow.md +129 -0
- package/package.json +1 -1
- package/dist/template/.opencode/command/clarify.md +0 -46
- package/dist/template/.opencode/command/commit.md +0 -53
- package/dist/template/.opencode/command/design.md +0 -129
- package/dist/template/.opencode/command/explore.md +0 -169
- package/dist/template/.opencode/command/improve-architecture.md +0 -55
- package/dist/template/.opencode/command/pr.md +0 -148
- package/dist/template/.opencode/command/refactor.md +0 -65
- package/dist/template/.opencode/command/review-codebase.md +0 -128
- package/dist/template/.opencode/command/test.md +0 -66
- package/dist/template/.opencode/command/ui-review.md +0 -109
- package/dist/template/.opencode/opencodex-fast.jsonc +0 -3
- package/dist/template/.opencode/plugin/rtk.ts +0 -43
- package/dist/template/.opencode/skill/agent-teams/SKILL.md +0 -268
- package/dist/template/.opencode/skill/code-navigation/SKILL.md +0 -142
- package/dist/template/.opencode/skill/condition-based-waiting/SKILL.md +0 -135
- package/dist/template/.opencode/skill/condition-based-waiting/example.ts +0 -171
- package/dist/template/.opencode/skill/context-engineering/SKILL.md +0 -176
- package/dist/template/.opencode/skill/memory-system/SKILL.md +0 -147
- package/dist/template/.opencode/skill/structured-edit/SKILL.md +0 -191
- package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +0 -184
- package/dist/template/.opencode/skill/v0/SKILL.md +0 -158
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Write or generate tests for code
|
|
3
|
-
argument-hint: "<file or function> [--unit|--integration|--e2e]"
|
|
4
|
-
agent: build
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Test: $ARGUMENTS
|
|
8
|
-
|
|
9
|
-
Write or generate tests for the specified code.
|
|
10
|
-
|
|
11
|
-
## Load Skills
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
skill({ name: "test-driven-development" });
|
|
15
|
-
skill({ name: "testing-anti-patterns" });
|
|
16
|
-
skill({ name: "verification-before-completion" });
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Parse Arguments
|
|
20
|
-
|
|
21
|
-
| Argument | Default | Description |
|
|
22
|
-
|---|---|---|
|
|
23
|
-
| `<file or function>` | required | File path or function name to test |
|
|
24
|
-
| `--unit` | auto | Unit test (default for utils, helpers) |
|
|
25
|
-
| `--integration` | false | Integration test (default for API, DB) |
|
|
26
|
-
| `--e2e` | false | End-to-end test (requires full setup) |
|
|
27
|
-
|
|
28
|
-
## Process
|
|
29
|
-
|
|
30
|
-
### Phase 1: Understand
|
|
31
|
-
|
|
32
|
-
1. Read the file and understand the function/module contract
|
|
33
|
-
2. Identify: inputs, outputs, side effects, error states, edge cases
|
|
34
|
-
3. Check existing tests for patterns and structure
|
|
35
|
-
|
|
36
|
-
### Phase 2: Write Tests
|
|
37
|
-
|
|
38
|
-
Cover:
|
|
39
|
-
- Happy path (expected input → expected output)
|
|
40
|
-
- Edge cases (empty, null, boundary values)
|
|
41
|
-
- Error states (invalid input, missing dependencies)
|
|
42
|
-
- Contract invariants (what must always be true)
|
|
43
|
-
|
|
44
|
-
Follow the existing test patterns in the project. If none exist, check `vitest.config.ts`.
|
|
45
|
-
|
|
46
|
-
### Phase 3: Run and Verify
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
vitest <path> # or npm test
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
TDD if writing implementation simultaneously: RED → GREEN → REFACTOR.
|
|
53
|
-
|
|
54
|
-
## Anti-Patterns
|
|
55
|
-
|
|
56
|
-
- Testing implementation details instead of behavior
|
|
57
|
-
- Mocking without understanding the real dependency
|
|
58
|
-
- Test-only code in production files (exporting internals just for tests)
|
|
59
|
-
- Brittle assertions (matching full objects when partial match suffices)
|
|
60
|
-
|
|
61
|
-
## Output
|
|
62
|
-
|
|
63
|
-
Report:
|
|
64
|
-
1. Tests written
|
|
65
|
-
2. Coverage summary
|
|
66
|
-
3. Verification results
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Review UI/UX design for quality, aesthetics, and best practices
|
|
3
|
-
argument-hint: "<image-or-component-path> [--responsive] [--dark-mode]"
|
|
4
|
-
agent: vision
|
|
5
|
-
model: proxypal/gemini-3-pro-preview
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# UI Review: $ARGUMENTS
|
|
9
|
-
|
|
10
|
-
## Load Skills
|
|
11
|
-
|
|
12
|
-
```typescript
|
|
13
|
-
skill({ name: "accessibility-audit" }); // WCAG checklists
|
|
14
|
-
skill({ name: "frontend-design" }); // Anti-patterns, design quality
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Input
|
|
18
|
-
|
|
19
|
-
Parse `$ARGUMENTS`:
|
|
20
|
-
|
|
21
|
-
- **Path** (required): Image, screenshot, or component file
|
|
22
|
-
- **`--responsive`**: Include responsive breakpoint review
|
|
23
|
-
- **`--dark-mode`**: Include dark mode review
|
|
24
|
-
|
|
25
|
-
## Review Workflow
|
|
26
|
-
|
|
27
|
-
### 1. Analyze the Input
|
|
28
|
-
|
|
29
|
-
Analyze the input:
|
|
30
|
-
|
|
31
|
-
- Content inventory (elements, text, icons)
|
|
32
|
-
- Visual properties (colors, typography, spacing, layout)
|
|
33
|
-
- Design patterns and potential issues
|
|
34
|
-
|
|
35
|
-
### 2. Usability Heuristic Pass
|
|
36
|
-
|
|
37
|
-
Before visual scoring, check:
|
|
38
|
-
|
|
39
|
-
- System status is visible for async or multi-step work
|
|
40
|
-
- Labels and navigation use user vocabulary, not implementation terms
|
|
41
|
-
- Users can cancel, undo, go back, retry, or recover from failure
|
|
42
|
-
- Controls, names, and layouts are consistent across the surface
|
|
43
|
-
- Dangerous or invalid actions are prevented before they happen
|
|
44
|
-
- Options and relationships are visible without relying on memory
|
|
45
|
-
- High-volume workflows expose efficient paths where appropriate
|
|
46
|
-
- Empty/loading/error/success states are present and useful
|
|
47
|
-
|
|
48
|
-
Any failure that blocks task completion or recovery is **Critical**, even if the screen looks polished.
|
|
49
|
-
|
|
50
|
-
### 3. Score Categories
|
|
51
|
-
|
|
52
|
-
Rate each 1-10 with brief justification:
|
|
53
|
-
|
|
54
|
-
| Category | What to Evaluate |
|
|
55
|
-
| --------------------------------- | -------------------------------------------------------------- |
|
|
56
|
-
| **Information Architecture** | User vocabulary, scope clarity, relationships, navigation |
|
|
57
|
-
| **Task Flow & Recovery** | Primary action, cancellation, undo/retry, error recovery |
|
|
58
|
-
| **Forms & Data Interaction** | Labels, helper text, validation, selection, bulk actions |
|
|
59
|
-
| **Typography** | Hierarchy, readability, weight contrast, intentional choices |
|
|
60
|
-
| **Color** | Palette cohesion, contrast, semantic usage, no AI slop |
|
|
61
|
-
| **Layout & Spacing** | Visual hierarchy, consistency, alignment, white space |
|
|
62
|
-
| **Interactive States** | Hover, focus, active, disabled, loading/error/success coverage |
|
|
63
|
-
| **Accessibility & Semantic HTML** | WCAG AA compliance, native semantics, keyboard/focus behavior |
|
|
64
|
-
| **Component Consistency** | Shared token DNA: radius, height, border, shadow, states |
|
|
65
|
-
| **Visual Polish** | Consistency, attention to detail, motion, shadows, icons |
|
|
66
|
-
|
|
67
|
-
### 4. Conditional Reviews
|
|
68
|
-
|
|
69
|
-
**If `--responsive`**: Check at 375px, 768px, 1280px, 1536px+. Flag touch targets, horizontal scroll, text sizing.
|
|
70
|
-
|
|
71
|
-
**If `--dark-mode`**: Check contrast on dark backgrounds, adapted colors (not just inverted), shadow adjustments, focus visibility.
|
|
72
|
-
|
|
73
|
-
### 5. Report Findings
|
|
74
|
-
|
|
75
|
-
Group by severity:
|
|
76
|
-
|
|
77
|
-
- **Critical (Must Fix)**: Accessibility failures, broken interactions, dead-end errors, unsafe destructive actions
|
|
78
|
-
- **Warning (Should Fix)**: AI slop patterns, inconsistent spacing, missing states, confusing IA/naming
|
|
79
|
-
- **Info (Nice to Have)**: Polish opportunities
|
|
80
|
-
|
|
81
|
-
For each finding: location, impact, and recommended fix.
|
|
82
|
-
|
|
83
|
-
## Output
|
|
84
|
-
|
|
85
|
-
Deliver:
|
|
86
|
-
|
|
87
|
-
1. Category scores (1-10 each) with justification
|
|
88
|
-
2. Overall assessment (1-2 sentences)
|
|
89
|
-
3. Findings grouped by severity with actionable fixes
|
|
90
|
-
4. Code fixes for critical issues (if reviewing component code)
|
|
91
|
-
|
|
92
|
-
## Record Findings
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
observation({
|
|
96
|
-
type: "warning",
|
|
97
|
-
title: "UI: [Component] [issue type]",
|
|
98
|
-
narrative: "Found [issue] in [location]. Impact: [description]...",
|
|
99
|
-
concepts: "ui, accessibility, [category]",
|
|
100
|
-
confidence: "high",
|
|
101
|
-
});
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Related Commands
|
|
105
|
-
|
|
106
|
-
| Need | Command |
|
|
107
|
-
| ------------------- | --------- |
|
|
108
|
-
| Design from scratch | `/design` |
|
|
109
|
-
| Ship implementation | `/ship` |
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from "@opencode-ai/plugin";
|
|
2
|
-
|
|
3
|
-
// RTK OpenCode plugin — rewrites commands to use rtk for token savings.
|
|
4
|
-
// Requires: rtk >= 0.23.0 in PATH.
|
|
5
|
-
//
|
|
6
|
-
// This is a thin delegating plugin: all rewrite logic lives in `rtk rewrite`,
|
|
7
|
-
// which is the single source of truth (src/discover/registry.rs).
|
|
8
|
-
// To add or change rewrite rules, edit the Rust registry — not this file.
|
|
9
|
-
|
|
10
|
-
export const RtkOpenCodePlugin: Plugin = async ({ $ }) => {
|
|
11
|
-
try {
|
|
12
|
-
await $`which rtk`.quiet();
|
|
13
|
-
} catch {
|
|
14
|
-
console.warn("[rtk] rtk binary not found in PATH — plugin disabled");
|
|
15
|
-
return {};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
"tool.execute.before": async (input, output) => {
|
|
20
|
-
const tool = String(input?.tool ?? "").toLowerCase();
|
|
21
|
-
if (tool !== "bash" && tool !== "shell") return;
|
|
22
|
-
const args = output?.args;
|
|
23
|
-
if (!args || typeof args !== "object") return;
|
|
24
|
-
|
|
25
|
-
const command = (args as Record<string, unknown>).command;
|
|
26
|
-
if (typeof command !== "string" || !command) return;
|
|
27
|
-
// This config is symlinked as both global and project OpenCode config.
|
|
28
|
-
// OpenCode may load this plugin twice in that layout, so avoid rewriting
|
|
29
|
-
// commands that have already been routed through rtk.
|
|
30
|
-
if (/^\s*(?:RTK_[A-Z_]+=\S+\s+)*rtk\b/.test(command)) return;
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
const result = await $`rtk rewrite ${command}`.quiet().nothrow();
|
|
34
|
-
const rewritten = String(result.stdout).trim();
|
|
35
|
-
if (rewritten && rewritten !== command) {
|
|
36
|
-
(args as Record<string, unknown>).command = rewritten;
|
|
37
|
-
}
|
|
38
|
-
} catch {
|
|
39
|
-
// rtk rewrite failed — pass through unchanged
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
};
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: agent-teams
|
|
3
|
-
description: >
|
|
4
|
-
Use when working with Claude Code-style agent teams for parallel research, review, competing hypotheses,
|
|
5
|
-
or any task that benefits from multiple agents working simultaneously under a lead coordinator.
|
|
6
|
-
Covers team configuration, task distribution, coordination patterns, and best practices.
|
|
7
|
-
version: "1.0.0"
|
|
8
|
-
license: MIT
|
|
9
|
-
tags: [agent-coordination, workflow]
|
|
10
|
-
dependencies: []
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# Agent Teams - Multi-Agent Team Coordination
|
|
14
|
-
|
|
15
|
-
> **Replaces** single-agent sequential work when tasks benefit from parallel research, review, or competing hypotheses
|
|
16
|
-
|
|
17
|
-
## When to Use
|
|
18
|
-
|
|
19
|
-
- Parallel research, review, or competing approaches that need coordination
|
|
20
|
-
- Tasks benefit from shared findings and a lead coordinating teammates
|
|
21
|
-
|
|
22
|
-
## When NOT to Use
|
|
23
|
-
|
|
24
|
-
- Single-agent tasks or tightly coupled edits where coordination overhead is wasteful
|
|
25
|
-
- Simple parallel work that can use fire-and-forget subagents instead
|
|
26
|
-
|
|
27
|
-
## Overview
|
|
28
|
-
|
|
29
|
-
**Agent Teams = Lead + Teammates + Shared Task List + Messaging**
|
|
30
|
-
|
|
31
|
-
- **Lead agent**: Coordinates the team - distributes tasks, monitors progress, synthesizes results
|
|
32
|
-
- **Teammates**: Execute tasks independently but can message each other and the lead
|
|
33
|
-
- **Task list**: Shared work queue that the lead manages
|
|
34
|
-
- **Messaging**: Bidirectional communication between lead and teammates
|
|
35
|
-
|
|
36
|
-
## When to Use Agent Teams vs Subagents
|
|
37
|
-
|
|
38
|
-
| Criteria | Agent Teams | Subagents (Task tool) |
|
|
39
|
-
| --------------------- | -------------------------------------- | ----------------------------------- |
|
|
40
|
-
| **Coordination** | Lead coordinates, teammates message | Fire-and-forget, results return |
|
|
41
|
-
| **Communication** | Bidirectional messaging | One-way (result only) |
|
|
42
|
-
| **Task reassignment** | Dynamic - lead can reassign | Fixed - each subagent does its task |
|
|
43
|
-
| **Context sharing** | Shared through lead | Independent contexts |
|
|
44
|
-
| **Best for** | Research, review, competing approaches | Independent implementation tasks |
|
|
45
|
-
| **Overhead** | Higher - coordination cost | Lower - no coordination |
|
|
46
|
-
|
|
47
|
-
### Decision Matrix
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
Need coordination between workers? → Agent Teams
|
|
51
|
-
Workers are fully independent? → Subagents (Task tool)
|
|
52
|
-
Need competing hypotheses? → Agent Teams
|
|
53
|
-
Need shared findings? → Agent Teams
|
|
54
|
-
Simple parallel execution? → Subagents (Task tool)
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Parallel Skill Selection
|
|
58
|
-
|
|
59
|
-
| Scenario | Use This Skill |
|
|
60
|
-
| ------------------------------------------- | --------------------------- |
|
|
61
|
-
| 3+ independent bug investigations | dispatching-parallel-agents |
|
|
62
|
-
| Coordinated team (research + review + impl) | agent-teams |
|
|
63
|
-
| Large plan with dependency graph | swarm-coordination |
|
|
64
|
-
| 2 independent tasks | Just use 2 Task() calls |
|
|
65
|
-
|
|
66
|
-
## When to Use
|
|
67
|
-
|
|
68
|
-
- **Parallel research**: Multiple agents researching different aspects of a problem
|
|
69
|
-
- **Code review**: Multiple reviewers examining different files/concerns
|
|
70
|
-
- **Competing hypotheses**: Agents try different approaches, best one wins
|
|
71
|
-
- **Large refactors**: Agents handle different subsystems with coordination
|
|
72
|
-
- **Architecture exploration**: Agents explore different design options simultaneously
|
|
73
|
-
|
|
74
|
-
## When NOT to Use
|
|
75
|
-
|
|
76
|
-
- Single-agent tasks (overhead not worth it)
|
|
77
|
-
- Tightly coupled work where agents would constantly block each other
|
|
78
|
-
- Tasks under 3 independent units of work
|
|
79
|
-
- Simple file edits with no research needed
|
|
80
|
-
|
|
81
|
-
## Team Configuration Patterns
|
|
82
|
-
|
|
83
|
-
### Pattern 1: Research Team
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
Lead: build agent
|
|
87
|
-
├── Teammate 1 (explore): Search codebase for existing patterns
|
|
88
|
-
├── Teammate 2 (scout): Research external docs and best practices
|
|
89
|
-
└── Teammate 3 (review): Analyze current implementation for issues
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
**Use when**: Entering unfamiliar territory, evaluating new libraries, understanding complex systems.
|
|
93
|
-
|
|
94
|
-
### Pattern 2: Review Team
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
Lead: build agent
|
|
98
|
-
├── Teammate 1 (review): Security audit
|
|
99
|
-
├── Teammate 2 (review): Performance review
|
|
100
|
-
└── Teammate 3 (review): Architecture review
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
**Use when**: Pre-merge review of significant features, security-sensitive changes.
|
|
104
|
-
|
|
105
|
-
### Pattern 3: Competing Approaches
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
Lead: build agent
|
|
109
|
-
├── Teammate 1 (general): Implement approach A
|
|
110
|
-
├── Teammate 2 (general): Implement approach B
|
|
111
|
-
└── Teammate 3 (general): Implement approach C
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**Use when**: Multiple valid solutions exist and you need to compare empirically.
|
|
115
|
-
|
|
116
|
-
### Pattern 4: Subsystem Team
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
Lead: build agent
|
|
120
|
-
├── Teammate 1 (general): Handle frontend changes
|
|
121
|
-
├── Teammate 2 (general): Handle backend changes
|
|
122
|
-
└── Teammate 3 (general): Handle database migrations
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
**Use when**: Large features spanning multiple subsystems with clear boundaries.
|
|
126
|
-
|
|
127
|
-
## Best Practices
|
|
128
|
-
|
|
129
|
-
### Task Distribution
|
|
130
|
-
|
|
131
|
-
1. **5-6 tasks per teammate maximum** - More than this degrades quality
|
|
132
|
-
2. **Clear boundaries** - Each teammate should own distinct files/modules
|
|
133
|
-
3. **Avoid file conflicts** - Never assign the same file to multiple teammates
|
|
134
|
-
4. **Include verification** - Each task should include its own verification step
|
|
135
|
-
|
|
136
|
-
### Coordination
|
|
137
|
-
|
|
138
|
-
1. **Lead synthesizes** - Don't let teammates make final decisions; lead integrates
|
|
139
|
-
2. **Regular check-ins** - Lead should review intermediate results, not just final
|
|
140
|
-
3. **Fail fast** - If a teammate hits a blocker, escalate to lead immediately
|
|
141
|
-
4. **Shared conventions** - Establish naming, formatting, and style before dispatching
|
|
142
|
-
|
|
143
|
-
### Communication
|
|
144
|
-
|
|
145
|
-
1. **Task descriptions should be self-contained** - Teammate shouldn't need to ask clarifying questions
|
|
146
|
-
2. **Include context** - What files to read, what patterns to follow, what constraints exist
|
|
147
|
-
3. **Specify output format** - What should the teammate report back?
|
|
148
|
-
4. **Include acceptance criteria** - How does the lead know the task is done?
|
|
149
|
-
|
|
150
|
-
## Implementation with OpenCode
|
|
151
|
-
|
|
152
|
-
### Using the Task Tool (Current)
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
// Spawn research team
|
|
156
|
-
const codebaseAnalysis = Task({
|
|
157
|
-
subagent_type: "explore",
|
|
158
|
-
description: "Analyze auth patterns",
|
|
159
|
-
prompt: `Research authentication patterns in this codebase:
|
|
160
|
-
1. Find all auth-related files
|
|
161
|
-
2. Map the auth flow
|
|
162
|
-
3. Identify potential security issues
|
|
163
|
-
Report back: file list, flow diagram, issues found`,
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
const externalResearch = Task({
|
|
167
|
-
subagent_type: "scout",
|
|
168
|
-
description: "Research JWT best practices",
|
|
169
|
-
prompt: `Research current JWT best practices:
|
|
170
|
-
1. Token rotation patterns
|
|
171
|
-
2. Refresh token security
|
|
172
|
-
3. Common vulnerabilities
|
|
173
|
-
Report back: recommended patterns with code examples`,
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
const codeReview = Task({
|
|
177
|
-
subagent_type: "review",
|
|
178
|
-
description: "Review auth security",
|
|
179
|
-
prompt: `Security review of auth implementation:
|
|
180
|
-
1. Check token storage
|
|
181
|
-
2. Verify CSRF protection
|
|
182
|
-
3. Audit session management
|
|
183
|
-
Report back: vulnerabilities found with severity ratings`,
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
// Lead synthesizes all results into unified recommendation
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Using Swarm Coordination (Advanced)
|
|
190
|
-
|
|
191
|
-
For more structured parallel work, combine with the `swarm-coordination` skill:
|
|
192
|
-
|
|
193
|
-
```typescript
|
|
194
|
-
// Load swarm for structured coordination
|
|
195
|
-
skill({ name: "swarm-coordination" });
|
|
196
|
-
|
|
197
|
-
// Analyze and plan
|
|
198
|
-
swarm({ op: "plan", task: "Implement auth overhaul across 3 subsystems" });
|
|
199
|
-
|
|
200
|
-
// Create delegation packets
|
|
201
|
-
swarm({
|
|
202
|
-
op: "delegate",
|
|
203
|
-
bead_id: "auth-frontend",
|
|
204
|
-
title: "Frontend auth components",
|
|
205
|
-
outcome: "All auth forms and guards updated",
|
|
206
|
-
must_do: "Follow existing component patterns, run component tests",
|
|
207
|
-
must_not: "Don't modify API contracts, don't add new dependencies",
|
|
208
|
-
});
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
## Anti-Patterns
|
|
212
|
-
|
|
213
|
-
### ❌ Too Many Teammates
|
|
214
|
-
|
|
215
|
-
```
|
|
216
|
-
Lead
|
|
217
|
-
├── T1: Button component ← Too granular
|
|
218
|
-
├── T2: Input component ← Too granular
|
|
219
|
-
├── T3: Form component ← Too granular
|
|
220
|
-
├── T4: Modal component ← Too granular
|
|
221
|
-
├── T5: Toast component ← Too granular
|
|
222
|
-
├── T6: Dialog component ← Too granular
|
|
223
|
-
├── T7: Dropdown component ← Too granular
|
|
224
|
-
└── T8: Tabs component ← Too granular
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
**Fix**: Group related work. 2-3 teammates handling related components each.
|
|
228
|
-
|
|
229
|
-
### ❌ Overlapping File Ownership
|
|
230
|
-
|
|
231
|
-
```
|
|
232
|
-
T1: Refactor auth service ← Both touch auth.ts!
|
|
233
|
-
T2: Add new auth endpoint ← Both touch auth.ts!
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
**Fix**: One teammate owns auth.ts changes. The other waits or works on different files.
|
|
237
|
-
|
|
238
|
-
### ❌ Missing Context
|
|
239
|
-
|
|
240
|
-
```
|
|
241
|
-
Task({ prompt: "Fix the auth bug" }) ← Which bug? What file? What behavior?
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
**Fix**: Include file paths, error messages, expected vs actual behavior, and reproduction steps.
|
|
245
|
-
|
|
246
|
-
### ❌ No Verification
|
|
247
|
-
|
|
248
|
-
```
|
|
249
|
-
Task({ prompt: "Implement feature X" }) ← No way to verify success
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
**Fix**: Include acceptance criteria: "Run `npm test auth`, ensure all pass. Run `npm run typecheck`."
|
|
253
|
-
|
|
254
|
-
## Checklist
|
|
255
|
-
|
|
256
|
-
Before dispatching a team:
|
|
257
|
-
|
|
258
|
-
- [ ] Identified 3+ independent tasks (otherwise use single agent)
|
|
259
|
-
- [ ] Each task has clear file ownership (no overlaps)
|
|
260
|
-
- [ ] Each task has self-contained context (files, patterns, constraints)
|
|
261
|
-
- [ ] Each task has acceptance criteria (verification commands)
|
|
262
|
-
- [ ] Lead has a synthesis plan (how to integrate results)
|
|
263
|
-
- [ ] Tasks are sized appropriately (5-6 per teammate max)
|
|
264
|
-
|
|
265
|
-
## See Also
|
|
266
|
-
|
|
267
|
-
- `dispatching-parallel-agents` — for independent debugging-focused parallel investigations
|
|
268
|
-
- `swarm-coordination` — for dependency-aware large-plan execution
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-navigation
|
|
3
|
-
description: Use when navigating unfamiliar code, tracing cross-file dependencies, or before editing — efficient code reading patterns that minimize tool calls and token waste
|
|
4
|
-
version: 1.0.0
|
|
5
|
-
tags: [workflow, code-quality, context]
|
|
6
|
-
dependencies: []
|
|
7
|
-
agent_types: [planner, worker, reviewer]
|
|
8
|
-
tools: []
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Code Navigation Skill
|
|
12
|
-
|
|
13
|
-
## When to Use
|
|
14
|
-
|
|
15
|
-
- Exploring an unfamiliar codebase or module
|
|
16
|
-
- Tracing a function call across multiple files
|
|
17
|
-
- Understanding blast radius before a breaking change
|
|
18
|
-
- Planning edits that touch multiple files
|
|
19
|
-
|
|
20
|
-
## When NOT to Use
|
|
21
|
-
|
|
22
|
-
- Simple single-file edits where you already know the location
|
|
23
|
-
- Reading config or documentation files
|
|
24
|
-
|
|
25
|
-
## Core Principle
|
|
26
|
-
|
|
27
|
-
> Collapse multiple tool calls into fewer, smarter ones. Every unnecessary read or search wastes tokens and turns.
|
|
28
|
-
|
|
29
|
-
## Choose The Right Navigation Tool
|
|
30
|
-
|
|
31
|
-
- Use `srcwalk_search`, `srcwalk_read`, `srcwalk_files`, `srcwalk_deps` for symbol search, file reading, glob finds, and blast-radius checks
|
|
32
|
-
- Use `srcwalk_callers`, `srcwalk_callees`, `srcwalk_flow`, `srcwalk_impact`, `srcwalk_map` for call graphs, orientation slices, impact triage, and repo maps — these are first-class Pi tools, no separate skill load needed
|
|
33
|
-
- All tools are backed by the installed `srcwalk` binary via the `srcwalk.ts` extension
|
|
34
|
-
|
|
35
|
-
## Navigation Patterns
|
|
36
|
-
|
|
37
|
-
### Pattern 1: Search First, Read Second
|
|
38
|
-
|
|
39
|
-
**Wrong** (3-6 tool calls):
|
|
40
|
-
```
|
|
41
|
-
glob("*.ts") → read(file1) → "too big" → grep("functionName") → read(file2) → read(file3, section)
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
**Right** (1-2 tool calls):
|
|
45
|
-
```
|
|
46
|
-
grep("functionName", path: "src/") → read(exact_file, offset: line-10, limit: 30)
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Start with search (`srcwalk_search` or grep fallback) to locate, then read only what you need.
|
|
50
|
-
|
|
51
|
-
### Pattern 2: Multi-Symbol Search
|
|
52
|
-
|
|
53
|
-
When tracing a call chain (A calls B calls C), search for all symbols together:
|
|
54
|
-
```
|
|
55
|
-
grep({ pattern: "functionA|functionB|functionC", path: "src/" })
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Or use `srcwalk_callers` for structural caller detection, or `srcwalk_flow` for a combined callers+callees+resolves slice.
|
|
59
|
-
|
|
60
|
-
### Pattern 3: Don't Re-Read What You've Already Seen
|
|
61
|
-
|
|
62
|
-
**Anti-pattern**: Search returns full function body, then agent reads the same file again.
|
|
63
|
-
|
|
64
|
-
If search results already show the code you need, work from that output. Only re-read when:
|
|
65
|
-
- You need surrounding context (lines above/below the match)
|
|
66
|
-
- You need the exact content for editing (verify before edit)
|
|
67
|
-
- The search result was truncated
|
|
68
|
-
|
|
69
|
-
### Pattern 4: Blast Radius Check (Before Breaking Changes)
|
|
70
|
-
|
|
71
|
-
**WHEN**: Before renaming, removing, or changing the signature of an export.
|
|
72
|
-
**SKIP**: When adding new code, fixing internal bugs, or reading.
|
|
73
|
-
|
|
74
|
-
Steps:
|
|
75
|
-
1. `srcwalk_deps(path: "src/file.ts")` — find importers and downstream users
|
|
76
|
-
2. `srcwalk_callers({ symbol: "symbolName", scope: "src" })` — find call sites with optional depth/filter
|
|
77
|
-
3. Review each caller to assess impact
|
|
78
|
-
4. Plan edits from leaf callers inward (furthest dependencies first)
|
|
79
|
-
|
|
80
|
-
### Pattern 5: Context Locality
|
|
81
|
-
|
|
82
|
-
When editing a file, search results from the same directory/package are more likely relevant. Pass context when available:
|
|
83
|
-
- In grep: use `path: "src/same-module/"` to scope
|
|
84
|
-
- In srcwalk_search: pass `context` param to boost nearby results
|
|
85
|
-
|
|
86
|
-
### Pattern 6: Outline Before Deep Read
|
|
87
|
-
|
|
88
|
-
For large files (>200 lines), get the structure first:
|
|
89
|
-
```
|
|
90
|
-
srcwalk_read(path: "src/large-file.ts")
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
This gives you structure and line ranges. Then read only the section you need.
|
|
94
|
-
|
|
95
|
-
### Pattern 7: Follow the Call Chain (Not the File Tree)
|
|
96
|
-
|
|
97
|
-
**Wrong**: Read files top-to-bottom hoping to understand the flow.
|
|
98
|
-
**Right**: Start from the entry point, follow function calls:
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
1. `srcwalk_search(query: "entryPoint")` → find where it is defined
|
|
102
|
-
2. `srcwalk_callees({ symbol: "entryPoint", scope: "src" })` or `srcwalk_flow` for call graph orientation
|
|
103
|
-
3. `srcwalk_read(section: "line-range")` → drill into the interesting callee
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## With Srcwalk Backend
|
|
107
|
-
|
|
108
|
-
All navigation tools are native srcwalk_* tools. Available tools:
|
|
109
|
-
|
|
110
|
-
| Task | Tool | Notes |
|
|
111
|
-
|---|---|---|
|
|
112
|
-
| `grep` + `read` | `srcwalk_search(expand: 2)` | Returns definitions with inline source — no second read needed |
|
|
113
|
-
| `glob` | `srcwalk_files` | Adds token estimates per file |
|
|
114
|
-
| Large file read | `srcwalk_read` | Auto-outlines, shows structure |
|
|
115
|
-
| Direct callers | `srcwalk_callers` | Structural call-site evidence |
|
|
116
|
-
| Transitive callers | `srcwalk_callers(depth: N)` | Multi-hop BFS up to 5 |
|
|
117
|
-
| Forward call graph | `srcwalk_callees(detailed: true)` | Ordered sites with arg slots |
|
|
118
|
-
| Function orientation | `srcwalk_flow` | Callers + callees + resolves |
|
|
119
|
-
| Import + dependents | `srcwalk_deps` | File-scoped import evidence + heuristic |
|
|
120
|
-
| Heuristic triage | `srcwalk_impact` | Follow up with callers for proof |
|
|
121
|
-
| Repo shape | `srcwalk_map` | Token budgets + directory skeleton |
|
|
122
|
-
|
|
123
|
-
**IMPORTANT**: Prefer `srcwalk_*` tools over built-in grep/glob/read for code navigation. Their expanded search results often include full source — do NOT re-read files already shown in search output.
|
|
124
|
-
|
|
125
|
-
## Cost Awareness
|
|
126
|
-
|
|
127
|
-
Every tool call has a token cost. Efficient navigation means:
|
|
128
|
-
- Fewer tool calls per task
|
|
129
|
-
- Less context consumed by redundant reads
|
|
130
|
-
- More budget available for actual implementation
|
|
131
|
-
|
|
132
|
-
**Target**: Find and understand any symbol in ≤3 tool calls, not 6+.
|
|
133
|
-
|
|
134
|
-
## Common Mistakes
|
|
135
|
-
|
|
136
|
-
| Mistake | Fix |
|
|
137
|
-
|---|---|
|
|
138
|
-
| Read entire large file | Use outline first, then section read |
|
|
139
|
-
| Search → read same code again | Work from search results directly |
|
|
140
|
-
| Trace calls one-by-one | `srcwalk_callers` / `srcwalk_callees` or multi-symbol `srcwalk_search` |
|
|
141
|
-
| Explore randomly | Start from entry point, follow calls |
|
|
142
|
-
| Forget to check blast radius | Always check before signature changes |
|