@codyswann/lisa 1.67.3 → 1.69.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 +44 -49
- package/all/copy-overwrite/.claude/rules/base-rules.md +0 -50
- package/all/copy-overwrite/.claude/rules/intent-routing.md +126 -0
- package/all/copy-overwrite/.claude/rules/security-audit-handling.md +17 -0
- package/all/copy-overwrite/.claude/rules/verification.md +27 -538
- package/package.json +1 -1
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/agents/architecture-specialist.md +4 -9
- package/plugins/lisa/agents/bug-fixer.md +40 -0
- package/plugins/lisa/agents/builder.md +41 -0
- package/plugins/lisa/agents/debug-specialist.md +4 -93
- package/plugins/lisa/agents/jira-agent.md +103 -0
- package/plugins/lisa/agents/performance-specialist.md +2 -11
- package/plugins/lisa/agents/product-specialist.md +2 -10
- package/plugins/lisa/agents/quality-specialist.md +2 -0
- package/plugins/lisa/agents/security-specialist.md +3 -9
- package/plugins/lisa/agents/test-specialist.md +2 -16
- package/plugins/lisa/agents/verification-specialist.md +38 -103
- package/plugins/lisa/commands/build.md +10 -0
- package/plugins/lisa/commands/fix.md +10 -0
- package/plugins/lisa/commands/improve.md +16 -0
- package/plugins/lisa/commands/investigate.md +10 -0
- package/plugins/lisa/commands/jira/triage.md +7 -0
- package/plugins/lisa/commands/monitor.md +10 -0
- package/plugins/lisa/commands/plan/create.md +1 -1
- package/plugins/lisa/commands/plan/execute.md +1 -2
- package/plugins/lisa/commands/plan/improve-tests.md +7 -0
- package/plugins/lisa/commands/plan.md +10 -0
- package/plugins/lisa/commands/review.md +10 -0
- package/plugins/lisa/commands/ship.md +10 -0
- package/plugins/lisa/skills/acceptance-criteria/SKILL.md +71 -0
- package/plugins/lisa/skills/bug-triage/SKILL.md +23 -0
- package/plugins/lisa/skills/codebase-research/SKILL.md +87 -0
- package/plugins/lisa/skills/epic-triage/SKILL.md +28 -0
- package/plugins/lisa/skills/nightly-add-test-coverage/SKILL.md +27 -0
- package/plugins/lisa/skills/nightly-improve-tests/SKILL.md +31 -0
- package/plugins/lisa/skills/nightly-lower-code-complexity/SKILL.md +25 -0
- package/plugins/lisa/skills/performance-review/SKILL.md +94 -0
- package/plugins/lisa/skills/plan-improve-tests/SKILL.md +47 -0
- package/plugins/lisa/skills/quality-review/SKILL.md +54 -0
- package/plugins/lisa/skills/reproduce-bug/SKILL.md +96 -0
- package/plugins/lisa/skills/root-cause-analysis/SKILL.md +155 -0
- package/plugins/lisa/skills/security-review/SKILL.md +57 -0
- package/plugins/lisa/skills/task-decomposition/SKILL.md +95 -0
- package/plugins/lisa/skills/task-triage/SKILL.md +23 -0
- package/plugins/lisa/skills/tdd-implementation/SKILL.md +83 -0
- package/plugins/lisa/skills/test-strategy/SKILL.md +63 -0
- package/plugins/lisa/skills/ticket-triage/SKILL.md +150 -0
- package/plugins/lisa/skills/verification-lifecycle/SKILL.md +292 -0
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/agents/architecture-specialist.md +4 -9
- package/plugins/src/base/agents/bug-fixer.md +40 -0
- package/plugins/src/base/agents/builder.md +41 -0
- package/plugins/src/base/agents/debug-specialist.md +4 -93
- package/plugins/src/base/agents/jira-agent.md +103 -0
- package/plugins/src/base/agents/performance-specialist.md +2 -11
- package/plugins/src/base/agents/product-specialist.md +2 -10
- package/plugins/src/base/agents/quality-specialist.md +2 -0
- package/plugins/src/base/agents/security-specialist.md +3 -9
- package/plugins/src/base/agents/test-specialist.md +2 -16
- package/plugins/src/base/agents/verification-specialist.md +38 -103
- package/plugins/src/base/commands/build.md +10 -0
- package/plugins/src/base/commands/fix.md +10 -0
- package/plugins/src/base/commands/improve.md +16 -0
- package/plugins/src/base/commands/investigate.md +10 -0
- package/plugins/src/base/commands/jira/triage.md +7 -0
- package/plugins/src/base/commands/monitor.md +10 -0
- package/plugins/src/base/commands/plan/create.md +1 -1
- package/plugins/src/base/commands/plan/execute.md +1 -2
- package/plugins/src/base/commands/plan/improve-tests.md +7 -0
- package/plugins/src/base/commands/plan.md +10 -0
- package/plugins/src/base/commands/review.md +10 -0
- package/plugins/src/base/commands/ship.md +10 -0
- package/plugins/src/base/skills/acceptance-criteria/SKILL.md +71 -0
- package/plugins/src/base/skills/bug-triage/SKILL.md +23 -0
- package/plugins/src/base/skills/codebase-research/SKILL.md +87 -0
- package/plugins/src/base/skills/epic-triage/SKILL.md +28 -0
- package/plugins/src/base/skills/nightly-add-test-coverage/SKILL.md +27 -0
- package/plugins/src/base/skills/nightly-improve-tests/SKILL.md +31 -0
- package/plugins/src/base/skills/nightly-lower-code-complexity/SKILL.md +25 -0
- package/plugins/src/base/skills/performance-review/SKILL.md +94 -0
- package/plugins/src/base/skills/plan-improve-tests/SKILL.md +47 -0
- package/plugins/src/base/skills/quality-review/SKILL.md +54 -0
- package/plugins/src/base/skills/reproduce-bug/SKILL.md +96 -0
- package/plugins/src/base/skills/root-cause-analysis/SKILL.md +155 -0
- package/plugins/src/base/skills/security-review/SKILL.md +57 -0
- package/plugins/src/base/skills/task-decomposition/SKILL.md +95 -0
- package/plugins/src/base/skills/task-triage/SKILL.md +23 -0
- package/plugins/src/base/skills/tdd-implementation/SKILL.md +83 -0
- package/plugins/src/base/skills/test-strategy/SKILL.md +63 -0
- package/plugins/src/base/skills/ticket-triage/SKILL.md +150 -0
- package/plugins/src/base/skills/verification-lifecycle/SKILL.md +292 -0
- package/expo/copy-overwrite/.claude/rules/expo-verification.md +0 -261
- package/plugins/lisa/agents/agent-architect.md +0 -310
- package/plugins/lisa/agents/hooks-expert.md +0 -74
- package/plugins/lisa/agents/implementer.md +0 -54
- package/plugins/lisa/agents/slash-command-architect.md +0 -87
- package/plugins/lisa/agents/web-search-researcher.md +0 -112
- package/plugins/lisa/commands/git/commit-and-submit-pr.md +0 -7
- package/plugins/lisa/commands/git/commit-submit-pr-and-verify.md +0 -7
- package/plugins/lisa/commands/git/commit-submit-pr-deploy-and-verify.md +0 -7
- package/plugins/lisa/commands/jira/fix.md +0 -7
- package/plugins/lisa/commands/jira/implement.md +0 -7
- package/plugins/lisa/commands/sonarqube/check.md +0 -6
- package/plugins/lisa/commands/sonarqube/fix.md +0 -6
- package/plugins/lisa/commands/tasks/load.md +0 -7
- package/plugins/lisa/commands/tasks/sync.md +0 -7
- package/plugins/lisa/skills/git-commit-and-submit-pr/SKILL.md +0 -8
- package/plugins/lisa/skills/git-commit-submit-pr-and-verify/SKILL.md +0 -7
- package/plugins/lisa/skills/git-commit-submit-pr-deploy-and-verify/SKILL.md +0 -7
- package/plugins/lisa/skills/jira-fix/SKILL.md +0 -16
- package/plugins/lisa/skills/jira-implement/SKILL.md +0 -18
- package/plugins/lisa/skills/sonarqube-check/SKILL.md +0 -11
- package/plugins/lisa/skills/sonarqube-fix/SKILL.md +0 -8
- package/plugins/lisa/skills/tasks-load/SKILL.md +0 -88
- package/plugins/lisa/skills/tasks-sync/SKILL.md +0 -108
- package/plugins/src/base/agents/agent-architect.md +0 -310
- package/plugins/src/base/agents/hooks-expert.md +0 -74
- package/plugins/src/base/agents/implementer.md +0 -54
- package/plugins/src/base/agents/slash-command-architect.md +0 -87
- package/plugins/src/base/agents/web-search-researcher.md +0 -112
- package/plugins/src/base/commands/git/commit-and-submit-pr.md +0 -7
- package/plugins/src/base/commands/git/commit-submit-pr-and-verify.md +0 -7
- package/plugins/src/base/commands/git/commit-submit-pr-deploy-and-verify.md +0 -7
- package/plugins/src/base/commands/jira/fix.md +0 -7
- package/plugins/src/base/commands/jira/implement.md +0 -7
- package/plugins/src/base/commands/sonarqube/check.md +0 -6
- package/plugins/src/base/commands/sonarqube/fix.md +0 -6
- package/plugins/src/base/commands/tasks/load.md +0 -7
- package/plugins/src/base/commands/tasks/sync.md +0 -7
- package/plugins/src/base/skills/git-commit-and-submit-pr/SKILL.md +0 -8
- package/plugins/src/base/skills/git-commit-submit-pr-and-verify/SKILL.md +0 -7
- package/plugins/src/base/skills/git-commit-submit-pr-deploy-and-verify/SKILL.md +0 -7
- package/plugins/src/base/skills/jira-fix/SKILL.md +0 -16
- package/plugins/src/base/skills/jira-implement/SKILL.md +0 -18
- package/plugins/src/base/skills/sonarqube-check/SKILL.md +0 -11
- package/plugins/src/base/skills/sonarqube-fix/SKILL.md +0 -8
- package/plugins/src/base/skills/tasks-load/SKILL.md +0 -88
- package/plugins/src/base/skills/tasks-sync/SKILL.md +0 -108
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: epic-triage
|
|
3
|
+
description: "9-step epic triage and 5-step implementation workflow. Ensures epics are fully scoped, broken down, and ordered before execution begins."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Epic Triage
|
|
7
|
+
|
|
8
|
+
Follow this 9-step triage process before implementing any epic. Do not skip triage.
|
|
9
|
+
|
|
10
|
+
## Triage Steps
|
|
11
|
+
|
|
12
|
+
1. Verify you have all information needed to understand the full scope of this epic (goals, acceptance criteria, impacted systems, design specs, dependencies, etc.). Do not make assumptions. If anything is missing, stop and ask before proceeding.
|
|
13
|
+
2. Verify the epic is broken down into concrete, well-scoped bugs, tasks, and/or stories that are each fully triaged. If ambiguities exist, stop and resolve them before breaking it down.
|
|
14
|
+
3. Identify all cross-cutting concerns (auth, performance, security, data migrations, third-party integrations) that need to be addressed across the epic.
|
|
15
|
+
4. Identify all dependencies between tasks within the epic, or on external epics, teams, or services. Determine the correct order of execution.
|
|
16
|
+
5. Verify you have access to the tools, environments, and permissions needed to deploy and verify all tasks within this epic (e.g. CI/CD pipelines, deployment targets, logging/monitoring systems, API access, database access). If any are missing or inaccessible, stop and raise them before proceeding.
|
|
17
|
+
6. Define the overall test strategy for the epic (unit, integration, end-to-end, load testing).
|
|
18
|
+
7. Define the documentation that will need to be created or updated to cover the full scope of the epic so another developer understands the architecture, design decisions, and implementation.
|
|
19
|
+
8. Define measurable acceptance criteria that confirm the epic is fully complete.
|
|
20
|
+
9. Define how you will verify the epic is fully delivered beyond a shadow of a doubt (e.g. deploy to the target environment, walk through all acceptance criteria end-to-end, confirm all child tasks/stories are closed, confirm no regressions).
|
|
21
|
+
|
|
22
|
+
## Implementation
|
|
23
|
+
|
|
24
|
+
1. Use the output of the triage steps above as your guide. Do not skip triage.
|
|
25
|
+
2. Work through each task and/or story in the order defined during triage, respecting dependencies.
|
|
26
|
+
3. Apply the Bug Implementation and Task Implementation processes to each child bug or task, respectively, as you work through them.
|
|
27
|
+
4. Continuously update the epic and its child issues in JIRA as progress is made.
|
|
28
|
+
5. Do not consider the epic complete until all acceptance criteria are verified in the target environment and all child issues are resolved.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nightly-add-test-coverage
|
|
3
|
+
description: "Nightly direct-execution skill for increasing test coverage. Receives pre-computed threshold data, writes tests targeting coverage gaps, updates thresholds, commits, and creates a PR."
|
|
4
|
+
allowed-tools: ["Edit", "MultiEdit", "Write", "Read", "Glob", "Grep", "Bash"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Nightly Test Coverage Improvement
|
|
8
|
+
|
|
9
|
+
The caller provides pre-computed context:
|
|
10
|
+
- **Package manager** (`npm`, `yarn`, or `bun`)
|
|
11
|
+
- **Thresholds file** path (vitest.thresholds.json or jest.thresholds.json)
|
|
12
|
+
- **Current thresholds** (statements, branches, functions, lines percentages)
|
|
13
|
+
- **Proposed thresholds** (each metric increased by the coverage increment, capped at 90%)
|
|
14
|
+
- **Metrics being bumped** (which metrics are below target)
|
|
15
|
+
|
|
16
|
+
## Instructions
|
|
17
|
+
|
|
18
|
+
1. Read CLAUDE.md and package.json for project conventions
|
|
19
|
+
2. Run the project's coverage script with the provided package manager (e.g., `npm run test:cov`, `yarn test:cov`, or `bun run test:cov`) to get the coverage report -- identify gaps BEFORE reading any source files
|
|
20
|
+
3. Parse the coverage output to identify the specific files and lines with the lowest coverage. Prioritize files with the most uncovered lines/branches.
|
|
21
|
+
4. Read only the uncovered sections of source files using the coverage report line numbers -- do not explore the codebase broadly
|
|
22
|
+
5. Write new tests to increase coverage enough to meet the proposed thresholds. Focus on the metrics being bumped -- write tests that cover untested branches, statements, functions, and lines.
|
|
23
|
+
6. Re-run the coverage script with the provided package manager to verify the new thresholds pass
|
|
24
|
+
7. Update the thresholds file with the proposed new threshold values
|
|
25
|
+
8. Re-run the coverage script with the provided package manager to confirm the updated thresholds pass
|
|
26
|
+
9. Commit all changes (new tests + updated thresholds file) with conventional commit messages
|
|
27
|
+
10. Create a PR with `gh pr create` with a title like "test: increase test coverage: [metrics being bumped]" summarizing coverage improvements
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nightly-improve-tests
|
|
3
|
+
description: "Nightly direct-execution skill for improving test quality. In nightly mode, focuses on tests for recently changed files. In general mode, scans all tests for the weakest ones. Commits and creates a PR."
|
|
4
|
+
allowed-tools: ["Edit", "MultiEdit", "Write", "Read", "Glob", "Grep", "Bash"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Nightly Test Quality Improvement
|
|
8
|
+
|
|
9
|
+
The caller provides:
|
|
10
|
+
- **Mode**: "nightly" or "general"
|
|
11
|
+
- **Changed files** (nightly mode only): list of source files changed in the last 24 hours
|
|
12
|
+
|
|
13
|
+
## Nightly Mode
|
|
14
|
+
|
|
15
|
+
1. Read CLAUDE.md and package.json for project conventions
|
|
16
|
+
2. For each changed source file, find its corresponding test file(s)
|
|
17
|
+
3. Analyze those test files for: missing edge cases, weak assertions (toBeTruthy instead of specific values), missing error path coverage, tests that test implementation rather than behavior
|
|
18
|
+
4. Improve the test files with the most impactful changes
|
|
19
|
+
5. Run the full test suite to verify all tests pass
|
|
20
|
+
6. Commit changes with conventional commit messages
|
|
21
|
+
7. Create a PR with `gh pr create` summarizing what was improved and why
|
|
22
|
+
|
|
23
|
+
## General Mode
|
|
24
|
+
|
|
25
|
+
1. Read CLAUDE.md and package.json for project conventions
|
|
26
|
+
2. Scan the test files to find weak, brittle, or poorly-written tests
|
|
27
|
+
3. Look for: missing edge cases, weak assertions (toBeTruthy instead of specific values), missing error path coverage, tests that test implementation rather than behavior
|
|
28
|
+
4. Improve 3-5 test files with the most impactful changes
|
|
29
|
+
5. Run the full test suite to verify all tests pass
|
|
30
|
+
6. Commit changes with conventional commit messages
|
|
31
|
+
7. Create a PR with `gh pr create` summarizing what was improved and why
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nightly-lower-code-complexity
|
|
3
|
+
description: "Nightly direct-execution skill for reducing code complexity thresholds. Receives pre-computed threshold data, refactors violations, updates thresholds, commits, and creates a PR."
|
|
4
|
+
allowed-tools: ["Edit", "MultiEdit", "Write", "Read", "Glob", "Grep", "Bash"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Nightly Code Complexity Reduction
|
|
8
|
+
|
|
9
|
+
The caller provides pre-computed context:
|
|
10
|
+
- **Package manager** (`npm`, `yarn`, or `bun`)
|
|
11
|
+
- **Current thresholds** (cognitiveComplexity, maxLinesPerFunction from eslint.thresholds.json)
|
|
12
|
+
- **Proposed thresholds** (each metric decreased toward target minimums)
|
|
13
|
+
- **Metrics being reduced** (which metrics are above target)
|
|
14
|
+
|
|
15
|
+
## Instructions
|
|
16
|
+
|
|
17
|
+
1. Read CLAUDE.md and package.json for project conventions
|
|
18
|
+
2. Update eslint.thresholds.json with the proposed new threshold values (do NOT change the maxLines threshold)
|
|
19
|
+
3. Run the project's lint script with the provided package manager (e.g., `npm run lint`, `yarn lint`, or `bun run lint`) to find functions that violate the new stricter thresholds
|
|
20
|
+
4. For cognitive complexity violations: use early returns, extract helper functions, replace conditionals with lookup tables
|
|
21
|
+
5. For max-lines-per-function violations: split large functions, extract helper functions, separate concerns
|
|
22
|
+
6. Re-run the lint script with the provided package manager to verify all violations are resolved
|
|
23
|
+
7. Run the project's test script with the provided package manager (e.g., `npm run test`, `yarn test`, or `bun run test`) to verify no tests are broken by the refactoring
|
|
24
|
+
8. Commit all changes (refactored code + updated eslint.thresholds.json) with conventional commit messages
|
|
25
|
+
9. Create a PR with `gh pr create` with a title like "refactor: reduce code complexity: [metrics being reduced]" summarizing the changes
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: performance-review
|
|
3
|
+
description: "Performance review methodology. N+1 queries, inefficient algorithms, memory leaks, missing indexes, unnecessary re-renders, bundle size issues. Evidence-based recommendations."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Performance Review
|
|
7
|
+
|
|
8
|
+
Identify bottlenecks, inefficiencies, and scalability risks in code changes.
|
|
9
|
+
|
|
10
|
+
## Analysis Process
|
|
11
|
+
|
|
12
|
+
1. **Read affected files** -- understand data access patterns, algorithmic complexity, and resource usage
|
|
13
|
+
2. **Identify N+1 queries** -- look for ORM calls inside loops, missing eager loading, unbatched database access
|
|
14
|
+
3. **Check algorithmic complexity** -- nested loops over collections, repeated linear scans, unnecessary sorting
|
|
15
|
+
4. **Evaluate memory usage** -- large object allocations, unbounded caches, retained references, memory leaks
|
|
16
|
+
5. **Review database patterns** -- missing indexes, full table scans, unoptimized joins, excessive round trips
|
|
17
|
+
6. **Check caching** -- missing cache layers, cache invalidation issues, redundant computations
|
|
18
|
+
7. **Assess bundle/payload size** -- unnecessary imports, large dependencies, uncompressed responses
|
|
19
|
+
8. **Review rendering performance** -- unnecessary re-renders, missing memoization, layout thrashing (frontend)
|
|
20
|
+
|
|
21
|
+
## Output Format
|
|
22
|
+
|
|
23
|
+
Structure findings as:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
## Performance Analysis
|
|
27
|
+
|
|
28
|
+
### Critical Issues
|
|
29
|
+
Issues that will cause noticeable degradation at scale.
|
|
30
|
+
|
|
31
|
+
- [issue] -- where in the code, why it matters, estimated impact
|
|
32
|
+
|
|
33
|
+
### N+1 Query Detection
|
|
34
|
+
| Location | Pattern | Fix |
|
|
35
|
+
|----------|---------|-----|
|
|
36
|
+
| file:line | Description of the N+1 | Eager load / batch / join |
|
|
37
|
+
|
|
38
|
+
### Algorithmic Complexity
|
|
39
|
+
| Location | Current | Suggested | Why |
|
|
40
|
+
|----------|---------|-----------|-----|
|
|
41
|
+
| file:line | O(n^2) | O(n) | Description |
|
|
42
|
+
|
|
43
|
+
### Database Concerns
|
|
44
|
+
- Missing indexes, unoptimized queries, excessive round trips
|
|
45
|
+
|
|
46
|
+
### Memory Concerns
|
|
47
|
+
- Unbounded growth, large allocations, retained references
|
|
48
|
+
|
|
49
|
+
### Caching Opportunities
|
|
50
|
+
- Computations or queries that could benefit from caching
|
|
51
|
+
|
|
52
|
+
### Recommendations
|
|
53
|
+
- [recommendation] -- priority (critical/warning/suggestion), estimated impact
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Common Patterns to Flag
|
|
57
|
+
|
|
58
|
+
### N+1 Queries
|
|
59
|
+
```typescript
|
|
60
|
+
// Bad: N+1 -- one query per user inside loop
|
|
61
|
+
const users = await userRepo.find();
|
|
62
|
+
const profiles = await Promise.all(users.map(u => profileRepo.findOne({ userId: u.id })));
|
|
63
|
+
|
|
64
|
+
// Good: Single query with join or batch
|
|
65
|
+
const users = await userRepo.find({ relations: ["profile"] });
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Unnecessary Re-computation
|
|
69
|
+
```typescript
|
|
70
|
+
// Bad: Recomputes on every call
|
|
71
|
+
const getExpensiveResult = () => heavyComputation(data);
|
|
72
|
+
|
|
73
|
+
// Good: Compute once, reuse
|
|
74
|
+
const expensiveResult = heavyComputation(data);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Unbounded Collection Growth
|
|
78
|
+
```typescript
|
|
79
|
+
// Bad: Cache grows without limit
|
|
80
|
+
const cache = new Map();
|
|
81
|
+
const get = (key) => { if (!cache.has(key)) cache.set(key, compute(key)); return cache.get(key); };
|
|
82
|
+
|
|
83
|
+
// Good: LRU or bounded cache
|
|
84
|
+
const cache = new LRUCache({ max: 1000 });
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Rules
|
|
88
|
+
|
|
89
|
+
- Focus on the specific changes proposed, not a full performance audit of the entire codebase
|
|
90
|
+
- Flag only real performance risks -- do not micro-optimize code that runs once at startup
|
|
91
|
+
- Quantify impact where possible (O(n) vs O(n^2), number of database round trips, estimated payload size)
|
|
92
|
+
- Distinguish between critical issues (will degrade at scale) and suggestions (marginal improvement)
|
|
93
|
+
- If the changes have no performance implications, report "No performance concerns" and explain why
|
|
94
|
+
- Always consider the data scale -- an O(n^2) over 5 items is fine, over 10,000 is not
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan-improve-tests
|
|
3
|
+
description: This skill should be used when improving test quality. It scans the test suite for weak, brittle, or poorly-written tests, generates a brief with improvement opportunities, and creates a plan with tasks to strengthen the tests.
|
|
4
|
+
allowed-tools: ["Read", "Bash", "Glob", "Grep"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Improve Test Quality
|
|
8
|
+
|
|
9
|
+
Target: $ARGUMENTS
|
|
10
|
+
|
|
11
|
+
If no argument provided, scan the full test suite.
|
|
12
|
+
|
|
13
|
+
## Step 1: Gather Requirements
|
|
14
|
+
|
|
15
|
+
1. **Run test suite** to establish baseline:
|
|
16
|
+
```bash
|
|
17
|
+
bun run test 2>&1 | tail -20
|
|
18
|
+
```
|
|
19
|
+
2. **Scan test files** for quality issues:
|
|
20
|
+
- Weak assertions (`toBeTruthy`, `toBeDefined` instead of specific values)
|
|
21
|
+
- Missing edge cases (no boundary values, no error paths)
|
|
22
|
+
- Implementation coupling (testing internals rather than behavior)
|
|
23
|
+
- Missing error path coverage
|
|
24
|
+
- Duplicated setup that could indicate missing abstractions
|
|
25
|
+
3. **Identify 10-20 test files** with highest improvement potential, noting:
|
|
26
|
+
- File path
|
|
27
|
+
- Issues found (weak assertions, missing edge cases, etc.)
|
|
28
|
+
- Estimated impact of improvement
|
|
29
|
+
|
|
30
|
+
## Step 2: Compile Brief and Delegate
|
|
31
|
+
|
|
32
|
+
Compile the gathered information into a structured brief:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
Improve test quality across the test suite.
|
|
36
|
+
|
|
37
|
+
Test files needing improvement (ordered by impact):
|
|
38
|
+
1. [test file] - [issues found]
|
|
39
|
+
- Weak assertions: [count]
|
|
40
|
+
- Missing edge cases: [description]
|
|
41
|
+
- Implementation coupling: [description]
|
|
42
|
+
2. ...
|
|
43
|
+
|
|
44
|
+
Verification: `bun run test` -> Expected: All tests pass, improved assertions and coverage
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Invoke `/plan-execute` with this brief to create the implementation plan.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quality-review
|
|
3
|
+
description: "Code quality review checklist. Correctness, coding philosophy compliance, test coverage, documentation quality. Findings ranked by severity in plain English."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Quality Review
|
|
7
|
+
|
|
8
|
+
Review code quality for changed files. Explain all findings in plain English as if speaking to someone with no programming background.
|
|
9
|
+
|
|
10
|
+
## Review Checklist
|
|
11
|
+
|
|
12
|
+
For each changed file, evaluate:
|
|
13
|
+
|
|
14
|
+
1. **Correctness** -- Does the code do what the task says? Logic errors, off-by-one mistakes, missing edge cases?
|
|
15
|
+
2. **Coding philosophy** -- Immutability patterns (no `let`, no mutations, functional transformations)? Correct function structure (variables, side effects, return)?
|
|
16
|
+
3. **Test coverage** -- Tests present? Testing behavior, not implementation details? Edge cases covered?
|
|
17
|
+
4. **Documentation** -- JSDoc on new functions explaining "why"? Preambles on new files?
|
|
18
|
+
5. **Code clarity** -- Readable variable names? Unnecessary complexity? Could a new team member understand this?
|
|
19
|
+
|
|
20
|
+
## Output Format
|
|
21
|
+
|
|
22
|
+
Rank findings by severity:
|
|
23
|
+
|
|
24
|
+
### Critical (must fix before merge)
|
|
25
|
+
Broken logic or violates hard project rules.
|
|
26
|
+
|
|
27
|
+
### Warning (should fix)
|
|
28
|
+
Could cause problems later or reduce maintainability.
|
|
29
|
+
|
|
30
|
+
### Suggestion (nice to have)
|
|
31
|
+
Minor improvements, not blocking.
|
|
32
|
+
|
|
33
|
+
## Finding Format
|
|
34
|
+
|
|
35
|
+
For each finding:
|
|
36
|
+
|
|
37
|
+
- **What** -- Plain English description, no jargon
|
|
38
|
+
- **Why** -- What could go wrong? Concrete examples
|
|
39
|
+
- **Where** -- File path and line number
|
|
40
|
+
- **Fix** -- Specific, actionable suggestion
|
|
41
|
+
|
|
42
|
+
### Example
|
|
43
|
+
|
|
44
|
+
> **What:** The function changes the original list instead of creating a new one.
|
|
45
|
+
> **Why:** Other code using that list could see unexpected changes, causing hard-to-track bugs.
|
|
46
|
+
> **Where:** `src/utils/transform.ts:42`
|
|
47
|
+
> **Fix:** Use `[...items].sort()` instead of `items.sort()` to create a copy first.
|
|
48
|
+
|
|
49
|
+
## Rules
|
|
50
|
+
|
|
51
|
+
- Run `bun run test` to confirm tests pass
|
|
52
|
+
- Run the task's proof command to confirm the implementation works
|
|
53
|
+
- Never approve code with failing tests
|
|
54
|
+
- If no issues found, say so clearly -- do not invent problems
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reproduce-bug
|
|
3
|
+
description: "How to create reliable bug reproduction scenarios. Covers failing tests, minimal scripts, environment verification, and reproduction evidence capture."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Reproduce Bug
|
|
7
|
+
|
|
8
|
+
Before investigating root cause, reproduce the issue empirically. A bug that cannot be reproduced cannot be verified as fixed.
|
|
9
|
+
|
|
10
|
+
## Reproduction Process
|
|
11
|
+
|
|
12
|
+
### 1. Run the Failing Scenario
|
|
13
|
+
|
|
14
|
+
- Execute the exact command, test, or request that triggers the bug
|
|
15
|
+
- Capture the complete error output, stack trace, or unexpected behavior
|
|
16
|
+
- Record the exact command used so it can be repeated
|
|
17
|
+
|
|
18
|
+
### 2. Capture Evidence
|
|
19
|
+
|
|
20
|
+
- Save the full error output (not just a summary)
|
|
21
|
+
- Note the timestamp and environment details (OS, runtime version, dependency versions)
|
|
22
|
+
- Screenshot or log any visual/UI issues
|
|
23
|
+
- Record the actual behavior vs. the expected behavior
|
|
24
|
+
|
|
25
|
+
### 3. Investigate Environment Differences (If Cannot Reproduce)
|
|
26
|
+
|
|
27
|
+
If the issue does not reproduce locally:
|
|
28
|
+
|
|
29
|
+
- Compare environment configurations (env vars, config files, feature flags)
|
|
30
|
+
- Check runtime versions (Node.js, Python, Java, etc.)
|
|
31
|
+
- Compare dependency versions (`package-lock.json`, `poetry.lock`, etc.)
|
|
32
|
+
- Check data differences (database state, seed data, user roles)
|
|
33
|
+
- Verify network conditions (DNS, proxies, firewalls, VPN)
|
|
34
|
+
- Check for platform-specific behavior (OS, architecture, container vs. host)
|
|
35
|
+
|
|
36
|
+
### 4. Create a Minimal Reproduction
|
|
37
|
+
|
|
38
|
+
Create the smallest possible reproduction that triggers the bug:
|
|
39
|
+
|
|
40
|
+
**Preferred: Failing test**
|
|
41
|
+
- Write a test that exercises the exact code path and asserts the expected behavior
|
|
42
|
+
- The test should fail with the same symptom as the reported bug
|
|
43
|
+
- A failing test is the most reliable reproduction because it runs in CI and prevents regression
|
|
44
|
+
|
|
45
|
+
**Fallback: Reproduction script**
|
|
46
|
+
- Write a standalone script that triggers the issue
|
|
47
|
+
- Minimize dependencies -- remove anything not needed to reproduce
|
|
48
|
+
- Include setup steps (data seeding, config) in the script itself
|
|
49
|
+
- The script should be runnable by anyone with access to the repo
|
|
50
|
+
|
|
51
|
+
**Last resort: Manual steps**
|
|
52
|
+
- Document exact click-by-click or command-by-command steps
|
|
53
|
+
- Include prerequisite state (logged-in user, specific data, feature flags)
|
|
54
|
+
- Note any timing-sensitive aspects (race conditions, timeouts)
|
|
55
|
+
|
|
56
|
+
### 5. Verify Reproduction Is Reliable
|
|
57
|
+
|
|
58
|
+
- Run the reproduction multiple times to confirm it consistently fails
|
|
59
|
+
- For intermittent bugs, run enough iterations to establish the failure rate
|
|
60
|
+
- If intermittent, note any patterns (timing, load, specific data)
|
|
61
|
+
|
|
62
|
+
## Output Format
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
## Reproduction
|
|
66
|
+
|
|
67
|
+
### Command/Steps
|
|
68
|
+
The exact command or steps to trigger the bug.
|
|
69
|
+
|
|
70
|
+
### Actual Behavior
|
|
71
|
+
What happens (error message, wrong output, crash).
|
|
72
|
+
|
|
73
|
+
### Expected Behavior
|
|
74
|
+
What should happen instead.
|
|
75
|
+
|
|
76
|
+
### Environment
|
|
77
|
+
- Runtime: [version]
|
|
78
|
+
- OS: [platform]
|
|
79
|
+
- Dependencies: [relevant versions]
|
|
80
|
+
|
|
81
|
+
### Reproduction Type
|
|
82
|
+
[ ] Failing test: [path to test file]
|
|
83
|
+
[ ] Script: [path to script]
|
|
84
|
+
[ ] Manual steps: [documented above]
|
|
85
|
+
|
|
86
|
+
### Reliability
|
|
87
|
+
[Always / Intermittent (N/M runs) / Conditional (only when X)]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Rules
|
|
91
|
+
|
|
92
|
+
- Never skip reproduction. If you cannot reproduce, report what you tried and what you observed.
|
|
93
|
+
- A failing test is always the preferred reproduction method.
|
|
94
|
+
- Capture complete error output -- do not truncate or summarize.
|
|
95
|
+
- If the bug is environment-specific, document exactly which environment triggers it.
|
|
96
|
+
- Do not begin root cause analysis until you have a reliable reproduction.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: root-cause-analysis
|
|
3
|
+
description: "Root cause analysis methodology. Evidence gathering from logs, execution path tracing, strategic log placement, and building irrefutable proof chains."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Root Cause Analysis
|
|
7
|
+
|
|
8
|
+
Definitively prove what is causing a problem. Do not guess. Do not theorize without evidence. Trace the actual execution path, read real logs, and produce irrefutable proof of root cause.
|
|
9
|
+
|
|
10
|
+
**Core principle: "Show me the proof."** Every conclusion must be backed by concrete evidence -- a log line, a stack trace, a reproducible sequence, or a failing test.
|
|
11
|
+
|
|
12
|
+
## Phase 1: Gather Evidence from Logs
|
|
13
|
+
|
|
14
|
+
### Local Logs
|
|
15
|
+
|
|
16
|
+
- Search application logs in the project directory (`logs/`, `tmp/`, stdout/stderr output)
|
|
17
|
+
- Run tests with verbose logging enabled to capture execution flow
|
|
18
|
+
- Check framework-specific log locations (e.g., `.next/`, `dist/`, build output)
|
|
19
|
+
|
|
20
|
+
### Remote Logs (AWS CloudWatch, etc.)
|
|
21
|
+
|
|
22
|
+
- Discover existing scripts and tools in the project for tailing logs:
|
|
23
|
+
- Check `package.json` scripts for log-related commands
|
|
24
|
+
- Search for shell scripts: `scripts/*log*`, `scripts/*tail*`, `scripts/*watch*`
|
|
25
|
+
- Look for AWS CLI wrappers, CloudWatch log group configurations
|
|
26
|
+
- Check for `.env` files referencing log groups or log streams
|
|
27
|
+
- Use discovered tools first before falling back to raw CLI commands
|
|
28
|
+
- When using AWS CLI directly:
|
|
29
|
+
```bash
|
|
30
|
+
# Discover available log groups
|
|
31
|
+
aws logs describe-log-groups --query 'logGroups[].logGroupName' --output text
|
|
32
|
+
|
|
33
|
+
# Tail recent logs with filter
|
|
34
|
+
aws logs filter-log-events \
|
|
35
|
+
--log-group-name "/aws/lambda/function-name" \
|
|
36
|
+
--start-time $(date -d '30 minutes ago' +%s000) \
|
|
37
|
+
--filter-pattern "ERROR" \
|
|
38
|
+
--query 'events[].message' --output text
|
|
39
|
+
|
|
40
|
+
# Follow live logs
|
|
41
|
+
aws logs tail "/aws/lambda/function-name" --follow --since 10m
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Phase 2: Trace the Execution Path
|
|
45
|
+
|
|
46
|
+
- Start from the error and work backward through the call stack
|
|
47
|
+
- Read every function in the chain -- do not skip intermediate code
|
|
48
|
+
- Identify the exact line where behavior diverges from expectation
|
|
49
|
+
- Map the data flow: what value was expected vs. what value was actually present
|
|
50
|
+
|
|
51
|
+
## Phase 3: Strategic Log Placement
|
|
52
|
+
|
|
53
|
+
When existing logs are insufficient, add targeted log statements to prove or disprove hypotheses.
|
|
54
|
+
|
|
55
|
+
### Log Statement Guidelines
|
|
56
|
+
|
|
57
|
+
- **Be surgical** -- add the minimum number of log statements needed to confirm the root cause
|
|
58
|
+
- **Include context** -- log the actual values, not just "reached here"
|
|
59
|
+
- **Use structured format** -- make logs easy to find and parse
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// Bad: Vague, unhelpful
|
|
63
|
+
console.log("here");
|
|
64
|
+
console.log("data:", data);
|
|
65
|
+
|
|
66
|
+
// Good: Precise, searchable, includes context
|
|
67
|
+
console.log("[DEBUG:issue-123] processOrder entry", {
|
|
68
|
+
orderId: order.id,
|
|
69
|
+
status: order.status,
|
|
70
|
+
itemCount: order.items.length,
|
|
71
|
+
timestamp: new Date().toISOString(),
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Placement Strategy
|
|
76
|
+
|
|
77
|
+
| Placement | Purpose |
|
|
78
|
+
|-----------|---------|
|
|
79
|
+
| Function entry | Confirm the function is called and with what arguments |
|
|
80
|
+
| Before conditional branches | Verify which branch is taken and why |
|
|
81
|
+
| Before/after async operations | Detect timing issues, race conditions, failed awaits |
|
|
82
|
+
| Before/after data transformations | Catch where data becomes corrupted or unexpected |
|
|
83
|
+
| Error handlers and catch blocks | Ensure errors are not silently swallowed |
|
|
84
|
+
|
|
85
|
+
### Hypothesis Elimination
|
|
86
|
+
|
|
87
|
+
When multiple hypotheses exist, design a log placement strategy that eliminates all but one. Each log statement should be placed to confirm or rule out a specific hypothesis.
|
|
88
|
+
|
|
89
|
+
## Phase 4: Prove the Root Cause
|
|
90
|
+
|
|
91
|
+
Build an evidence chain that is irrefutable:
|
|
92
|
+
|
|
93
|
+
1. **The symptom** -- what the user observes (error message, wrong output, crash)
|
|
94
|
+
2. **The proximate cause** -- the line of code that directly produces the symptom
|
|
95
|
+
3. **The root cause** -- the underlying reason the proximate cause occurs
|
|
96
|
+
4. **The proof** -- log output, test result, or reproduction steps that confirm each link
|
|
97
|
+
|
|
98
|
+
### Evidence Chain Format
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
Symptom: [exact error message or behavior]
|
|
102
|
+
|
|
|
103
|
+
v
|
|
104
|
+
Proximate cause: [file:line] -- [the line that directly produces the error]
|
|
105
|
+
|
|
|
106
|
+
v
|
|
107
|
+
Root cause: [file:line] -- [the underlying reason]
|
|
108
|
+
|
|
|
109
|
+
v
|
|
110
|
+
Proof: [log output / test result / reproduction that confirms the chain]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Phase 5: Clean Up
|
|
114
|
+
|
|
115
|
+
After root cause is confirmed, **remove all debug log statements** added during investigation. Leave only:
|
|
116
|
+
|
|
117
|
+
- Log statements that belong in the application permanently (error logging, audit trails)
|
|
118
|
+
- Statements explicitly requested by the user
|
|
119
|
+
|
|
120
|
+
Verify cleanup:
|
|
121
|
+
```bash
|
|
122
|
+
# Search for any remaining debug markers
|
|
123
|
+
grep -rn "\[DEBUG:" src/ --include="*.ts" --include="*.tsx" --include="*.js"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Output Format
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
## Root Cause Analysis
|
|
130
|
+
|
|
131
|
+
### Evidence Trail
|
|
132
|
+
| Step | Location | Evidence | Conclusion |
|
|
133
|
+
|------|----------|----------|------------|
|
|
134
|
+
| 1 | file:line | Log output or observed value | What this proves |
|
|
135
|
+
| 2 | file:line | Log output or observed value | What this proves |
|
|
136
|
+
|
|
137
|
+
### Root Cause
|
|
138
|
+
**Proximate cause:** The line that directly produces the error.
|
|
139
|
+
**Root cause:** The underlying reason this line behaves incorrectly.
|
|
140
|
+
**Proof:** The specific evidence that confirms this beyond doubt.
|
|
141
|
+
|
|
142
|
+
### Recommended Fix
|
|
143
|
+
What needs to change and why. Include file:line references.
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Rules
|
|
147
|
+
|
|
148
|
+
- Never guess at root cause -- prove it with evidence
|
|
149
|
+
- Read the actual code in the execution path -- do not rely on function names or comments to infer behavior
|
|
150
|
+
- When adding debug logs, use a consistent prefix (e.g., `[DEBUG:issue-name]`) so they are easy to find and clean up
|
|
151
|
+
- Remove all temporary debug log statements after investigation is complete
|
|
152
|
+
- If remote log access is unavailable, report what logs would be needed and from where
|
|
153
|
+
- Prefer project-specific tooling and scripts over raw CLI commands for log access
|
|
154
|
+
- If the root cause is in a third-party dependency, identify the exact version and known issue
|
|
155
|
+
- Always verify the fix resolves the issue -- do not mark investigation complete without proof
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-review
|
|
3
|
+
description: "Security review methodology. STRIDE threat modeling, OWASP Top 10 vulnerability checks, auth/validation/secrets handling review, and mitigation recommendations."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Security Review
|
|
7
|
+
|
|
8
|
+
Identify vulnerabilities, evaluate threats, and recommend mitigations for code changes.
|
|
9
|
+
|
|
10
|
+
## Analysis Process
|
|
11
|
+
|
|
12
|
+
1. **Read affected files** -- understand current security posture of the code being changed
|
|
13
|
+
2. **STRIDE analysis** -- evaluate Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege risks
|
|
14
|
+
3. **Check input validation** -- are user inputs sanitized at system boundaries?
|
|
15
|
+
4. **Check secrets handling** -- are credentials, tokens, or API keys exposed in code, logs, or error messages?
|
|
16
|
+
5. **Check auth/authz** -- are access controls properly enforced for new endpoints or features?
|
|
17
|
+
6. **Review dependencies** -- do new dependencies introduce known vulnerabilities?
|
|
18
|
+
|
|
19
|
+
## Output Format
|
|
20
|
+
|
|
21
|
+
Structure findings as:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
## Security Analysis
|
|
25
|
+
|
|
26
|
+
### Threat Model (STRIDE)
|
|
27
|
+
| Threat | Applies? | Description | Mitigation |
|
|
28
|
+
|--------|----------|-------------|------------|
|
|
29
|
+
| Spoofing | Yes/No | ... | ... |
|
|
30
|
+
| Tampering | Yes/No | ... | ... |
|
|
31
|
+
| Repudiation | Yes/No | ... | ... |
|
|
32
|
+
| Info Disclosure | Yes/No | ... | ... |
|
|
33
|
+
| Denial of Service | Yes/No | ... | ... |
|
|
34
|
+
| Elevation of Privilege | Yes/No | ... | ... |
|
|
35
|
+
|
|
36
|
+
### Security Checklist
|
|
37
|
+
- [ ] Input validation at system boundaries
|
|
38
|
+
- [ ] No secrets in code or logs
|
|
39
|
+
- [ ] Auth/authz enforced on new endpoints
|
|
40
|
+
- [ ] No SQL/NoSQL injection vectors
|
|
41
|
+
- [ ] No XSS vectors in user-facing output
|
|
42
|
+
- [ ] Dependencies free of known CVEs
|
|
43
|
+
|
|
44
|
+
### Vulnerabilities Found
|
|
45
|
+
- [vulnerability] -- where in the code, how to prevent
|
|
46
|
+
|
|
47
|
+
### Recommendations
|
|
48
|
+
- [recommendation] -- priority (critical/warning/suggestion)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
- Focus on the specific changes proposed, not a full security audit of the entire codebase
|
|
54
|
+
- Flag only real risks -- do not invent hypothetical threats for internal tooling with no user input
|
|
55
|
+
- Prioritize OWASP Top 10 vulnerabilities
|
|
56
|
+
- If the changes are purely internal (config, refactoring, docs), report "No security concerns" and explain why
|
|
57
|
+
- Always check `.gitleaksignore` patterns to understand what secrets scanning is already in place
|