liteagents 2.4.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/CHANGELOG.md +441 -0
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/cli.js +230 -0
- package/docs/.gitkeep +1 -0
- package/docs/CONTRIBUTING.md +739 -0
- package/docs/DUAL_PUBLISH_SUMMARY.md +177 -0
- package/docs/ERROR_HANDLING_IMPLEMENTATION.md +327 -0
- package/docs/GITHUB_PACKAGES.md +181 -0
- package/docs/GITHUB_SETUP.md +158 -0
- package/docs/INSTALLATION_DEMO.md +691 -0
- package/docs/INSTALLATION_LOCATIONS.md +299 -0
- package/docs/INSTALLER_GUIDE.md +1586 -0
- package/docs/INTEGRATION_ISSUES_9.1.md +341 -0
- package/docs/KNOWLEDGE_BASE.md +727 -0
- package/docs/MIGRATION.md +384 -0
- package/docs/PACKAGE_BASELINE.md +557 -0
- package/docs/PACKAGE_VALIDATION_REPORT.md +427 -0
- package/docs/PASS_INTEGRATION.md +307 -0
- package/docs/PASS_QUICK_START.md +150 -0
- package/docs/PRIVACY.md +203 -0
- package/docs/PUBLISHING.md +494 -0
- package/docs/QUICK-START.md +318 -0
- package/docs/RELEASE_NOTES_1.2.0.md +323 -0
- package/docs/SECURITY.md +317 -0
- package/docs/SILENT_MODE_GUIDE.md +526 -0
- package/docs/SKILLS_CONVERSION.md +154 -0
- package/docs/TESTING.md +582 -0
- package/docs/TEST_COVERAGE.md +347 -0
- package/docs/TROUBLESHOOTING.md +788 -0
- package/docs/UPDATED_VARIANT_CONFIGURATION.md +274 -0
- package/docs/VARIANT_CONFIGURATION.md +440 -0
- package/installer/cli.js +761 -0
- package/installer/installation-engine.js +1536 -0
- package/installer/package-manager.js +640 -0
- package/installer/path-manager.js +427 -0
- package/installer/report-template.js +298 -0
- package/installer/verification-system.js +274 -0
- package/package.json +83 -0
- package/packages/ampcode/AGENT.md +58 -0
- package/packages/ampcode/README.md +17 -0
- package/packages/ampcode/agents/1-create-prd.md +175 -0
- package/packages/ampcode/agents/2-generate-tasks.md +190 -0
- package/packages/ampcode/agents/3-process-task-list.md +225 -0
- package/packages/ampcode/agents/code-developer.md +198 -0
- package/packages/ampcode/agents/context-builder.md +142 -0
- package/packages/ampcode/agents/feature-planner.md +199 -0
- package/packages/ampcode/agents/market-researcher.md +89 -0
- package/packages/ampcode/agents/orchestrator.md +116 -0
- package/packages/ampcode/agents/quality-assurance.md +115 -0
- package/packages/ampcode/agents/system-architect.md +135 -0
- package/packages/ampcode/agents/ui-designer.md +184 -0
- package/packages/ampcode/commands/brainstorming.md +56 -0
- package/packages/ampcode/commands/code-review.md +107 -0
- package/packages/ampcode/commands/condition-based-waiting/example.ts +158 -0
- package/packages/ampcode/commands/condition-based-waiting.md +122 -0
- package/packages/ampcode/commands/debug.md +20 -0
- package/packages/ampcode/commands/docs-builder/templates.md +572 -0
- package/packages/ampcode/commands/docs-builder.md +106 -0
- package/packages/ampcode/commands/explain.md +18 -0
- package/packages/ampcode/commands/git-commit.md +14 -0
- package/packages/ampcode/commands/optimize.md +20 -0
- package/packages/ampcode/commands/refactor.md +21 -0
- package/packages/ampcode/commands/review.md +18 -0
- package/packages/ampcode/commands/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/ampcode/commands/root-cause-tracing.md +176 -0
- package/packages/ampcode/commands/security.md +21 -0
- package/packages/ampcode/commands/ship.md +18 -0
- package/packages/ampcode/commands/skill-creator/scripts/init_skill.py +303 -0
- package/packages/ampcode/commands/skill-creator/scripts/package_skill.py +110 -0
- package/packages/ampcode/commands/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/ampcode/commands/skill-creator.md +211 -0
- package/packages/ampcode/commands/stash.md +45 -0
- package/packages/ampcode/commands/systematic-debugging.md +297 -0
- package/packages/ampcode/commands/test-driven-development.md +390 -0
- package/packages/ampcode/commands/test-generate.md +18 -0
- package/packages/ampcode/commands/testing-anti-patterns.md +304 -0
- package/packages/ampcode/commands/verification-before-completion.md +152 -0
- package/packages/ampcode/settings.json +13 -0
- package/packages/ampcode/variants.json +8 -0
- package/packages/claude/CLAUDE.md +58 -0
- package/packages/claude/README.md +23 -0
- package/packages/claude/agents/1-create-prd.md +175 -0
- package/packages/claude/agents/2-generate-tasks.md +190 -0
- package/packages/claude/agents/3-process-task-list.md +225 -0
- package/packages/claude/agents/code-developer.md +198 -0
- package/packages/claude/agents/context-builder.md +142 -0
- package/packages/claude/agents/feature-planner.md +199 -0
- package/packages/claude/agents/market-researcher.md +89 -0
- package/packages/claude/agents/orchestrator.md +117 -0
- package/packages/claude/agents/quality-assurance.md +115 -0
- package/packages/claude/agents/system-architect.md +135 -0
- package/packages/claude/agents/ui-designer.md +184 -0
- package/packages/claude/commands/debug.md +20 -0
- package/packages/claude/commands/explain.md +18 -0
- package/packages/claude/commands/git-commit.md +14 -0
- package/packages/claude/commands/optimize.md +20 -0
- package/packages/claude/commands/refactor.md +21 -0
- package/packages/claude/commands/review.md +18 -0
- package/packages/claude/commands/security.md +21 -0
- package/packages/claude/commands/ship.md +18 -0
- package/packages/claude/commands/stash.md +45 -0
- package/packages/claude/commands/test-generate.md +18 -0
- package/packages/claude/skills/brainstorming/SKILL.md +56 -0
- package/packages/claude/skills/code-review/SKILL.md +107 -0
- package/packages/claude/skills/code-review/code-reviewer.md +146 -0
- package/packages/claude/skills/condition-based-waiting/SKILL.md +122 -0
- package/packages/claude/skills/condition-based-waiting/example.ts +158 -0
- package/packages/claude/skills/docs-builder/SKILL.md +106 -0
- package/packages/claude/skills/docs-builder/references/templates.md +572 -0
- package/packages/claude/skills/root-cause-tracing/SKILL.md +176 -0
- package/packages/claude/skills/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/claude/skills/skill-creator/LICENSE.txt +202 -0
- package/packages/claude/skills/skill-creator/SKILL.md +211 -0
- package/packages/claude/skills/skill-creator/scripts/init_skill.py +303 -0
- package/packages/claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/packages/claude/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/packages/claude/skills/systematic-debugging/SKILL.md +296 -0
- package/packages/claude/skills/systematic-debugging/test-academic.md +14 -0
- package/packages/claude/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/packages/claude/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/packages/claude/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/packages/claude/skills/test-driven-development/SKILL.md +392 -0
- package/packages/claude/skills/testing-anti-patterns/SKILL.md +304 -0
- package/packages/claude/skills/verification-before-completion/SKILL.md +152 -0
- package/packages/claude/variants.json +9 -0
- package/packages/droid/AGENTS.md +52 -0
- package/packages/droid/README.md +17 -0
- package/packages/droid/change_settings.json +61 -0
- package/packages/droid/commands/brainstorming.md +56 -0
- package/packages/droid/commands/code-review.md +107 -0
- package/packages/droid/commands/condition-based-waiting/example.ts +158 -0
- package/packages/droid/commands/condition-based-waiting.md +122 -0
- package/packages/droid/commands/debug.md +20 -0
- package/packages/droid/commands/docs-builder/templates.md +572 -0
- package/packages/droid/commands/docs-builder.md +106 -0
- package/packages/droid/commands/explain.md +18 -0
- package/packages/droid/commands/git-commit.md +14 -0
- package/packages/droid/commands/optimize.md +20 -0
- package/packages/droid/commands/refactor.md +21 -0
- package/packages/droid/commands/review.md +18 -0
- package/packages/droid/commands/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/droid/commands/root-cause-tracing.md +176 -0
- package/packages/droid/commands/security.md +21 -0
- package/packages/droid/commands/ship.md +18 -0
- package/packages/droid/commands/skill-creator/scripts/init_skill.py +303 -0
- package/packages/droid/commands/skill-creator/scripts/package_skill.py +110 -0
- package/packages/droid/commands/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/droid/commands/skill-creator.md +211 -0
- package/packages/droid/commands/stash.md +45 -0
- package/packages/droid/commands/systematic-debugging.md +297 -0
- package/packages/droid/commands/test-driven-development.md +390 -0
- package/packages/droid/commands/test-generate.md +18 -0
- package/packages/droid/commands/testing-anti-patterns.md +304 -0
- package/packages/droid/commands/verification-before-completion.md +152 -0
- package/packages/droid/droids/1-create-prd.md +170 -0
- package/packages/droid/droids/2-generate-tasks.md +190 -0
- package/packages/droid/droids/3-process-task-list.md +225 -0
- package/packages/droid/droids/code-developer.md +198 -0
- package/packages/droid/droids/context-builder.md +142 -0
- package/packages/droid/droids/feature-planner.md +199 -0
- package/packages/droid/droids/market-researcher.md +89 -0
- package/packages/droid/droids/orchestrator.md +116 -0
- package/packages/droid/droids/quality-assurance.md +115 -0
- package/packages/droid/droids/system-architect.md +135 -0
- package/packages/droid/droids/ui-designer.md +184 -0
- package/packages/droid/variants.json +8 -0
- package/packages/opencode/AGENTS.md +52 -0
- package/packages/opencode/README.md +17 -0
- package/packages/opencode/agent/1-create-prd.md +179 -0
- package/packages/opencode/agent/2-generate-tasks.md +194 -0
- package/packages/opencode/agent/3-process-task-list.md +229 -0
- package/packages/opencode/agent/code-developer.md +202 -0
- package/packages/opencode/agent/context-builder.md +146 -0
- package/packages/opencode/agent/feature-planner.md +203 -0
- package/packages/opencode/agent/market-researcher.md +93 -0
- package/packages/opencode/agent/orchestrator.md +120 -0
- package/packages/opencode/agent/quality-assurance.md +119 -0
- package/packages/opencode/agent/system-architect.md +139 -0
- package/packages/opencode/agent/ui-designer.md +188 -0
- package/packages/opencode/command/brainstorming.md +56 -0
- package/packages/opencode/command/code-review.md +107 -0
- package/packages/opencode/command/condition-based-waiting/example.ts +158 -0
- package/packages/opencode/command/condition-based-waiting.md +122 -0
- package/packages/opencode/command/debug.md +20 -0
- package/packages/opencode/command/docs-builder/templates.md +572 -0
- package/packages/opencode/command/docs-builder.md +106 -0
- package/packages/opencode/command/explain.md +18 -0
- package/packages/opencode/command/git-commit.md +14 -0
- package/packages/opencode/command/optimize.md +20 -0
- package/packages/opencode/command/refactor.md +21 -0
- package/packages/opencode/command/review.md +18 -0
- package/packages/opencode/command/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/opencode/command/root-cause-tracing.md +176 -0
- package/packages/opencode/command/security.md +21 -0
- package/packages/opencode/command/ship.md +18 -0
- package/packages/opencode/command/skill-creator/scripts/init_skill.py +303 -0
- package/packages/opencode/command/skill-creator/scripts/package_skill.py +110 -0
- package/packages/opencode/command/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/opencode/command/skill-creator.md +211 -0
- package/packages/opencode/command/stash.md +45 -0
- package/packages/opencode/command/systematic-debugging.md +297 -0
- package/packages/opencode/command/test-driven-development.md +390 -0
- package/packages/opencode/command/test-generate.md +18 -0
- package/packages/opencode/command/testing-anti-patterns.md +304 -0
- package/packages/opencode/command/verification-before-completion.md +152 -0
- package/packages/opencode/opencode.jsonc +201 -0
- package/packages/opencode/variants.json +8 -0
- package/packages/subagentic-manual.md +349 -0
- package/postinstall.js +21 -0
- package/tools/ampcode/manifest-template.json +14 -0
- package/tools/claude/manifest-template.json +14 -0
- package/tools/droid/manifest-template.json +14 -0
- package/tools/opencode/manifest-template.json +14 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: optimize
|
|
3
|
+
description: Optimize performance [target]
|
|
4
|
+
usage: /optimize <target-area>
|
|
5
|
+
argument-hint: [file-or-function]
|
|
6
|
+
---
|
|
7
|
+
Analyze $ARGUMENTS for performance.
|
|
8
|
+
|
|
9
|
+
## Examine
|
|
10
|
+
- Time complexity (Big O)
|
|
11
|
+
- Space complexity
|
|
12
|
+
- I/O operations
|
|
13
|
+
- Database queries (N+1?)
|
|
14
|
+
- Unnecessary allocations
|
|
15
|
+
|
|
16
|
+
## Output
|
|
17
|
+
- Current bottlenecks
|
|
18
|
+
- Specific optimizations
|
|
19
|
+
- Expected improvement
|
|
20
|
+
- Trade-offs involved
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refactor
|
|
3
|
+
description: Refactor [code]
|
|
4
|
+
usage: /refactor <code-section>
|
|
5
|
+
argument-hint: [file-or-function]
|
|
6
|
+
---
|
|
7
|
+
Refactor $ARGUMENTS.
|
|
8
|
+
|
|
9
|
+
## Goals
|
|
10
|
+
- Reduce complexity
|
|
11
|
+
- Improve readability
|
|
12
|
+
- Apply DRY
|
|
13
|
+
- Better naming
|
|
14
|
+
- Smaller functions (single responsibility)
|
|
15
|
+
|
|
16
|
+
## Constraints
|
|
17
|
+
- NO behavior changes
|
|
18
|
+
- Keep public API intact
|
|
19
|
+
- Existing tests must pass
|
|
20
|
+
|
|
21
|
+
Explain each change.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review
|
|
3
|
+
description: Review code [file]
|
|
4
|
+
usage: /review
|
|
5
|
+
argument-hint: [file or leave empty for staged changes]
|
|
6
|
+
---
|
|
7
|
+
Review $ARGUMENTS (or staged changes if not specified).
|
|
8
|
+
|
|
9
|
+
## Check For
|
|
10
|
+
- Security: OWASP Top 10, auth issues, data exposure
|
|
11
|
+
- Performance: N+1 queries, memory leaks, blocking calls
|
|
12
|
+
- Correctness: Edge cases, error handling, type safety
|
|
13
|
+
- Maintainability: Complexity, naming, duplication
|
|
14
|
+
|
|
15
|
+
## Output Format
|
|
16
|
+
### 🚨 Critical (blocks merge)
|
|
17
|
+
### ⚠️ Warnings (should fix)
|
|
18
|
+
### 💡 Suggestions (nice to have)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Bisection script to find which test creates unwanted files/state
|
|
3
|
+
# Usage: ./find-polluter.sh <file_or_dir_to_check> <test_pattern>
|
|
4
|
+
# Example: ./find-polluter.sh '.git' 'src/**/*.test.ts'
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
if [ $# -ne 2 ]; then
|
|
9
|
+
echo "Usage: $0 <file_to_check> <test_pattern>"
|
|
10
|
+
echo "Example: $0 '.git' 'src/**/*.test.ts'"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
POLLUTION_CHECK="$1"
|
|
15
|
+
TEST_PATTERN="$2"
|
|
16
|
+
|
|
17
|
+
echo "🔍 Searching for test that creates: $POLLUTION_CHECK"
|
|
18
|
+
echo "Test pattern: $TEST_PATTERN"
|
|
19
|
+
echo ""
|
|
20
|
+
|
|
21
|
+
# Get list of test files
|
|
22
|
+
TEST_FILES=$(find . -path "$TEST_PATTERN" | sort)
|
|
23
|
+
TOTAL=$(echo "$TEST_FILES" | wc -l | tr -d ' ')
|
|
24
|
+
|
|
25
|
+
echo "Found $TOTAL test files"
|
|
26
|
+
echo ""
|
|
27
|
+
|
|
28
|
+
COUNT=0
|
|
29
|
+
for TEST_FILE in $TEST_FILES; do
|
|
30
|
+
COUNT=$((COUNT + 1))
|
|
31
|
+
|
|
32
|
+
# Skip if pollution already exists
|
|
33
|
+
if [ -e "$POLLUTION_CHECK" ]; then
|
|
34
|
+
echo "⚠️ Pollution already exists before test $COUNT/$TOTAL"
|
|
35
|
+
echo " Skipping: $TEST_FILE"
|
|
36
|
+
continue
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo "[$COUNT/$TOTAL] Testing: $TEST_FILE"
|
|
40
|
+
|
|
41
|
+
# Run the test
|
|
42
|
+
npm test "$TEST_FILE" > /dev/null 2>&1 || true
|
|
43
|
+
|
|
44
|
+
# Check if pollution appeared
|
|
45
|
+
if [ -e "$POLLUTION_CHECK" ]; then
|
|
46
|
+
echo ""
|
|
47
|
+
echo "🎯 FOUND POLLUTER!"
|
|
48
|
+
echo " Test: $TEST_FILE"
|
|
49
|
+
echo " Created: $POLLUTION_CHECK"
|
|
50
|
+
echo ""
|
|
51
|
+
echo "Pollution details:"
|
|
52
|
+
ls -la "$POLLUTION_CHECK"
|
|
53
|
+
echo ""
|
|
54
|
+
echo "To investigate:"
|
|
55
|
+
echo " npm test $TEST_FILE # Run just this test"
|
|
56
|
+
echo " cat $TEST_FILE # Review test code"
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
done
|
|
60
|
+
|
|
61
|
+
echo ""
|
|
62
|
+
echo "✅ No polluter found - all tests clean!"
|
|
63
|
+
exit 0
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: root-cause-tracing
|
|
3
|
+
description: Use when errors occur deep in execution and you need to trace back to find the original trigger - systematically traces bugs backward through call stack, adding instrumentation when needed, to identify source of invalid data or incorrect behavior
|
|
4
|
+
usage: /root-cause-tracing <issue-description>
|
|
5
|
+
auto_trigger: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Root Cause Tracing
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
|
|
13
|
+
|
|
14
|
+
**Core principle:** Trace backward through the call chain until you find the original trigger, then fix at the source.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
```dot
|
|
19
|
+
digraph when_to_use {
|
|
20
|
+
"Bug appears deep in stack?" [shape=diamond];
|
|
21
|
+
"Can trace backwards?" [shape=diamond];
|
|
22
|
+
"Fix at symptom point" [shape=box];
|
|
23
|
+
"Trace to original trigger" [shape=box];
|
|
24
|
+
"BETTER: Also add defense-in-depth" [shape=box];
|
|
25
|
+
|
|
26
|
+
"Bug appears deep in stack?" -> "Can trace backwards?" [label="yes"];
|
|
27
|
+
"Can trace backwards?" -> "Trace to original trigger" [label="yes"];
|
|
28
|
+
"Can trace backwards?" -> "Fix at symptom point" [label="no - dead end"];
|
|
29
|
+
"Trace to original trigger" -> "BETTER: Also add defense-in-depth";
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Use when:**
|
|
34
|
+
- Error happens deep in execution (not at entry point)
|
|
35
|
+
- Stack trace shows long call chain
|
|
36
|
+
- Unclear where invalid data originated
|
|
37
|
+
- Need to find which test/code triggers the problem
|
|
38
|
+
|
|
39
|
+
## The Tracing Process
|
|
40
|
+
|
|
41
|
+
### 1. Observe the Symptom
|
|
42
|
+
```
|
|
43
|
+
Error: git init failed in /Users/jesse/project/packages/core
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Find Immediate Cause
|
|
47
|
+
**What code directly causes this?**
|
|
48
|
+
```typescript
|
|
49
|
+
await execFileAsync('git', ['init'], { cwd: projectDir });
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 3. Ask: What Called This?
|
|
53
|
+
```typescript
|
|
54
|
+
WorktreeManager.createSessionWorktree(projectDir, sessionId)
|
|
55
|
+
→ called by Session.initializeWorkspace()
|
|
56
|
+
→ called by Session.create()
|
|
57
|
+
→ called by test at Project.create()
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 4. Keep Tracing Up
|
|
61
|
+
**What value was passed?**
|
|
62
|
+
- `projectDir = ''` (empty string!)
|
|
63
|
+
- Empty string as `cwd` resolves to `process.cwd()`
|
|
64
|
+
- That's the source code directory!
|
|
65
|
+
|
|
66
|
+
### 5. Find Original Trigger
|
|
67
|
+
**Where did empty string come from?**
|
|
68
|
+
```typescript
|
|
69
|
+
const context = setupCoreTest(); // Returns { tempDir: '' }
|
|
70
|
+
Project.create('name', context.tempDir); // Accessed before beforeEach!
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Adding Stack Traces
|
|
74
|
+
|
|
75
|
+
When you can't trace manually, add instrumentation:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// Before the problematic operation
|
|
79
|
+
async function gitInit(directory: string) {
|
|
80
|
+
const stack = new Error().stack;
|
|
81
|
+
console.error('DEBUG git init:', {
|
|
82
|
+
directory,
|
|
83
|
+
cwd: process.cwd(),
|
|
84
|
+
nodeEnv: process.env.NODE_ENV,
|
|
85
|
+
stack,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
await execFileAsync('git', ['init'], { cwd: directory });
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Critical:** Use `console.error()` in tests (not logger - may not show)
|
|
93
|
+
|
|
94
|
+
**Run and capture:**
|
|
95
|
+
```bash
|
|
96
|
+
npm test 2>&1 | grep 'DEBUG git init'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Analyze stack traces:**
|
|
100
|
+
- Look for test file names
|
|
101
|
+
- Find the line number triggering the call
|
|
102
|
+
- Identify the pattern (same test? same parameter?)
|
|
103
|
+
|
|
104
|
+
## Finding Which Test Causes Pollution
|
|
105
|
+
|
|
106
|
+
If something appears during tests but you don't know which test:
|
|
107
|
+
|
|
108
|
+
Use the bisection script: @find-polluter.sh
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
./find-polluter.sh '.git' 'src/**/*.test.ts'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Runs tests one-by-one, stops at first polluter. See script for usage.
|
|
115
|
+
|
|
116
|
+
## Real Example: Empty projectDir
|
|
117
|
+
|
|
118
|
+
**Symptom:** `.git` created in `packages/core/` (source code)
|
|
119
|
+
|
|
120
|
+
**Trace chain:**
|
|
121
|
+
1. `git init` runs in `process.cwd()` ← empty cwd parameter
|
|
122
|
+
2. WorktreeManager called with empty projectDir
|
|
123
|
+
3. Session.create() passed empty string
|
|
124
|
+
4. Test accessed `context.tempDir` before beforeEach
|
|
125
|
+
5. setupCoreTest() returns `{ tempDir: '' }` initially
|
|
126
|
+
|
|
127
|
+
**Root cause:** Top-level variable initialization accessing empty value
|
|
128
|
+
|
|
129
|
+
**Fix:** Made tempDir a getter that throws if accessed before beforeEach
|
|
130
|
+
|
|
131
|
+
**Also added defense-in-depth:**
|
|
132
|
+
- Layer 1: Project.create() validates directory
|
|
133
|
+
- Layer 2: WorkspaceManager validates not empty
|
|
134
|
+
- Layer 3: NODE_ENV guard refuses git init outside tmpdir
|
|
135
|
+
- Layer 4: Stack trace logging before git init
|
|
136
|
+
|
|
137
|
+
## Key Principle
|
|
138
|
+
|
|
139
|
+
```dot
|
|
140
|
+
digraph principle {
|
|
141
|
+
"Found immediate cause" [shape=ellipse];
|
|
142
|
+
"Can trace one level up?" [shape=diamond];
|
|
143
|
+
"Trace backwards" [shape=box];
|
|
144
|
+
"Is this the source?" [shape=diamond];
|
|
145
|
+
"Fix at source" [shape=box];
|
|
146
|
+
"Add validation at each layer" [shape=box];
|
|
147
|
+
"Bug impossible" [shape=doublecircle];
|
|
148
|
+
"NEVER fix just the symptom" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
|
|
149
|
+
|
|
150
|
+
"Found immediate cause" -> "Can trace one level up?";
|
|
151
|
+
"Can trace one level up?" -> "Trace backwards" [label="yes"];
|
|
152
|
+
"Can trace one level up?" -> "NEVER fix just the symptom" [label="no"];
|
|
153
|
+
"Trace backwards" -> "Is this the source?";
|
|
154
|
+
"Is this the source?" -> "Trace backwards" [label="no - keeps going"];
|
|
155
|
+
"Is this the source?" -> "Fix at source" [label="yes"];
|
|
156
|
+
"Fix at source" -> "Add validation at each layer";
|
|
157
|
+
"Add validation at each layer" -> "Bug impossible";
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**NEVER fix just where the error appears.** Trace back to find the original trigger.
|
|
162
|
+
|
|
163
|
+
## Stack Trace Tips
|
|
164
|
+
|
|
165
|
+
**In tests:** Use `console.error()` not logger - logger may be suppressed
|
|
166
|
+
**Before operation:** Log before the dangerous operation, not after it fails
|
|
167
|
+
**Include context:** Directory, cwd, environment variables, timestamps
|
|
168
|
+
**Capture stack:** `new Error().stack` shows complete call chain
|
|
169
|
+
|
|
170
|
+
## Real-World Impact
|
|
171
|
+
|
|
172
|
+
From debugging session (2025-10-03):
|
|
173
|
+
- Found root cause through 5-level trace
|
|
174
|
+
- Fixed at source (getter validation)
|
|
175
|
+
- Added 4 layers of defense
|
|
176
|
+
- 1847 tests passed, zero pollution
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security
|
|
3
|
+
description: Scan security [target]
|
|
4
|
+
usage: /security
|
|
5
|
+
argument-hint: [file, directory, or leave empty for full scan]
|
|
6
|
+
allowed-tools: Read, Grep, Glob
|
|
7
|
+
---
|
|
8
|
+
Audit $ARGUMENTS for security vulnerabilities.
|
|
9
|
+
|
|
10
|
+
## Check For
|
|
11
|
+
- Injection: SQL, command, XSS, template
|
|
12
|
+
- Auth: Weak passwords, session issues, CSRF
|
|
13
|
+
- Data: Exposure, logging secrets, insecure storage
|
|
14
|
+
- Config: Debug mode, default creds, missing headers
|
|
15
|
+
- Dependencies: Known CVEs
|
|
16
|
+
|
|
17
|
+
## Output
|
|
18
|
+
Severity-ranked findings with:
|
|
19
|
+
- Location (file:line)
|
|
20
|
+
- Risk explanation
|
|
21
|
+
- Remediation steps
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ship
|
|
3
|
+
description: Check pre-deployment
|
|
4
|
+
usage: /ship
|
|
5
|
+
allowed-tools: Bash(npm *), Bash(git *)
|
|
6
|
+
---
|
|
7
|
+
Pre-deploy checklist:
|
|
8
|
+
|
|
9
|
+
- [ ] Tests pass (`npm test`)
|
|
10
|
+
- [ ] Lint clean (`npm run lint`)
|
|
11
|
+
- [ ] Build succeeds (`npm run build`)
|
|
12
|
+
- [ ] No console.log/debugger statements
|
|
13
|
+
- [ ] Env vars documented
|
|
14
|
+
- [ ] No hardcoded secrets
|
|
15
|
+
- [ ] Error handling complete
|
|
16
|
+
- [ ] Migrations ready
|
|
17
|
+
|
|
18
|
+
Run checks and report: Ready 🚀 or Blocked 🛑 with issues.
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Skill Initializer - Creates a new skill from template
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
init_skill.py <skill-name> --path <path>
|
|
7
|
+
|
|
8
|
+
Examples:
|
|
9
|
+
init_skill.py my-new-skill --path skills/public
|
|
10
|
+
init_skill.py my-api-helper --path skills/private
|
|
11
|
+
init_skill.py custom-skill --path /custom/location
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
SKILL_TEMPLATE = """---
|
|
19
|
+
name: {skill_name}
|
|
20
|
+
description: [TODO: Complete and informative explanation of what the skill does and when to use it. Include WHEN to use this skill - specific scenarios, file types, or tasks that trigger it.]
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# {skill_title}
|
|
24
|
+
|
|
25
|
+
## Overview
|
|
26
|
+
|
|
27
|
+
[TODO: 1-2 sentences explaining what this skill enables]
|
|
28
|
+
|
|
29
|
+
## Structuring This Skill
|
|
30
|
+
|
|
31
|
+
[TODO: Choose the structure that best fits this skill's purpose. Common patterns:
|
|
32
|
+
|
|
33
|
+
**1. Workflow-Based** (best for sequential processes)
|
|
34
|
+
- Works well when there are clear step-by-step procedures
|
|
35
|
+
- Example: DOCX skill with "Workflow Decision Tree" → "Reading" → "Creating" → "Editing"
|
|
36
|
+
- Structure: ## Overview → ## Workflow Decision Tree → ## Step 1 → ## Step 2...
|
|
37
|
+
|
|
38
|
+
**2. Task-Based** (best for tool collections)
|
|
39
|
+
- Works well when the skill offers different operations/capabilities
|
|
40
|
+
- Example: PDF skill with "Quick Start" → "Merge PDFs" → "Split PDFs" → "Extract Text"
|
|
41
|
+
- Structure: ## Overview → ## Quick Start → ## Task Category 1 → ## Task Category 2...
|
|
42
|
+
|
|
43
|
+
**3. Reference/Guidelines** (best for standards or specifications)
|
|
44
|
+
- Works well for brand guidelines, coding standards, or requirements
|
|
45
|
+
- Example: Brand styling with "Brand Guidelines" → "Colors" → "Typography" → "Features"
|
|
46
|
+
- Structure: ## Overview → ## Guidelines → ## Specifications → ## Usage...
|
|
47
|
+
|
|
48
|
+
**4. Capabilities-Based** (best for integrated systems)
|
|
49
|
+
- Works well when the skill provides multiple interrelated features
|
|
50
|
+
- Example: Product Management with "Core Capabilities" → numbered capability list
|
|
51
|
+
- Structure: ## Overview → ## Core Capabilities → ### 1. Feature → ### 2. Feature...
|
|
52
|
+
|
|
53
|
+
Patterns can be mixed and matched as needed. Most skills combine patterns (e.g., start with task-based, add workflow for complex operations).
|
|
54
|
+
|
|
55
|
+
Delete this entire "Structuring This Skill" section when done - it's just guidance.]
|
|
56
|
+
|
|
57
|
+
## [TODO: Replace with the first main section based on chosen structure]
|
|
58
|
+
|
|
59
|
+
[TODO: Add content here. See examples in existing skills:
|
|
60
|
+
- Code samples for technical skills
|
|
61
|
+
- Decision trees for complex workflows
|
|
62
|
+
- Concrete examples with realistic user requests
|
|
63
|
+
- References to scripts/templates/references as needed]
|
|
64
|
+
|
|
65
|
+
## Resources
|
|
66
|
+
|
|
67
|
+
This skill includes example resource directories that demonstrate how to organize different types of bundled resources:
|
|
68
|
+
|
|
69
|
+
### scripts/
|
|
70
|
+
Executable code (Python/Bash/etc.) that can be run directly to perform specific operations.
|
|
71
|
+
|
|
72
|
+
**Examples from other skills:**
|
|
73
|
+
- PDF skill: `fill_fillable_fields.py`, `extract_form_field_info.py` - utilities for PDF manipulation
|
|
74
|
+
- DOCX skill: `document.py`, `utilities.py` - Python modules for document processing
|
|
75
|
+
|
|
76
|
+
**Appropriate for:** Python scripts, shell scripts, or any executable code that performs automation, data processing, or specific operations.
|
|
77
|
+
|
|
78
|
+
**Note:** Scripts may be executed without loading into context, but can still be read by Claude for patching or environment adjustments.
|
|
79
|
+
|
|
80
|
+
### references/
|
|
81
|
+
Documentation and reference material intended to be loaded into context to inform Claude's process and thinking.
|
|
82
|
+
|
|
83
|
+
**Examples from other skills:**
|
|
84
|
+
- Product management: `communication.md`, `context_building.md` - detailed workflow guides
|
|
85
|
+
- BigQuery: API reference documentation and query examples
|
|
86
|
+
- Finance: Schema documentation, company policies
|
|
87
|
+
|
|
88
|
+
**Appropriate for:** In-depth documentation, API references, database schemas, comprehensive guides, or any detailed information that Claude should reference while working.
|
|
89
|
+
|
|
90
|
+
### assets/
|
|
91
|
+
Files not intended to be loaded into context, but rather used within the output Claude produces.
|
|
92
|
+
|
|
93
|
+
**Examples from other skills:**
|
|
94
|
+
- Brand styling: PowerPoint template files (.pptx), logo files
|
|
95
|
+
- Frontend builder: HTML/React boilerplate project directories
|
|
96
|
+
- Typography: Font files (.ttf, .woff2)
|
|
97
|
+
|
|
98
|
+
**Appropriate for:** Templates, boilerplate code, document templates, images, icons, fonts, or any files meant to be copied or used in the final output.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
**Any unneeded directories can be deleted.** Not every skill requires all three types of resources.
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
EXAMPLE_SCRIPT = '''#!/usr/bin/env python3
|
|
106
|
+
"""
|
|
107
|
+
Example helper script for {skill_name}
|
|
108
|
+
|
|
109
|
+
This is a placeholder script that can be executed directly.
|
|
110
|
+
Replace with actual implementation or delete if not needed.
|
|
111
|
+
|
|
112
|
+
Example real scripts from other skills:
|
|
113
|
+
- pdf/scripts/fill_fillable_fields.py - Fills PDF form fields
|
|
114
|
+
- pdf/scripts/convert_pdf_to_images.py - Converts PDF pages to images
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
def main():
|
|
118
|
+
print("This is an example script for {skill_name}")
|
|
119
|
+
# TODO: Add actual script logic here
|
|
120
|
+
# This could be data processing, file conversion, API calls, etc.
|
|
121
|
+
|
|
122
|
+
if __name__ == "__main__":
|
|
123
|
+
main()
|
|
124
|
+
'''
|
|
125
|
+
|
|
126
|
+
EXAMPLE_REFERENCE = """# Reference Documentation for {skill_title}
|
|
127
|
+
|
|
128
|
+
This is a placeholder for detailed reference documentation.
|
|
129
|
+
Replace with actual reference content or delete if not needed.
|
|
130
|
+
|
|
131
|
+
Example real reference docs from other skills:
|
|
132
|
+
- product-management/references/communication.md - Comprehensive guide for status updates
|
|
133
|
+
- product-management/references/context_building.md - Deep-dive on gathering context
|
|
134
|
+
- bigquery/references/ - API references and query examples
|
|
135
|
+
|
|
136
|
+
## When Reference Docs Are Useful
|
|
137
|
+
|
|
138
|
+
Reference docs are ideal for:
|
|
139
|
+
- Comprehensive API documentation
|
|
140
|
+
- Detailed workflow guides
|
|
141
|
+
- Complex multi-step processes
|
|
142
|
+
- Information too lengthy for main SKILL.md
|
|
143
|
+
- Content that's only needed for specific use cases
|
|
144
|
+
|
|
145
|
+
## Structure Suggestions
|
|
146
|
+
|
|
147
|
+
### API Reference Example
|
|
148
|
+
- Overview
|
|
149
|
+
- Authentication
|
|
150
|
+
- Endpoints with examples
|
|
151
|
+
- Error codes
|
|
152
|
+
- Rate limits
|
|
153
|
+
|
|
154
|
+
### Workflow Guide Example
|
|
155
|
+
- Prerequisites
|
|
156
|
+
- Step-by-step instructions
|
|
157
|
+
- Common patterns
|
|
158
|
+
- Troubleshooting
|
|
159
|
+
- Best practices
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
EXAMPLE_ASSET = """# Example Asset File
|
|
163
|
+
|
|
164
|
+
This placeholder represents where asset files would be stored.
|
|
165
|
+
Replace with actual asset files (templates, images, fonts, etc.) or delete if not needed.
|
|
166
|
+
|
|
167
|
+
Asset files are NOT intended to be loaded into context, but rather used within
|
|
168
|
+
the output Claude produces.
|
|
169
|
+
|
|
170
|
+
Example asset files from other skills:
|
|
171
|
+
- Brand guidelines: logo.png, slides_template.pptx
|
|
172
|
+
- Frontend builder: hello-world/ directory with HTML/React boilerplate
|
|
173
|
+
- Typography: custom-font.ttf, font-family.woff2
|
|
174
|
+
- Data: sample_data.csv, test_dataset.json
|
|
175
|
+
|
|
176
|
+
## Common Asset Types
|
|
177
|
+
|
|
178
|
+
- Templates: .pptx, .docx, boilerplate directories
|
|
179
|
+
- Images: .png, .jpg, .svg, .gif
|
|
180
|
+
- Fonts: .ttf, .otf, .woff, .woff2
|
|
181
|
+
- Boilerplate code: Project directories, starter files
|
|
182
|
+
- Icons: .ico, .svg
|
|
183
|
+
- Data files: .csv, .json, .xml, .yaml
|
|
184
|
+
|
|
185
|
+
Note: This is a text placeholder. Actual assets can be any file type.
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def title_case_skill_name(skill_name):
|
|
190
|
+
"""Convert hyphenated skill name to Title Case for display."""
|
|
191
|
+
return ' '.join(word.capitalize() for word in skill_name.split('-'))
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def init_skill(skill_name, path):
|
|
195
|
+
"""
|
|
196
|
+
Initialize a new skill directory with template SKILL.md.
|
|
197
|
+
|
|
198
|
+
Args:
|
|
199
|
+
skill_name: Name of the skill
|
|
200
|
+
path: Path where the skill directory should be created
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
Path to created skill directory, or None if error
|
|
204
|
+
"""
|
|
205
|
+
# Determine skill directory path
|
|
206
|
+
skill_dir = Path(path).resolve() / skill_name
|
|
207
|
+
|
|
208
|
+
# Check if directory already exists
|
|
209
|
+
if skill_dir.exists():
|
|
210
|
+
print(f"❌ Error: Skill directory already exists: {skill_dir}")
|
|
211
|
+
return None
|
|
212
|
+
|
|
213
|
+
# Create skill directory
|
|
214
|
+
try:
|
|
215
|
+
skill_dir.mkdir(parents=True, exist_ok=False)
|
|
216
|
+
print(f"✅ Created skill directory: {skill_dir}")
|
|
217
|
+
except Exception as e:
|
|
218
|
+
print(f"❌ Error creating directory: {e}")
|
|
219
|
+
return None
|
|
220
|
+
|
|
221
|
+
# Create SKILL.md from template
|
|
222
|
+
skill_title = title_case_skill_name(skill_name)
|
|
223
|
+
skill_content = SKILL_TEMPLATE.format(
|
|
224
|
+
skill_name=skill_name,
|
|
225
|
+
skill_title=skill_title
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
skill_md_path = skill_dir / 'SKILL.md'
|
|
229
|
+
try:
|
|
230
|
+
skill_md_path.write_text(skill_content)
|
|
231
|
+
print("✅ Created SKILL.md")
|
|
232
|
+
except Exception as e:
|
|
233
|
+
print(f"❌ Error creating SKILL.md: {e}")
|
|
234
|
+
return None
|
|
235
|
+
|
|
236
|
+
# Create resource directories with example files
|
|
237
|
+
try:
|
|
238
|
+
# Create scripts/ directory with example script
|
|
239
|
+
scripts_dir = skill_dir / 'scripts'
|
|
240
|
+
scripts_dir.mkdir(exist_ok=True)
|
|
241
|
+
example_script = scripts_dir / 'example.py'
|
|
242
|
+
example_script.write_text(EXAMPLE_SCRIPT.format(skill_name=skill_name))
|
|
243
|
+
example_script.chmod(0o755)
|
|
244
|
+
print("✅ Created scripts/example.py")
|
|
245
|
+
|
|
246
|
+
# Create references/ directory with example reference doc
|
|
247
|
+
references_dir = skill_dir / 'references'
|
|
248
|
+
references_dir.mkdir(exist_ok=True)
|
|
249
|
+
example_reference = references_dir / 'api_reference.md'
|
|
250
|
+
example_reference.write_text(EXAMPLE_REFERENCE.format(skill_title=skill_title))
|
|
251
|
+
print("✅ Created references/api_reference.md")
|
|
252
|
+
|
|
253
|
+
# Create assets/ directory with example asset placeholder
|
|
254
|
+
assets_dir = skill_dir / 'assets'
|
|
255
|
+
assets_dir.mkdir(exist_ok=True)
|
|
256
|
+
example_asset = assets_dir / 'example_asset.txt'
|
|
257
|
+
example_asset.write_text(EXAMPLE_ASSET)
|
|
258
|
+
print("✅ Created assets/example_asset.txt")
|
|
259
|
+
except Exception as e:
|
|
260
|
+
print(f"❌ Error creating resource directories: {e}")
|
|
261
|
+
return None
|
|
262
|
+
|
|
263
|
+
# Print next steps
|
|
264
|
+
print(f"\n✅ Skill '{skill_name}' initialized successfully at {skill_dir}")
|
|
265
|
+
print("\nNext steps:")
|
|
266
|
+
print("1. Edit SKILL.md to complete the TODO items and update the description")
|
|
267
|
+
print("2. Customize or delete the example files in scripts/, references/, and assets/")
|
|
268
|
+
print("3. Run the validator when ready to check the skill structure")
|
|
269
|
+
|
|
270
|
+
return skill_dir
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def main():
|
|
274
|
+
if len(sys.argv) < 4 or sys.argv[2] != '--path':
|
|
275
|
+
print("Usage: init_skill.py <skill-name> --path <path>")
|
|
276
|
+
print("\nSkill name requirements:")
|
|
277
|
+
print(" - Hyphen-case identifier (e.g., 'data-analyzer')")
|
|
278
|
+
print(" - Lowercase letters, digits, and hyphens only")
|
|
279
|
+
print(" - Max 40 characters")
|
|
280
|
+
print(" - Must match directory name exactly")
|
|
281
|
+
print("\nExamples:")
|
|
282
|
+
print(" init_skill.py my-new-skill --path skills/public")
|
|
283
|
+
print(" init_skill.py my-api-helper --path skills/private")
|
|
284
|
+
print(" init_skill.py custom-skill --path /custom/location")
|
|
285
|
+
sys.exit(1)
|
|
286
|
+
|
|
287
|
+
skill_name = sys.argv[1]
|
|
288
|
+
path = sys.argv[3]
|
|
289
|
+
|
|
290
|
+
print(f"🚀 Initializing skill: {skill_name}")
|
|
291
|
+
print(f" Location: {path}")
|
|
292
|
+
print()
|
|
293
|
+
|
|
294
|
+
result = init_skill(skill_name, path)
|
|
295
|
+
|
|
296
|
+
if result:
|
|
297
|
+
sys.exit(0)
|
|
298
|
+
else:
|
|
299
|
+
sys.exit(1)
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
if __name__ == "__main__":
|
|
303
|
+
main()
|