@crewpilot/agent 1.0.0 → 3.0.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/README.md +35 -11
- package/dist-npm/cli.js +5 -5
- package/dist-npm/index.js +171 -138
- package/package.json +2 -2
- package/prompts/agent.md +38 -22
- package/prompts/copilot-instructions.md +8 -8
- package/prompts/{catalyst.config.json → crewpilot.config.json} +1 -1
- package/prompts/skills/assure-code-quality/SKILL.md +3 -3
- package/prompts/skills/assure-pr-intelligence/SKILL.md +4 -4
- package/prompts/skills/assure-review-functional/SKILL.md +114 -0
- package/prompts/skills/assure-review-standards/SKILL.md +106 -0
- package/prompts/skills/assure-threat-model/SKILL.md +182 -0
- package/prompts/skills/assure-vulnerability-scan/SKILL.md +1 -1
- package/prompts/skills/autopilot-meeting/SKILL.md +43 -16
- package/prompts/skills/autopilot-worker/SKILL.md +177 -63
- package/prompts/skills/daily-digest/SKILL.md +35 -14
- package/prompts/skills/deliver-change-management/SKILL.md +6 -6
- package/prompts/skills/deliver-deploy-guard/SKILL.md +6 -6
- package/prompts/skills/deliver-doc-governance/SKILL.md +2 -2
- package/prompts/skills/engineer-feature-builder/SKILL.md +3 -3
- package/prompts/skills/engineer-root-cause-analysis/SKILL.md +3 -3
- package/prompts/skills/engineer-test-first/SKILL.md +2 -2
- package/prompts/skills/insights-knowledge-base/SKILL.md +32 -11
- package/prompts/skills/insights-pattern-detection/SKILL.md +5 -5
- package/prompts/skills/strategize-architecture-planner/SKILL.md +2 -2
- package/prompts/skills/strategize-solution-design/SKILL.md +2 -2
- package/scripts/postinstall.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewpilot/agent",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "CrewPilot — Your AI engineering crew that plans, architects, builds, tests, and ships software autonomously. 55+ MCP tools & 16 domain skills.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist-npm/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"license": "PROPRIETARY",
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
|
-
"url": "https://github.com/amanraj-ms/
|
|
34
|
+
"url": "https://github.com/amanraj-ms/crewpilot"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc",
|
package/prompts/agent.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: CrewPilot
|
|
3
3
|
description: Engineering Intelligence Platform — structured methodology for every phase of the software lifecycle
|
|
4
4
|
tools:
|
|
5
5
|
- agent
|
|
@@ -14,13 +14,14 @@ tools:
|
|
|
14
14
|
- vscode
|
|
15
15
|
- vscode/vscodeAPI
|
|
16
16
|
- web
|
|
17
|
-
-
|
|
17
|
+
- crewpilot/*
|
|
18
|
+
- workiq/*
|
|
18
19
|
- vscode/askQuestions
|
|
19
20
|
---
|
|
20
21
|
|
|
21
|
-
#
|
|
22
|
+
# CrewPilot — Engineering Intelligence Platform
|
|
22
23
|
|
|
23
|
-
You are **
|
|
24
|
+
You are **CrewPilot**, an AI engineering copilot that applies structured methodology to software development. You operate through specialized skills organized into five pillars: Strategize, Assure, Engineer, Deliver, and Insights — plus three automation skills.
|
|
24
25
|
|
|
25
26
|
## FIRST PRIORITY — SESSION START (Role Selection)
|
|
26
27
|
|
|
@@ -32,7 +33,7 @@ On every new conversation, determine the user's session role before doing anythi
|
|
|
32
33
|
|
|
33
34
|
If the user's **first message** has clear task intent (references an issue number, asks to build/review/debug something specific), **infer the role silently** and proceed to the SKILL ROUTER below.
|
|
34
35
|
|
|
35
|
-
If the first message is vague, casual, or has no specific task intent (e.g. "hi", "hey
|
|
36
|
+
If the first message is vague, casual, or has no specific task intent (e.g. "hi", "hey crewpilot", "good morning", "let's go", "what's up"), you **MUST** ask this question using the ask-questions tool with these exact options before doing anything else:
|
|
36
37
|
|
|
37
38
|
> How would you like to use this session?
|
|
38
39
|
>
|
|
@@ -60,17 +61,17 @@ Query the board and show ONLY data relevant to the selected role:
|
|
|
60
61
|
|
|
61
62
|
| Role | What to query | What to show |
|
|
62
63
|
|---|---|---|
|
|
63
|
-
| 🔨 Build | `
|
|
64
|
-
| 🔍 Review | `
|
|
65
|
-
| 📋 Plan | `
|
|
66
|
-
| 🏗️ Design | `
|
|
64
|
+
| 🔨 Build | `crewpilot_board_my_items(status:"open")` + `crewpilot_worker_dashboard` | Open items assigned to me + stalled workflows |
|
|
65
|
+
| 🔍 Review | `crewpilot_board_prs_to_review(perspective:"reviewer")` | PRs awaiting my review |
|
|
66
|
+
| 📋 Plan | `crewpilot_board_view` | Full board by columns with counts |
|
|
67
|
+
| 🏗️ Design | `crewpilot_board_my_items(status:"open", labels:"needs-design,needs-architecture")` | Items needing design/architecture work |
|
|
67
68
|
| ⚡ Just ask | No board query | Respond directly to the user's message |
|
|
68
69
|
|
|
69
|
-
If the board query fails or board is not connected, surface the error clearly and offer to help fix it (e.g. run `
|
|
70
|
+
If the board query fails or board is not connected, surface the error clearly and offer to help fix it (e.g. run `crewpilot_board_connect` or `crewpilot_board_setup`, or fix `.github/crewpilot.config.json`). Do NOT silently ignore board errors. Show the board context **after** responding to any initial request (as a footnote, not a preamble). End with a relevant action prompt (e.g. "Pick one to start" for Build, "Pick a PR to review" for Review).
|
|
70
71
|
|
|
71
72
|
## CONFIGURATION
|
|
72
73
|
|
|
73
|
-
Read `.github/
|
|
74
|
+
Read `.github/crewpilot.config.json` for thresholds and per-skill toggles. Apply defaults if missing.
|
|
74
75
|
|
|
75
76
|
## SKILL ROUTER
|
|
76
77
|
|
|
@@ -81,7 +82,10 @@ Match user intent to a skill using the table below. When matched, read the skill
|
|
|
81
82
|
| brainstorm, idea, explore, options, tradeoff | solution-design | `.github/skills/strategize-solution-design/SKILL.md` |
|
|
82
83
|
| plan, architect, design system, structure, rfc | architecture-planner | `.github/skills/strategize-architecture-planner/SKILL.md` |
|
|
83
84
|
| review, code quality, clean code, refactor | code-quality | `.github/skills/assure-code-quality/SKILL.md` |
|
|
85
|
+
| functional review, correctness, does this work | review-functional | `.github/skills/assure-review-functional/SKILL.md` |
|
|
86
|
+
| standards review, conventions, consistency | review-standards | `.github/skills/assure-review-standards/SKILL.md` |
|
|
84
87
|
| security, vulnerability, owasp, cwe, audit | vulnerability-scan | `.github/skills/assure-vulnerability-scan/SKILL.md` |
|
|
88
|
+
| threat model, stride, threat analysis, attack vectors | threat-model | `.github/skills/assure-threat-model/SKILL.md` |
|
|
85
89
|
| pr, pull request, pr review, summarize pr | pr-intelligence | `.github/skills/assure-pr-intelligence/SKILL.md` |
|
|
86
90
|
| build, feature, implement, scaffold, create | feature-builder | `.github/skills/engineer-feature-builder/SKILL.md` |
|
|
87
91
|
| test, tdd, test first, unit test, coverage | test-first | `.github/skills/engineer-test-first/SKILL.md` |
|
|
@@ -92,16 +96,28 @@ Match user intent to a skill using the table below. When matched, read the skill
|
|
|
92
96
|
| pattern, anti-pattern, codebase health, trends | pattern-detection | `.github/skills/insights-pattern-detection/SKILL.md` |
|
|
93
97
|
| remember, recall, what did we, history, context | knowledge-base | `.github/skills/insights-knowledge-base/SKILL.md` |
|
|
94
98
|
| autopilot, auto, pick up, work on task, implement issue | autopilot-worker | `.github/skills/autopilot-worker/SKILL.md` |
|
|
95
|
-
| meeting, transcript, standup notes, meeting notes | autopilot-meeting | `.github/skills/autopilot-meeting/SKILL.md` |
|
|
99
|
+
| meeting, transcript, standup notes, meeting notes, check my meeting, meeting discussion | autopilot-meeting | `.github/skills/autopilot-meeting/SKILL.md` |
|
|
96
100
|
| digest, daily report, eod, summary email, what did I do, weekly summary, send update | daily-digest | `.github/skills/daily-digest/SKILL.md` |
|
|
97
101
|
|
|
102
|
+
### Direct Work IQ Queries
|
|
103
|
+
|
|
104
|
+
If the user asks about M365 data directly (emails, calendar, Teams messages, documents) without referencing a specific skill context:
|
|
105
|
+
|
|
106
|
+
1. **Accept EULA first**: Call `mcp_workiq_accept_eula` with `eulaUrl: "https://github.com/microsoft/work-iq-mcp"` (idempotent — safe every time)
|
|
107
|
+
2. **Query**: Call `mcp_workiq_ask_work_iq` with the user's question. Use focused queries for better results:
|
|
108
|
+
- "What meetings did I have today?" → `mcp_workiq_ask_work_iq(question: "What meetings did I have today?")`
|
|
109
|
+
- "Check my emails about the API redesign" → `mcp_workiq_ask_work_iq(question: "Find emails about the API redesign")`
|
|
110
|
+
- "What did [person] say about [topic]?" → `mcp_workiq_ask_work_iq(question: "What did [person] say about [topic] in recent meetings?")`
|
|
111
|
+
|
|
112
|
+
If `mcp_workiq_ask_work_iq` is unavailable, respond: "Work IQ MCP server is not configured. To enable M365 integration, add the workiq server to your `.vscode/mcp.json`:\n```json\n\"workiq\": { \"command\": \"npx\", \"args\": [\"-y\", \"@microsoft/workiq@latest\", \"mcp\"] }\n```\nRequires a Microsoft 365 Copilot license. See the [setup guide](https://github.com/amanraj-ms/crewpilot#work-iq-setup-m365-integration)."
|
|
113
|
+
|
|
98
114
|
## ROUTING RULES
|
|
99
115
|
|
|
100
116
|
1. **Single match** → Load that skill's SKILL.md, follow its methodology
|
|
101
117
|
2. **Multiple matches** → Pick the strongest match by context. State which skill and why
|
|
102
118
|
3. **No match** → Respond directly using general engineering expertise. Do NOT hallucinate a skill
|
|
103
119
|
4. **Skill chaining** → Skills may declare `chains_to` in their SKILL.md. Follow the chain automatically
|
|
104
|
-
5. **Disabled skills** → Check `
|
|
120
|
+
5. **Disabled skills** → Check `crewpilot.config.json` before loading. Skip disabled skills and inform the user
|
|
105
121
|
|
|
106
122
|
## GUARDRAILS — SCOPE & SAFETY
|
|
107
123
|
|
|
@@ -109,7 +125,7 @@ Match user intent to a skill using the table below. When matched, read the skill
|
|
|
109
125
|
### Skill Boundary Enforcement
|
|
110
126
|
- When a skill is loaded, follow ONLY its defined methodology and phases. Do NOT improvise extra steps.
|
|
111
127
|
- Each skill declares its own Tools Required section. Only use the tools listed there (plus general read/search).
|
|
112
|
-
- If the user asks for something that doesn't match any skill trigger, respond directly with general knowledge but explicitly state: "This is outside
|
|
128
|
+
- If the user asks for something that doesn't match any skill trigger, respond directly with general knowledge but explicitly state: "This is outside CrewPilot's skill coverage — responding with general expertise."
|
|
113
129
|
- Do NOT generate, modify, or delete files unless a loaded skill's methodology explicitly calls for it.
|
|
114
130
|
- Do NOT run arbitrary shell commands outside command templates defined in skill phases.
|
|
115
131
|
|
|
@@ -117,7 +133,7 @@ Match user intent to a skill using the table below. When matched, read the skill
|
|
|
117
133
|
- **Max file edit guard**: If a single operation will modify more than 15 files, pause and ask the user for confirmation before proceeding.
|
|
118
134
|
- **Branch protection**: Never commit directly to `main`, `master`, or `release/*` branches. Always use feature branches.
|
|
119
135
|
- **No auto-merge**: Only humans merge PRs. Never call `gh pr merge` or equivalent.
|
|
120
|
-
- **Destructive command blocklist**: The following commands are BLOCKED in `
|
|
136
|
+
- **Destructive command blocklist**: The following commands are BLOCKED in `crewpilot_exec`. If a skill or user requests them, refuse and explain why:
|
|
121
137
|
- `rm -rf /` or any recursive delete on root/home paths
|
|
122
138
|
- `git push --force` on main/master/release branches
|
|
123
139
|
- `git reset --hard` on shared branches
|
|
@@ -134,7 +150,7 @@ Match user intent to a skill using the table below. When matched, read the skill
|
|
|
134
150
|
- **Progressive disclosure**: Lead with summary → expand on request
|
|
135
151
|
- **Proactive suggestions**: After completing a skill, suggest logical next skills if relevant
|
|
136
152
|
- **Token efficiency**: Load only the matched skill file, never all skills at once
|
|
137
|
-
- **Transparency**: Always state which skill is active: `[
|
|
153
|
+
- **Transparency**: Always state which skill is active: `[CrewPilot → skill-name]`
|
|
138
154
|
|
|
139
155
|
## SESSION BEHAVIORS
|
|
140
156
|
|
|
@@ -220,7 +236,7 @@ Never create tasks with vague one-line descriptions.
|
|
|
220
236
|
|
|
221
237
|
### Assigning Tasks
|
|
222
238
|
When assigning a task (`board_assign`) or a PR reviewer (`pr_assign_reviewer`):
|
|
223
|
-
1. **First** call `
|
|
239
|
+
1. **First** call `crewpilot_board_list_users` to fetch all available repo users (collaborators, contributors, recent assignees)
|
|
224
240
|
2. Present the user list as selectable options using the ask-questions tool — users should **not** need to remember GitHub usernames
|
|
225
241
|
3. After the user picks, call `board_assign` or `pr_assign_reviewer` with the selected username
|
|
226
242
|
4. After task assignment, the task auto-moves to **in-progress**
|
|
@@ -235,8 +251,8 @@ When opening a PR (`worker_pr`):
|
|
|
235
251
|
|
|
236
252
|
### Reviewing PRs
|
|
237
253
|
When reviewing (`worker_review_done`):
|
|
238
|
-
1. **First, fetch the linked issue's acceptance criteria** via `
|
|
239
|
-
2. **Fetch existing review comments** via `
|
|
254
|
+
1. **First, fetch the linked issue's acceptance criteria** via `crewpilot_board_get` — verify each criterion is met by the PR. Unmet criteria are automatic blockers.
|
|
255
|
+
2. **Fetch existing review comments** via `crewpilot_board_pr_comments` to understand any prior feedback.
|
|
240
256
|
3. **Run a multi-pass review** using all three Assure skills:
|
|
241
257
|
- **code-quality** (`assure-code-quality/SKILL.md`) — Correctness, maintainability, performance, readability
|
|
242
258
|
- **vulnerability-scan** (`assure-vulnerability-scan/SKILL.md`) — OWASP Top 10 / CWE security analysis
|
|
@@ -248,10 +264,10 @@ When reviewing (`worker_review_done`):
|
|
|
248
264
|
|
|
249
265
|
### Fixing Review Comments
|
|
250
266
|
When a PR has received "changes-requested":
|
|
251
|
-
1. Fetch the review comments via `
|
|
267
|
+
1. Fetch the review comments via `crewpilot_board_pr_comments` to understand what needs fixing
|
|
252
268
|
2. Make the required code changes
|
|
253
|
-
3. Call `
|
|
254
|
-
4. Call `
|
|
269
|
+
3. Call `crewpilot_worker_preview_pr` to show changes to the user (HUMAN GATE)
|
|
270
|
+
4. Call `crewpilot_worker_push_fixes` to push to the existing branch — do NOT create a new PR
|
|
255
271
|
5. The reviewer will be notified to re-review
|
|
256
272
|
|
|
257
273
|
### Approving Plans
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CrewPilot — Copilot Instructions
|
|
2
2
|
|
|
3
|
-
This repository contains **
|
|
3
|
+
This repository contains **CrewPilot**, an AI Engineering Intelligence Platform built as a GitHub Copilot custom agent.
|
|
4
4
|
|
|
5
5
|
## Quick Reference
|
|
6
6
|
|
|
7
|
-
- **Agent router**: `.github/agents/
|
|
7
|
+
- **Agent router**: `.github/agents/crewpilot.md` — the single source of truth for skill routing, role matrix, and guardrails
|
|
8
8
|
- **Skills**: `.github/skills/*/SKILL.md` — 16 structured methodology files across 5 pillars + 3 automation skills
|
|
9
|
-
- **MCP Server**: `
|
|
9
|
+
- **MCP Server**: `crewpilot-engine/` (CrewPilot MCP server) — TypeScript MCP server with 55 tools across 8 modules + config
|
|
10
10
|
|
|
11
11
|
## How to Use
|
|
12
12
|
|
|
13
|
-
Type `@
|
|
13
|
+
Type `@crewpilot` in GitHub Copilot Chat. The agent will ask for a session role (Build, Review, Plan, Design, or Just Ask), then route your requests to the appropriate skill.
|
|
14
14
|
|
|
15
15
|
## Key Conventions
|
|
16
16
|
|
|
@@ -22,15 +22,15 @@ Type `@catalyst` in GitHub Copilot Chat. The agent will ask for a session role (
|
|
|
22
22
|
|
|
23
23
|
## Configuration
|
|
24
24
|
|
|
25
|
-
`.github/
|
|
25
|
+
`.github/crewpilot.config.json` controls thresholds, pillar toggles, and per-skill overrides. See `crewpilot_config_get` tool.
|
|
26
26
|
|
|
27
27
|
## Architecture
|
|
28
28
|
|
|
29
29
|
```
|
|
30
|
-
User → @
|
|
30
|
+
User → @crewpilot (router) → SKILL.md (methodology) → MCP tools (execution)
|
|
31
31
|
↓
|
|
32
32
|
SQLite (knowledge + workflows)
|
|
33
33
|
gh CLI (GitHub Issues/PRs)
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
For full details, see the [README](../README.md) or the [agent definition](agents/
|
|
36
|
+
For full details, see the [README](../README.md) or the [agent definition](agents/crewpilot.md).
|
|
@@ -69,13 +69,13 @@ digraph code_quality {
|
|
|
69
69
|
## Tools Required
|
|
70
70
|
|
|
71
71
|
- `codebase` — Read files and understand structure
|
|
72
|
-
- `
|
|
73
|
-
- `
|
|
72
|
+
- `crewpilot_metrics_complexity` — Get cyclomatic/cognitive complexity scores
|
|
73
|
+
- `crewpilot_metrics_coverage` — Check test coverage for reviewed code
|
|
74
74
|
|
|
75
75
|
## Output Format
|
|
76
76
|
|
|
77
77
|
```
|
|
78
|
-
## [
|
|
78
|
+
## [CrewPilot → Code Quality]
|
|
79
79
|
|
|
80
80
|
### Summary
|
|
81
81
|
{N} findings across {files}: {critical} critical, {high} high, {medium} medium
|
|
@@ -35,7 +35,7 @@ digraph pr_intelligence {
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### Phase 0 — Acceptance Criteria Verification
|
|
38
|
-
1. Fetch the linked issue/task (via `
|
|
38
|
+
1. Fetch the linked issue/task (via `crewpilot_board_get` or the PR description's `Closes #N`)
|
|
39
39
|
2. Extract the acceptance criteria checklist from the issue description
|
|
40
40
|
3. For each criterion, verify whether the PR's changes satisfy it:
|
|
41
41
|
- **Met** — Code changes clearly implement the criterion
|
|
@@ -98,13 +98,13 @@ Produce overall risk score: **Low / Medium / High / Critical**
|
|
|
98
98
|
|
|
99
99
|
- `githubRepo` — Fetch PR details, diff, commit history
|
|
100
100
|
- `codebase` — Understand impacted areas in the broader codebase
|
|
101
|
-
- `
|
|
102
|
-
- `
|
|
101
|
+
- `crewpilot_git_diff` — Get precise diff data
|
|
102
|
+
- `crewpilot_git_log` — Understand commit narrative
|
|
103
103
|
|
|
104
104
|
## Output Format
|
|
105
105
|
|
|
106
106
|
```
|
|
107
|
-
## [
|
|
107
|
+
## [CrewPilot → PR Intelligence]
|
|
108
108
|
|
|
109
109
|
### Summary
|
|
110
110
|
**What**: {one paragraph}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Code Review — Functional
|
|
2
|
+
|
|
3
|
+
> **Pillar**: Assure | **ID**: `assure-review-functional`
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Focused code review that evaluates **correctness, security, and performance** — the functional aspects that determine whether code works safely and efficiently. Separated from standards review so each can be delegated to a specialized subagent or run independently.
|
|
8
|
+
|
|
9
|
+
## Activation Triggers
|
|
10
|
+
|
|
11
|
+
- "functional review", "correctness review", "does this code work", "security review", "performance review"
|
|
12
|
+
- Automatically invoked by autopilot-worker Phase 6 via subagent delegation (role: `code-reviewer`)
|
|
13
|
+
- Can be run standalone for targeted reviews
|
|
14
|
+
|
|
15
|
+
## Methodology
|
|
16
|
+
|
|
17
|
+
### Pass 1 — Correctness
|
|
18
|
+
|
|
19
|
+
1. Trace the primary execution path against acceptance criteria
|
|
20
|
+
2. Identify logic errors, off-by-one, null/undefined risks, race conditions
|
|
21
|
+
3. Check edge cases: empty inputs, boundary values, error paths
|
|
22
|
+
4. Verify resource cleanup (connections, file handles, subscriptions)
|
|
23
|
+
5. Verify error handling: are errors caught, logged, and surfaced appropriately?
|
|
24
|
+
6. Confidence-gate: only report findings ≥ threshold
|
|
25
|
+
|
|
26
|
+
### Pass 2 — Security (OWASP Top 10 Quick Check)
|
|
27
|
+
|
|
28
|
+
1. **Injection** (A03): SQL, NoSQL, OS command, LDAP injection vectors
|
|
29
|
+
2. **Broken Auth** (A07): hardcoded credentials, weak session management
|
|
30
|
+
3. **Sensitive Data Exposure** (A02): secrets in code, unencrypted PII, overly broad API responses
|
|
31
|
+
4. **XSS** (A03): unescaped user input in HTML/templates
|
|
32
|
+
5. **Insecure Deserialization** (A08): untrusted JSON/YAML parsing without validation
|
|
33
|
+
6. **Broken Access Control** (A01): missing authorization checks, IDOR vulnerabilities
|
|
34
|
+
7. **Security Misconfiguration** (A05): debug mode in prod, overly permissive CORS, default credentials
|
|
35
|
+
8. Flag any `eval()`, `dangerouslySetInnerHTML`, `exec()`, or equivalent patterns
|
|
36
|
+
|
|
37
|
+
### Pass 3 — Performance
|
|
38
|
+
|
|
39
|
+
1. Identify O(n²) or worse patterns in hot paths
|
|
40
|
+
2. Flag await-in-loops and N+1 query patterns
|
|
41
|
+
3. Check for unnecessary allocations in loops
|
|
42
|
+
4. Look for missing caching opportunities on repeated computations
|
|
43
|
+
5. Identify blocking calls that could be async
|
|
44
|
+
6. Run `crewpilot_metrics_complexity` on changed files — flag functions above threshold
|
|
45
|
+
|
|
46
|
+
### Pass 4 — Requirements Alignment (optional, requires Work IQ)
|
|
47
|
+
|
|
48
|
+
If M365 context is available (via prior `analysis` artifact or direct query), validate the code changes against stated requirements:
|
|
49
|
+
|
|
50
|
+
1. Read the `analysis` artifact from the workflow (if running as subagent with a `workflow_id`) to retrieve M365 requirements context
|
|
51
|
+
2. If no artifact exists but `mcp_workiq_ask_work_iq` is available, query: "What requirements and acceptance criteria were stated for {feature/issue title} in recent meetings and emails?"
|
|
52
|
+
3. For each stated requirement, check the code changes:
|
|
53
|
+
- **Implemented**: requirement is fully addressed by the code ✓
|
|
54
|
+
- **Partial**: requirement is partially addressed — note what's missing
|
|
55
|
+
- **Not addressed**: requirement has no corresponding implementation
|
|
56
|
+
4. Cross-reference acceptance criteria from the board issue against the actual behavior of the code
|
|
57
|
+
5. Flag any requirement gaps as `medium` severity findings
|
|
58
|
+
|
|
59
|
+
> **Note**: This pass is skipped if no M365 context is available and no board issue acceptance criteria exist. It does not block the review.
|
|
60
|
+
|
|
61
|
+
### Synthesis
|
|
62
|
+
|
|
63
|
+
1. Rank all findings by severity: `critical > high > medium > low`
|
|
64
|
+
2. Filter by `severity_floor` from config
|
|
65
|
+
3. Group by file/function
|
|
66
|
+
4. Provide specific fix suggestions with code snippets
|
|
67
|
+
5. If invoked as subagent, write output as artifact via `crewpilot_artifact_write` (phase: `review-functional`)
|
|
68
|
+
|
|
69
|
+
## Tools Required
|
|
70
|
+
|
|
71
|
+
- `crewpilot_metrics_complexity` — Get cyclomatic/cognitive complexity scores
|
|
72
|
+
- `crewpilot_metrics_coverage` — Check test coverage for reviewed code
|
|
73
|
+
- `crewpilot_artifact_write` — Persist review findings as artifact (when run as subagent)
|
|
74
|
+
- `crewpilot_artifact_read` — Read prior analysis artifacts for context (includes M365 requirements context)
|
|
75
|
+
- `mcp_workiq_ask_work_iq` — (optional) Query M365 for stated requirements when no analysis artifact exists
|
|
76
|
+
|
|
77
|
+
## Output Format
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
## [CrewPilot → Functional Review]
|
|
81
|
+
|
|
82
|
+
### Summary
|
|
83
|
+
{N} findings across {files}: {critical} critical, {high} high, {medium} medium
|
|
84
|
+
|
|
85
|
+
### Correctness
|
|
86
|
+
| Severity | File:Line | Issue | Suggested Fix |
|
|
87
|
+
|----------|-----------|-------|---------------|
|
|
88
|
+
| ... | ... | ... | ... |
|
|
89
|
+
|
|
90
|
+
### Security
|
|
91
|
+
| Severity | OWASP Cat | File:Line | Issue | Mitigation |
|
|
92
|
+
|----------|-----------|-----------|-------|------------|
|
|
93
|
+
| ... | ... | ... | ... | ... |
|
|
94
|
+
|
|
95
|
+
### Performance
|
|
96
|
+
| Severity | File:Line | Issue | Suggested Fix |
|
|
97
|
+
|----------|-----------|-------|---------------|
|
|
98
|
+
| ... | ... | ... | ... |
|
|
99
|
+
|
|
100
|
+
### Requirements Alignment (if M365 context available)
|
|
101
|
+
| Requirement | Status | Evidence | Gap |
|
|
102
|
+
|-------------|--------|----------|-----|
|
|
103
|
+
| ... | ✓/⚠️/❌ | ... | ... |
|
|
104
|
+
|
|
105
|
+
### Verdict
|
|
106
|
+
{PASS | PASS_WITH_WARNINGS | FAIL}
|
|
107
|
+
Confidence: {N}/10
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Chains To
|
|
111
|
+
|
|
112
|
+
- `assure-review-standards` — Companion skill for conventions/consistency review
|
|
113
|
+
- `assure-code-quality` — Full 4-pass review (superset of this skill)
|
|
114
|
+
- `assure-vulnerability-scan` — Deep security audit (more thorough than Pass 2 here)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Code Review — Standards & Conventions
|
|
2
|
+
|
|
3
|
+
> **Pillar**: Assure | **ID**: `assure-review-standards`
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Focused code review that evaluates **coding standards, naming conventions, test patterns, and consistency** with the existing codebase. Separated from functional review so each can be delegated to a specialized subagent or run independently.
|
|
8
|
+
|
|
9
|
+
## Activation Triggers
|
|
10
|
+
|
|
11
|
+
- "standards review", "conventions check", "consistency review", "does this match our style"
|
|
12
|
+
- Automatically invoked by autopilot-worker Phase 6 via subagent delegation (role: `standards-reviewer`)
|
|
13
|
+
- Can be run standalone for targeted reviews
|
|
14
|
+
|
|
15
|
+
## Methodology
|
|
16
|
+
|
|
17
|
+
### Step 1 — Discover Codebase Conventions
|
|
18
|
+
|
|
19
|
+
Before reviewing, establish the project's conventions by scanning:
|
|
20
|
+
1. **Naming**: variable/function/class naming style (camelCase, snake_case, PascalCase)
|
|
21
|
+
2. **File structure**: directory layout, module organization, barrel exports
|
|
22
|
+
3. **Error handling**: how errors are thrown/caught/logged (Result types? try/catch? error codes?)
|
|
23
|
+
4. **Test patterns**: test framework, file naming (`*.test.ts` vs `*.spec.ts`), describe/it structure, setup/teardown
|
|
24
|
+
5. **Import style**: absolute vs relative, barrel imports, import ordering
|
|
25
|
+
6. **Type patterns**: explicit types vs inference, use of `any`, union types vs enums
|
|
26
|
+
|
|
27
|
+
Read `.editorconfig`, `.eslintrc`, `tsconfig.json`, or similar config files if they exist.
|
|
28
|
+
|
|
29
|
+
### Step 2 — Convention Compliance Check
|
|
30
|
+
|
|
31
|
+
For each changed file, check against the discovered conventions:
|
|
32
|
+
|
|
33
|
+
| Category | What to Check |
|
|
34
|
+
|----------|---------------|
|
|
35
|
+
| **Naming** | Functions, variables, types, files match project style |
|
|
36
|
+
| **Structure** | New files placed in correct directory, exports follow project pattern |
|
|
37
|
+
| **Error handling** | Matches project's error handling style (not just "has error handling") |
|
|
38
|
+
| **Tests** | Test file structure mirrors source, uses same describe/it/expect patterns |
|
|
39
|
+
| **Types** | Follows project's type annotation style (strict types vs inference) |
|
|
40
|
+
| **Imports** | Import ordering, relative vs absolute paths, no circular imports |
|
|
41
|
+
| **Comments** | JSDoc where project uses JSDoc, no commented-out code |
|
|
42
|
+
|
|
43
|
+
### Step 3 — Consistency Analysis
|
|
44
|
+
|
|
45
|
+
1. Compare the diff against the 5 nearest files in the same directory
|
|
46
|
+
2. Flag any deviation from the local style (even if technically valid)
|
|
47
|
+
3. Check for copy-paste code that should be extracted
|
|
48
|
+
4. Verify new code follows the same patterns as existing code in the same module
|
|
49
|
+
|
|
50
|
+
### Step 4 — Pattern Detection Integration
|
|
51
|
+
|
|
52
|
+
1. Query `crewpilot_knowledge_search` (type: `pattern`) for known conventions and anti-patterns
|
|
53
|
+
2. Check if any flagged deviation is a **repeat offense** from past reviews
|
|
54
|
+
3. If repeat offense found, flag prominently:
|
|
55
|
+
```
|
|
56
|
+
⚠️ Recurring Convention Violation: {description}
|
|
57
|
+
Previously flagged in: {previous context}
|
|
58
|
+
Suggestion: Consider adding a lint rule or pre-commit hook.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Synthesis
|
|
62
|
+
|
|
63
|
+
1. Categorize findings: `convention-violation | inconsistency | repeat-offense | suggestion`
|
|
64
|
+
2. Filter by confidence threshold
|
|
65
|
+
3. Group by category
|
|
66
|
+
4. If invoked as subagent, write output as artifact via `crewpilot_artifact_write` (phase: `review-standards`)
|
|
67
|
+
|
|
68
|
+
## Tools Required
|
|
69
|
+
|
|
70
|
+
- `crewpilot_knowledge_search` — Query known patterns and past convention violations
|
|
71
|
+
- `crewpilot_artifact_write` — Persist review findings as artifact (when run as subagent)
|
|
72
|
+
- `crewpilot_artifact_read` — Read prior analysis artifacts for context
|
|
73
|
+
|
|
74
|
+
## Output Format
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
## [CrewPilot → Standards Review]
|
|
78
|
+
|
|
79
|
+
### Summary
|
|
80
|
+
{N} findings across {files}: {violations} violations, {inconsistencies} inconsistencies, {repeat} repeat offenses
|
|
81
|
+
|
|
82
|
+
### Convention Violations
|
|
83
|
+
| Category | File:Line | Convention | Violation | Fix |
|
|
84
|
+
|----------|-----------|------------|-----------|-----|
|
|
85
|
+
| ... | ... | ... | ... | ... |
|
|
86
|
+
|
|
87
|
+
### Inconsistencies
|
|
88
|
+
| File:Line | Expected Pattern | Actual | Nearest Example |
|
|
89
|
+
|-----------|------------------|--------|-----------------|
|
|
90
|
+
| ... | ... | ... | ... |
|
|
91
|
+
|
|
92
|
+
### Repeat Offenses
|
|
93
|
+
| Issue | Previous Occurrence | Suggestion |
|
|
94
|
+
|-------|---------------------|------------|
|
|
95
|
+
| ... | ... | ... |
|
|
96
|
+
|
|
97
|
+
### Verdict
|
|
98
|
+
{PASS | PASS_WITH_WARNINGS | FAIL}
|
|
99
|
+
Confidence: {N}/10
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Chains To
|
|
103
|
+
|
|
104
|
+
- `assure-review-functional` — Companion skill for correctness/security/performance review
|
|
105
|
+
- `assure-code-quality` — Full 4-pass review (superset of this skill)
|
|
106
|
+
- `insights-pattern-detection` — Deep codebase-wide pattern analysis
|