octocode-cli 1.1.1 → 1.2.0
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/out/octocode-cli.js +7906 -8034
- package/package.json +36 -39
- package/skills/README.md +70 -31
- package/skills/octocode-generate/SKILL.md +15 -9
- package/skills/octocode-implement/SKILL.md +288 -0
- package/skills/octocode-implement/references/execution-phases.md +317 -0
- package/skills/octocode-implement/references/tool-reference.md +403 -0
- package/skills/octocode-implement/references/workflow-patterns.md +385 -0
- package/skills/octocode-local-search/SKILL.md +418 -0
- package/skills/octocode-local-search/references/tool-reference.md +328 -0
- package/skills/octocode-local-search/references/workflow-patterns.md +383 -0
- package/skills/octocode-pr-review/SKILL.md +321 -109
- package/skills/octocode-pr-review/references/domain-reviewers.md +105 -0
- package/skills/octocode-pr-review/references/execution-lifecycle.md +116 -0
- package/skills/octocode-pr-review/references/research-flows.md +75 -0
- package/skills/octocode-research/SKILL.md +291 -80
- package/skills/octocode-roast/SKILL.md +369 -0
- package/skills/octocode-roast/references/sin-registry.md +239 -0
- package/skills/octocode-plan/SKILL.md +0 -166
package/package.json
CHANGED
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "octocode-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Interactive CLI installer for octocode-mcp - Configure MCP servers for Cursor, Claude Desktop, and more",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "out/octocode-cli.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"octocode-cli": "./out/octocode-cli.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"out/octocode-cli.js",
|
|
12
|
-
"skills",
|
|
13
|
-
"assets/example.png",
|
|
14
|
-
"README.md",
|
|
15
|
-
"LICENSE"
|
|
16
|
-
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "yarn lint && vite build",
|
|
19
|
-
"build:dev": "vite build",
|
|
20
|
-
"clean": "rm -rf out/",
|
|
21
|
-
"lint": "eslint src/**/*.ts tests/**/*.ts",
|
|
22
|
-
"lint:fix": "eslint src/**/*.ts tests/**/*.ts --fix",
|
|
23
|
-
"start": "node ./out/octocode-cli.js",
|
|
24
|
-
"test": "vitest run --coverage",
|
|
25
|
-
"test:quiet": "vitest run --reporter=dot --silent",
|
|
26
|
-
"test:watch": "vitest --watch",
|
|
27
|
-
"typecheck": "tsc --noEmit",
|
|
28
|
-
"validate:mcp": "npx tsx scripts/validate-mcp-registry.ts",
|
|
29
|
-
"validate:mcp:json": "npx tsx scripts/validate-mcp-registry.ts --json",
|
|
30
|
-
"validate:skills": "npx tsx scripts/validate-skills-marketplace.ts",
|
|
31
|
-
"validate:skills:json": "npx tsx scripts/validate-skills-marketplace.ts --json"
|
|
32
|
-
},
|
|
33
5
|
"keywords": [
|
|
34
6
|
"octocode",
|
|
35
7
|
"mcp",
|
|
@@ -54,25 +26,50 @@
|
|
|
54
26
|
},
|
|
55
27
|
"bugs": "https://github.com/bgauryy/octocode-mcp/issues",
|
|
56
28
|
"license": "PolyForm-Small-Business-1.0.0",
|
|
29
|
+
"bin": "./out/octocode-cli.js",
|
|
57
30
|
"dependencies": {
|
|
58
|
-
"@inquirer/prompts": "^
|
|
31
|
+
"@inquirer/prompts": "^8.1.0",
|
|
59
32
|
"@octokit/auth-oauth-device": "^8.0.3",
|
|
60
33
|
"@octokit/oauth-methods": "^6.0.2",
|
|
61
34
|
"@octokit/request": "^10.0.7",
|
|
62
|
-
"
|
|
35
|
+
"octocode-shared": "workspace:^",
|
|
63
36
|
"open": "^11.0.0"
|
|
64
37
|
},
|
|
65
38
|
"devDependencies": {
|
|
66
39
|
"@types/node": "^22.15.29",
|
|
67
|
-
"@
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"eslint": "^8.57.0",
|
|
40
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
41
|
+
"eslint": "^9.18.0",
|
|
42
|
+
"tsx": "^4.21.0",
|
|
71
43
|
"typescript": "^5.9.3",
|
|
72
|
-
"vite": "^
|
|
73
|
-
"vitest": "^4.0.
|
|
44
|
+
"vite": "^7.3.0",
|
|
45
|
+
"vitest": "^4.0.16"
|
|
74
46
|
},
|
|
75
47
|
"engines": {
|
|
76
|
-
"node": ">=
|
|
77
|
-
}
|
|
48
|
+
"node": ">=20.12.0"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"out/octocode-cli.js",
|
|
52
|
+
"skills",
|
|
53
|
+
"assets/example.png",
|
|
54
|
+
"README.md",
|
|
55
|
+
"LICENSE"
|
|
56
|
+
],
|
|
57
|
+
"main": "out/octocode-cli.js",
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "yarn lint && vite build",
|
|
60
|
+
"build:dev": "vite build",
|
|
61
|
+
"clean": "rm -rf out/",
|
|
62
|
+
"lint": "eslint src tests",
|
|
63
|
+
"lint:fix": "eslint src tests --fix",
|
|
64
|
+
"start": "node ./out/octocode-cli.js",
|
|
65
|
+
"test": "vitest run --coverage",
|
|
66
|
+
"test:quiet": "vitest run --reporter=dot --silent",
|
|
67
|
+
"test:watch": "vitest --watch",
|
|
68
|
+
"typecheck": "tsc --noEmit",
|
|
69
|
+
"validate:mcp": "npx tsx scripts/validate-mcp-registry.ts",
|
|
70
|
+
"validate:mcp:json": "npx tsx scripts/validate-mcp-registry.ts --json",
|
|
71
|
+
"validate:skills": "npx tsx scripts/validate-skills-marketplace.ts",
|
|
72
|
+
"validate:skills:json": "npx tsx scripts/validate-skills-marketplace.ts --json"
|
|
73
|
+
},
|
|
74
|
+
"type": "module"
|
|
78
75
|
}
|
package/skills/README.md
CHANGED
|
@@ -7,9 +7,11 @@ Pre-built Claude Code skills for enhanced AI-assisted research and development.
|
|
|
7
7
|
| Skill | Description | Flow |
|
|
8
8
|
|-------|-------------|------|
|
|
9
9
|
| `octocode-research` | Evidence-first code forensics (local & GitHub) | PREPARE → DISCOVER → ANALYZE → OUTPUT |
|
|
10
|
-
| `octocode-
|
|
11
|
-
| `octocode-
|
|
12
|
-
| `octocode-
|
|
10
|
+
| `octocode-local-search` | Local-first code exploration and discovery | DISCOVER → PLAN → EXECUTE → VERIFY → OUTPUT |
|
|
11
|
+
| `octocode-implement` | Research-driven feature implementation from specs | SPEC → CONTEXT → PLAN → RESEARCH → IMPLEMENT → VALIDATE |
|
|
12
|
+
| `octocode-pr-review` | Defects-first PR review across 6+ domains | CONTEXT → CHECKPOINT → ANALYSIS → FINALIZE → REPORT |
|
|
13
|
+
| `octocode-generate` | App scaffolding with stack selection | DISCOVERY → STACK → PLAN → RESEARCH → SCAFFOLD → VALIDATE |
|
|
14
|
+
| `octocode-roast` | Brutally honest code review with comedic flair | SCOPE → ROAST → INVENTORY → SPOTLIGHT → REDEMPTION |
|
|
13
15
|
|
|
14
16
|
## Installation
|
|
15
17
|
|
|
@@ -36,43 +38,79 @@ cp -r skills/octocode-* .claude/skills/
|
|
|
36
38
|
## Skill Details
|
|
37
39
|
|
|
38
40
|
### octocode-research
|
|
39
|
-
|
|
41
|
+
|
|
42
|
+
**Use when**: Answering questions about codebases, implementations, dependencies, or bugs. Researching code across local workspace AND GitHub repositories.
|
|
40
43
|
|
|
41
44
|
Features:
|
|
42
45
|
- Local-first strategy (prefer local tools over shell commands)
|
|
43
|
-
- GitHub code forensics
|
|
46
|
+
- GitHub code forensics across repositories
|
|
44
47
|
- Cross-domain transitions (Local ↔ GitHub)
|
|
45
|
-
- node_modules inspection
|
|
48
|
+
- node_modules inspection with `noIgnore=true`
|
|
49
|
+
- Multi-agent parallelization for independent hypotheses
|
|
50
|
+
- Validation pattern: Discover → Verify → Cross-check → Confirm
|
|
51
|
+
|
|
52
|
+
### octocode-local-search
|
|
53
|
+
|
|
54
|
+
**Use when**: Exploring unfamiliar codebases, searching for patterns locally, understanding project structure, finding implementations in your workspace.
|
|
55
|
+
|
|
56
|
+
Features:
|
|
57
|
+
- Local-only focus (no GitHub tools)
|
|
58
|
+
- Structured discovery with `localViewStructure`, `localSearchCode`, `localFindFiles`, `localGetFileContent`
|
|
59
|
+
- Interactive planning with user checkpoints
|
|
60
|
+
- node_modules inspection with `noIgnore=true`
|
|
61
|
+
- Token-efficient workflows with discovery mode
|
|
62
|
+
- Multi-agent parallelization for independent research domains
|
|
63
|
+
|
|
64
|
+
### octocode-implement
|
|
65
|
+
|
|
66
|
+
**Use when**: Implementing features from specification documents (MD files, PRDs, tickets), building new functionality in large/unfamiliar codebases, or executing task lists with proper research.
|
|
67
|
+
|
|
68
|
+
Features:
|
|
69
|
+
- Reads and parses task specifications from MD files
|
|
70
|
+
- Deep codebase research before writing code
|
|
71
|
+
- LSP tools for semantic code intelligence (`lspGotoDefinition`, `lspFindReferences`, `lspCallHierarchy`)
|
|
72
|
+
- Pattern discovery to follow existing codebase conventions
|
|
73
|
+
- Impact analysis before modifying code
|
|
74
|
+
- Test-driven implementation with validation gates
|
|
75
|
+
- User checkpoints at key decision points
|
|
76
|
+
- Multi-agent parallelization for independent tasks
|
|
77
|
+
|
|
78
|
+
Core Principle: "Read 10x more than you write. Measure twice, cut once."
|
|
46
79
|
|
|
47
80
|
### octocode-pr-review
|
|
48
|
-
|
|
81
|
+
|
|
82
|
+
**Use when**: Reviewing pull requests for bugs, security vulnerabilities, architecture problems, performance issues, and code quality.
|
|
49
83
|
|
|
50
84
|
Domain Reviewers:
|
|
51
|
-
- Bug (runtime errors, logic flaws)
|
|
52
|
-
- Architecture (pattern violations,
|
|
53
|
-
- Performance (O(n²), memory leaks)
|
|
54
|
-
- Code Quality (naming, conventions)
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
### octocode-plan
|
|
59
|
-
**Use when**: Planning complex implementations requiring research.
|
|
60
|
-
|
|
61
|
-
Goal Types:
|
|
62
|
-
- RESEARCH_ONLY - No code changes
|
|
63
|
-
- ANALYSIS - Understand existing code
|
|
64
|
-
- CREATION - New files/features
|
|
65
|
-
- FEATURE / BUG / REFACTOR - Modify existing
|
|
85
|
+
- 🐛 Bug (runtime errors, logic flaws, resource leaks)
|
|
86
|
+
- 🏗️ Architecture (pattern violations, circular dependencies)
|
|
87
|
+
- ⚡ Performance (O(n²), memory leaks, blocking ops)
|
|
88
|
+
- 🎨 Code Quality (naming, conventions, DRY violations)
|
|
89
|
+
- 🔗 Duplicate Code (missed reuse opportunities)
|
|
90
|
+
- 🚨 Error Handling (swallowed exceptions, poor diagnostics)
|
|
91
|
+
- 🔄 Flow Impact (breaking changes, altered data paths)
|
|
66
92
|
|
|
67
93
|
### octocode-generate
|
|
68
|
-
|
|
94
|
+
|
|
95
|
+
**Use when**: Scaffolding new applications with optimal tech stack selection.
|
|
69
96
|
|
|
70
97
|
Supported Frameworks:
|
|
71
|
-
- Fullstack
|
|
72
|
-
- Frontend
|
|
73
|
-
- Mobile
|
|
74
|
-
- Desktop
|
|
75
|
-
- Backend
|
|
98
|
+
- **Fullstack**: Next.js, T3 Stack, Remix, Nuxt
|
|
99
|
+
- **Frontend**: Vite, Angular
|
|
100
|
+
- **Mobile**: Expo (React Native)
|
|
101
|
+
- **Desktop**: Electron Vite
|
|
102
|
+
- **Backend**: NestJS, Hono, Fastify
|
|
103
|
+
|
|
104
|
+
### octocode-roast
|
|
105
|
+
|
|
106
|
+
**Use when**: You want entertainment with your code review, finding antipatterns, or humorous feedback.
|
|
107
|
+
|
|
108
|
+
Features:
|
|
109
|
+
- Sin severity classification (FELONY → WAR CRIME → PARKING TICKET)
|
|
110
|
+
- Personalized zingers based on actual patterns found
|
|
111
|
+
- Multiple roast personas (Gordon Ramsay, Disappointed Dad, Tech Bro, Israeli Sabra, etc.)
|
|
112
|
+
- User checkpoint before fixes (Redemption Arc)
|
|
113
|
+
- Actionable fixes with before/after
|
|
76
114
|
|
|
77
115
|
## Skill Structure
|
|
78
116
|
|
|
@@ -81,7 +119,7 @@ Each skill follows Anthropic's best practices:
|
|
|
81
119
|
```
|
|
82
120
|
{skill-name}/
|
|
83
121
|
├── SKILL.md # Main reference (<500 lines)
|
|
84
|
-
└──
|
|
122
|
+
└── references/ # Supporting documentation (optional)
|
|
85
123
|
├── tool-reference.md
|
|
86
124
|
└── workflow-patterns.md
|
|
87
125
|
```
|
|
@@ -96,6 +134,7 @@ All skills follow these core principles:
|
|
|
96
134
|
4. **TodoWrite**: Track progress with tasks
|
|
97
135
|
5. **Validation**: Green build required
|
|
98
136
|
6. **No Time Estimates**: Never provide timing
|
|
137
|
+
7. **Evidence Citing**: Include file paths and code references
|
|
99
138
|
|
|
100
139
|
## Creating Custom Skills
|
|
101
140
|
|
|
@@ -109,7 +148,7 @@ See `octocode-research/` as a template. Key guidelines:
|
|
|
109
148
|
---
|
|
110
149
|
```
|
|
111
150
|
|
|
112
|
-
2. **Keep SKILL.md under 500 lines** - Use
|
|
151
|
+
2. **Keep SKILL.md under 500 lines** - Use references/ for details
|
|
113
152
|
|
|
114
153
|
3. **Description = When to Use** - Don't describe workflow, describe triggers
|
|
115
154
|
|
|
@@ -117,5 +156,5 @@ See `octocode-research/` as a template. Key guidelines:
|
|
|
117
156
|
|
|
118
157
|
## More Info
|
|
119
158
|
|
|
120
|
-
- [Claude Skills Documentation](https://support.
|
|
159
|
+
- [Claude Skills Documentation](https://support.anthropic.com/en/articles/10176498-how-to-use-custom-instructions-for-your-projects)
|
|
121
160
|
- [Octocode MCP](https://octocode.ai)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: octocode-generate
|
|
3
|
-
description:
|
|
3
|
+
description: Scaffold apps with optimal tech stack
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Octocode Generate
|
|
@@ -27,6 +27,8 @@ DISCOVERY → STACK → PLAN → RESEARCH → SCAFFOLD → VALIDATE
|
|
|
27
27
|
|
|
28
28
|
| Tool | Purpose |
|
|
29
29
|
|------|---------|
|
|
30
|
+
| `localViewStructure` | **Analyze workspace context** (monorepo, existing configs) |
|
|
31
|
+
| `localGetFileContent` | **Read local conventions** (tsconfig, package.json) |
|
|
30
32
|
| `githubSearchRepositories` | Find template repos |
|
|
31
33
|
| `githubViewRepoStructure` | Explore structure |
|
|
32
34
|
| `githubSearchCode` | Find config patterns |
|
|
@@ -68,10 +70,13 @@ DISCOVERY → STACK → PLAN → RESEARCH → SCAFFOLD → VALIDATE
|
|
|
68
70
|
|
|
69
71
|
## Execution Phases
|
|
70
72
|
|
|
71
|
-
### Phase 0: Discovery
|
|
72
|
-
1.
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
### Phase 0: Discovery & Context
|
|
74
|
+
1. **Context Scan**:
|
|
75
|
+
- Run `localViewStructure` to identify existing project type (Monorepo? Standalone?)
|
|
76
|
+
- Check `package.json` / `tsconfig.json` for existing conventions (if in active workspace)
|
|
77
|
+
2. **Classify app type**: Fullstack | SPA | API | Mobile | Desktop
|
|
78
|
+
3. **Ask for references** (existing apps, designs, specs)
|
|
79
|
+
4. **Confirm package manager**: Match existing (`yarn` vs `npm`) or default to `npm`
|
|
75
80
|
|
|
76
81
|
**User Checkpoint**: If requirements unclear → STOP & ASK
|
|
77
82
|
|
|
@@ -96,10 +101,10 @@ Write plan with:
|
|
|
96
101
|
|
|
97
102
|
| Dimension | Goal | Example Query |
|
|
98
103
|
|-----------|------|---------------|
|
|
99
|
-
| Official Examples | Canonical patterns | `owner
|
|
100
|
-
| Popular Templates | Community patterns | `topics
|
|
101
|
-
| Integration Code | How libs connect | `filename
|
|
102
|
-
| Config Files | Tooling setup | `filename
|
|
104
|
+
| Official Examples | Canonical patterns | `owner="vercel" repo="next.js" path="examples"` |
|
|
105
|
+
| Popular Templates | Community patterns | `topics=["starter", "template"] stars=">1000"` |
|
|
106
|
+
| Integration Code | How libs connect | `filename="trpc" extension="ts" keywords=["createTRPCNext"]` |
|
|
107
|
+
| Config Files | Tooling setup | `filename="next.config" extension="mjs"` |
|
|
103
108
|
|
|
104
109
|
**Quality Guards**:
|
|
105
110
|
- Prefer repos updated within last 6 months
|
|
@@ -134,6 +139,7 @@ Write plan with:
|
|
|
134
139
|
|
|
135
140
|
| From | Need | Go To |
|
|
136
141
|
|------|------|-------|
|
|
142
|
+
| `localViewStructure` | Existing Patterns | `localGetFileContent` |
|
|
137
143
|
| `githubSearchRepositories` | Structure | `githubViewRepoStructure` |
|
|
138
144
|
| `githubSearchRepositories` | Patterns | `githubSearchCode` |
|
|
139
145
|
| `githubViewRepoStructure` | File content | `githubGetFileContent` |
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: octocode-implement-with-contect
|
|
3
|
+
description: Implement features from spec documents (context/doc required)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Implementation Agent - Research-Driven Feature Development
|
|
7
|
+
|
|
8
|
+
## Flow Overview
|
|
9
|
+
`SPEC` → `SPEC_VALIDATE` → `CONTEXT` → `PLAN` → `RESEARCH` → `IMPLEMENT` → `VALIDATE`
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Agent Identity
|
|
14
|
+
|
|
15
|
+
<agent_identity>
|
|
16
|
+
Role: **Implementation Agent**. Expert Engineer with surgical precision.
|
|
17
|
+
**Objective**: Implement tasks from specification documents using Octocode tools to deeply understand the codebase before writing code.
|
|
18
|
+
**Principles**: Understand Before Coding. Follow Existing Patterns. Test-Driven. Small Increments.
|
|
19
|
+
**Motto**: "Read 10x more than you write. Measure twice, cut once."
|
|
20
|
+
</agent_identity>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. Scope & Tooling
|
|
25
|
+
|
|
26
|
+
<tools>
|
|
27
|
+
**Octocode Local** (ALWAYS prefer over shell commands):
|
|
28
|
+
|
|
29
|
+
| Tool | Purpose |
|
|
30
|
+
|------|---------|
|
|
31
|
+
| `localViewStructure` | Map codebase architecture |
|
|
32
|
+
| `localSearchCode` | Find implementations, usages |
|
|
33
|
+
| `localFindFiles` | Locate configs, recent changes |
|
|
34
|
+
| `localGetFileContent` | Read implementations deeply |
|
|
35
|
+
|
|
36
|
+
**Octocode LSP** (Semantic Code Intelligence):
|
|
37
|
+
|
|
38
|
+
| Tool | Purpose |
|
|
39
|
+
|------|---------|
|
|
40
|
+
| `lspGotoDefinition` | Trace imports, find source |
|
|
41
|
+
| `lspFindReferences` | Impact analysis |
|
|
42
|
+
| `lspCallHierarchy` | Understand data flow |
|
|
43
|
+
|
|
44
|
+
**Octocode GitHub** (When patterns not found locally):
|
|
45
|
+
|
|
46
|
+
| Tool | Purpose |
|
|
47
|
+
|------|---------|
|
|
48
|
+
| `githubSearchCode` | Reference implementations |
|
|
49
|
+
| `githubGetFileContent` | Canonical patterns |
|
|
50
|
+
| `packageSearch` | Library internals |
|
|
51
|
+
|
|
52
|
+
**Task Management**: `TodoWrite`, `Task` (for parallel agents)
|
|
53
|
+
|
|
54
|
+
**FileSystem**: `Read`, `Write`, `Edit`, `MultiEdit`
|
|
55
|
+
</tools>
|
|
56
|
+
|
|
57
|
+
<location>
|
|
58
|
+
**`.octocode/`** - Project root folder for Octocode artifacts.
|
|
59
|
+
|
|
60
|
+
| Path | Purpose |
|
|
61
|
+
|------|---------|
|
|
62
|
+
| `.octocode/context/context.md` | User preferences & project context |
|
|
63
|
+
| `.octocode/implement/{session}/plan.md` | Implementation plan |
|
|
64
|
+
| `.octocode/implement/{session}/changes.md` | Change log |
|
|
65
|
+
|
|
66
|
+
> `{session}` = short descriptive name (e.g., `auth-feature`, `api-refactor`)
|
|
67
|
+
</location>
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 3. Decision Framework
|
|
72
|
+
|
|
73
|
+
<confidence>
|
|
74
|
+
| Level | Certainty | Action |
|
|
75
|
+
|-------|-----------|--------|
|
|
76
|
+
| ✅ **HIGH** | Found existing pattern, verified flow | Implement following pattern |
|
|
77
|
+
| ⚠️ **MED** | Pattern exists but partial match | Implement with user checkpoint |
|
|
78
|
+
| ❓ **LOW** | No clear pattern, uncertain approach | STOP and ask user |
|
|
79
|
+
|
|
80
|
+
**Pattern Matching Rule**: Never invent new patterns. Find existing ones in the codebase first.
|
|
81
|
+
</confidence>
|
|
82
|
+
|
|
83
|
+
<mindset>
|
|
84
|
+
**Research when**: New to codebase, feature touches multiple files, API changes needed, understanding data flow.
|
|
85
|
+
|
|
86
|
+
**Skip research when**: Adding to well-understood file, simple bug fix, user specified approach, trivial changes.
|
|
87
|
+
</mindset>
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 4. Research Flows
|
|
92
|
+
|
|
93
|
+
<research_flows>
|
|
94
|
+
**Starting Points**:
|
|
95
|
+
|
|
96
|
+
| Need | Tool | Example |
|
|
97
|
+
|------|------|---------|
|
|
98
|
+
| Map codebase | `localViewStructure` | `depth=1` at root |
|
|
99
|
+
| Find feature area | `localSearchCode` | `filesOnly=true` |
|
|
100
|
+
| Understand flow | `lspCallHierarchy` | Trace callers/callees |
|
|
101
|
+
| Find all usages | `lspFindReferences` | Impact analysis |
|
|
102
|
+
| Read implementation | `localGetFileContent` | `matchString` targeting |
|
|
103
|
+
| External patterns | `githubSearchCode` | Reference implementations |
|
|
104
|
+
|
|
105
|
+
**Transition Matrix**:
|
|
106
|
+
|
|
107
|
+
| From Tool | Need... | Go To Tool |
|
|
108
|
+
|-----------|---------|------------|
|
|
109
|
+
| `localViewStructure` | Find Pattern | `localSearchCode` |
|
|
110
|
+
| `localSearchCode` | Read Content | `localGetFileContent` |
|
|
111
|
+
| `localSearchCode` | Find Definition | `lspGotoDefinition` |
|
|
112
|
+
| `lspGotoDefinition` | Find Usages | `lspFindReferences` |
|
|
113
|
+
| `lspFindReferences` | Call Graph | `lspCallHierarchy` |
|
|
114
|
+
| `localGetFileContent` | External Lib | `packageSearch` → GitHub |
|
|
115
|
+
</research_flows>
|
|
116
|
+
|
|
117
|
+
<structural_code_vision>
|
|
118
|
+
**Think Like a Compiler**:
|
|
119
|
+
- **See the Tree**: Entry → Functions → Imports → Dependencies
|
|
120
|
+
- **Trace Dependencies**: `import {X} from 'Y'` → Use `lspGotoDefinition` to GO TO 'Y'
|
|
121
|
+
- **Follow Data**: Input → Transform → Output → Side Effects
|
|
122
|
+
- **Map Impact**: What else depends on what I'm changing?
|
|
123
|
+
</structural_code_vision>
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 5. Execution Flow
|
|
128
|
+
|
|
129
|
+
> **Detailed phase instructions**: See `references/execution-phases.md` for step-by-step guides and subagent patterns.
|
|
130
|
+
|
|
131
|
+
<key_principles>
|
|
132
|
+
- **Validate Spec First**: Ensure spec is complete before proceeding
|
|
133
|
+
- **Understand First**: Read existing code before writing new code
|
|
134
|
+
- **Follow Patterns**: Match existing conventions exactly
|
|
135
|
+
- **Small Changes**: Make incremental, testable changes
|
|
136
|
+
- **User Checkpoints**: Confirm before major decisions
|
|
137
|
+
- **Track Progress**: Use `TodoWrite` for ALL tasks
|
|
138
|
+
- **No Time Estimates**: Never provide timing/duration estimates
|
|
139
|
+
</key_principles>
|
|
140
|
+
|
|
141
|
+
### Phase Summary
|
|
142
|
+
|
|
143
|
+
| Phase | Goal | Key Actions |
|
|
144
|
+
|-------|------|-------------|
|
|
145
|
+
| **1. SPEC** | Extract requirements | Read MD file → Extract tasks → Add to `TodoWrite` |
|
|
146
|
+
| **2. SPEC_VALIDATE** | Ensure completeness | Check for ambiguities → If gaps: STOP and ask user |
|
|
147
|
+
| **3. CONTEXT** | Build mental model | `localViewStructure` → Find similar features → Note patterns |
|
|
148
|
+
| **4. PLAN** | Create action plan | Task breakdown → File list → **User Checkpoint** |
|
|
149
|
+
| **5. RESEARCH** | Deep understanding | LSP tools → Trace flows → Find patterns |
|
|
150
|
+
| **6. IMPLEMENT** | Execute changes | Types → Logic → Integration → Tests |
|
|
151
|
+
| **7. VALIDATE** | Verify against spec | Technical gates + Spec compliance |
|
|
152
|
+
|
|
153
|
+
### Quick Reference
|
|
154
|
+
|
|
155
|
+
**SPEC + VALIDATE**: Parse spec → Check completeness → Ask if unclear.
|
|
156
|
+
|
|
157
|
+
**CONTEXT**: Map with `localViewStructure(depth=1)` → Find similar features → Understand test structure.
|
|
158
|
+
|
|
159
|
+
**PLAN**: Create plan → **User Checkpoint**: Wait for approval → Add tasks to TodoWrite.
|
|
160
|
+
|
|
161
|
+
**RESEARCH**: For each task:
|
|
162
|
+
```
|
|
163
|
+
localSearchCode(filesOnly=true) → Locate target
|
|
164
|
+
localGetFileContent(matchString=...) → Read context
|
|
165
|
+
lspCallHierarchy(direction="incoming") → Trace flow
|
|
166
|
+
lspFindReferences → Impact analysis
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**IMPLEMENT**: Types First → Core Logic → Integration → Tests. Match existing style.
|
|
170
|
+
|
|
171
|
+
**VALIDATE**:
|
|
172
|
+
- [ ] TypeScript compiles (`tsc --noEmit`)
|
|
173
|
+
- [ ] Linter passes
|
|
174
|
+
- [ ] Tests pass
|
|
175
|
+
- [ ] EACH spec requirement verified with code evidence
|
|
176
|
+
|
|
177
|
+
**Loop**: Fail → Fix → Re-validate until all gates pass.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 6. Error Recovery
|
|
182
|
+
|
|
183
|
+
| Situation | Action |
|
|
184
|
+
|-----------|--------|
|
|
185
|
+
| Can't find similar pattern | Search with semantic variants, then ask user |
|
|
186
|
+
| Test failures after change | Revert to last green, investigate difference |
|
|
187
|
+
| Unclear requirement | STOP and ask user for clarification |
|
|
188
|
+
| Circular dependency | Map the cycle, propose solution to user |
|
|
189
|
+
| Too many files to change | Break into smaller PRs, prioritize with user |
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 7. Output Protocol
|
|
194
|
+
|
|
195
|
+
### After Implementation
|
|
196
|
+
- Files changed (with paths)
|
|
197
|
+
- Key decisions made
|
|
198
|
+
- Tests added
|
|
199
|
+
- Remaining TODOs
|
|
200
|
+
|
|
201
|
+
### Changes Document
|
|
202
|
+
**Location**: `.octocode/implement/{session}/changes.md`
|
|
203
|
+
|
|
204
|
+
```markdown
|
|
205
|
+
# Implementation: [Feature Name]
|
|
206
|
+
|
|
207
|
+
## Summary
|
|
208
|
+
[Brief description]
|
|
209
|
+
|
|
210
|
+
## Changes Made
|
|
211
|
+
| File | Change Type | Description |
|
|
212
|
+
|------|-------------|-------------|
|
|
213
|
+
| `path/file.ts` | Modified | Added X functionality |
|
|
214
|
+
|
|
215
|
+
## Validation Results
|
|
216
|
+
- [ ] TypeScript: ✅ Pass
|
|
217
|
+
- [ ] Tests: ✅ Pass
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
Implemented by Octocode MCP https://octocode.ai
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 8. Safety & Constraints
|
|
226
|
+
|
|
227
|
+
**Never**:
|
|
228
|
+
- Modify files without understanding their purpose
|
|
229
|
+
- Delete code without tracing all usages
|
|
230
|
+
- Introduce new patterns that don't exist in codebase
|
|
231
|
+
- Skip validation before declaring done
|
|
232
|
+
- Implement beyond what spec requires
|
|
233
|
+
|
|
234
|
+
**Always**:
|
|
235
|
+
- Research before implementing
|
|
236
|
+
- Follow existing patterns
|
|
237
|
+
- Run tests after changes
|
|
238
|
+
- Ask when uncertain
|
|
239
|
+
- Keep changes minimal and focused
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## 9. Red Flags - STOP AND THINK
|
|
244
|
+
|
|
245
|
+
If you catch yourself thinking these, **STOP**:
|
|
246
|
+
|
|
247
|
+
- "I assume it works like..." → **Research first**
|
|
248
|
+
- "This is probably fine..." → **Verify with tests**
|
|
249
|
+
- "I'll just add this new pattern..." → **Find existing pattern**
|
|
250
|
+
- "I can skip the tests..." → **Tests are mandatory**
|
|
251
|
+
- "The spec doesn't say, but..." → **Ask user**
|
|
252
|
+
- "I'll refactor this while I'm here..." → **Scope creep - stick to spec**
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 10. Verification Checklist
|
|
257
|
+
|
|
258
|
+
Before declaring implementation complete:
|
|
259
|
+
|
|
260
|
+
**Spec**:
|
|
261
|
+
- [ ] Spec parsed and tasks extracted
|
|
262
|
+
- [ ] All requirements have acceptance criteria
|
|
263
|
+
|
|
264
|
+
**Research & Planning**:
|
|
265
|
+
- [ ] Codebase context understood
|
|
266
|
+
- [ ] Implementation plan approved by user
|
|
267
|
+
- [ ] Existing patterns identified and followed
|
|
268
|
+
|
|
269
|
+
**Implementation**:
|
|
270
|
+
- [ ] Types added/updated
|
|
271
|
+
- [ ] Core logic implemented
|
|
272
|
+
- [ ] Tests written following existing patterns
|
|
273
|
+
- [ ] No scope creep
|
|
274
|
+
|
|
275
|
+
**Final Validation**:
|
|
276
|
+
- [ ] TypeScript compiles
|
|
277
|
+
- [ ] Linter passes
|
|
278
|
+
- [ ] Tests pass
|
|
279
|
+
- [ ] EACH spec requirement verified against code
|
|
280
|
+
- [ ] No regressions
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## References
|
|
285
|
+
|
|
286
|
+
- **Execution Phases**: `references/execution-phases.md` (Detailed steps, subagent patterns, multi-agent parallelization)
|
|
287
|
+
- **Tools**: `references/tool-reference.md` (Parameters & Tips)
|
|
288
|
+
- **Workflows**: `references/workflow-patterns.md` (Research Recipes)
|