oh-my-customcode 0.3.1 → 0.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.
Files changed (97) hide show
  1. package/README.md +14 -67
  2. package/dist/cli/index.js +1 -1
  3. package/dist/index.js +2 -18
  4. package/package.json +6 -1
  5. package/templates/.claude/agents/arch-documenter.md +10 -1
  6. package/templates/.claude/agents/arch-speckit-agent.md +10 -1
  7. package/templates/.claude/agents/be-express-expert.md +10 -1
  8. package/templates/.claude/agents/be-fastapi-expert.md +11 -1
  9. package/templates/.claude/agents/be-go-backend-expert.md +11 -1
  10. package/templates/.claude/agents/be-nestjs-expert.md +10 -1
  11. package/templates/.claude/agents/be-springboot-expert.md +11 -1
  12. package/templates/.claude/agents/db-supabase-expert.md +9 -1
  13. package/templates/.claude/agents/fe-svelte-agent.md +10 -1
  14. package/templates/.claude/agents/fe-vercel-agent.md +13 -1
  15. package/templates/.claude/agents/fe-vuejs-agent.md +10 -1
  16. package/templates/.claude/agents/infra-aws-expert.md +11 -1
  17. package/templates/.claude/agents/infra-docker-expert.md +11 -1
  18. package/templates/.claude/agents/lang-golang-expert.md +11 -1
  19. package/templates/.claude/agents/lang-java21-expert.md +10 -1
  20. package/templates/.claude/agents/lang-kotlin-expert.md +11 -1
  21. package/templates/.claude/agents/lang-python-expert.md +11 -1
  22. package/templates/.claude/agents/lang-rust-expert.md +11 -1
  23. package/templates/.claude/agents/lang-typescript-expert.md +11 -1
  24. package/templates/.claude/agents/mgr-claude-code-bible.md +246 -0
  25. package/templates/.claude/agents/mgr-creator.md +20 -2
  26. package/templates/.claude/agents/mgr-gitnerd.md +32 -1
  27. package/templates/.claude/agents/mgr-sauron.md +41 -26
  28. package/templates/.claude/agents/mgr-supplier.md +11 -1
  29. package/templates/.claude/agents/mgr-sync-checker.md +11 -1
  30. package/templates/.claude/agents/mgr-updater.md +11 -1
  31. package/templates/.claude/agents/qa-engineer.md +10 -1
  32. package/templates/.claude/agents/qa-planner.md +10 -1
  33. package/templates/.claude/agents/qa-writer.md +10 -1
  34. package/templates/.claude/agents/sys-memory-keeper.md +21 -9
  35. package/templates/.claude/agents/sys-naggy.md +10 -1
  36. package/templates/.claude/agents/tool-bun-expert.md +10 -1
  37. package/templates/.claude/agents/tool-npm-expert.md +13 -1
  38. package/templates/.claude/agents/tool-optimizer.md +13 -1
  39. package/templates/.claude/hooks/hooks.json +3 -37
  40. package/templates/.claude/install-hooks.sh +1 -1
  41. package/templates/.claude/rules/MUST-agent-design.md +37 -0
  42. package/templates/.claude/rules/MUST-orchestrator-coordination.md +61 -0
  43. package/templates/.claude/rules/MUST-parallel-execution.md +85 -14
  44. package/templates/.claude/rules/MUST-sync-verification.md +62 -7
  45. package/templates/.claude/rules/MUST-tool-identification.md +23 -0
  46. package/templates/.claude/rules/SHOULD-hud-statusline.md +26 -10
  47. package/templates/.claude/rules/SHOULD-memory-integration.md +96 -78
  48. package/templates/.claude/rules/index.yaml +1 -9
  49. package/templates/.claude/skills/aws-best-practices/SKILL.md +1 -0
  50. package/templates/.claude/skills/claude-code-bible/SKILL.md +180 -0
  51. package/templates/.claude/skills/claude-code-bible/scripts/fetch-docs.js +244 -0
  52. package/templates/.claude/skills/docker-best-practices/SKILL.md +1 -0
  53. package/templates/.claude/skills/fastapi-best-practices/SKILL.md +1 -0
  54. package/templates/.claude/skills/go-backend-best-practices/SKILL.md +1 -0
  55. package/templates/.claude/skills/go-best-practices/CLAUDE.md +9 -0
  56. package/templates/.claude/skills/go-best-practices/SKILL.md +1 -0
  57. package/templates/.claude/skills/help/SKILL.md +1 -1
  58. package/templates/.claude/skills/intent-detection/SKILL.md +1 -0
  59. package/templates/.claude/skills/intent-detection/patterns/agent-triggers.yaml +8 -8
  60. package/templates/.claude/skills/kotlin-best-practices/SKILL.md +1 -0
  61. package/templates/.claude/skills/lists/SKILL.md +2 -2
  62. package/templates/.claude/skills/memory-management/SKILL.md +8 -7
  63. package/templates/.claude/skills/memory-recall/SKILL.md +5 -5
  64. package/templates/.claude/skills/memory-save/SKILL.md +4 -4
  65. package/templates/.claude/skills/python-best-practices/SKILL.md +1 -0
  66. package/templates/.claude/skills/react-best-practices/SKILL.md +1 -0
  67. package/templates/.claude/skills/result-aggregation/SKILL.md +1 -0
  68. package/templates/.claude/skills/rust-best-practices/SKILL.md +1 -0
  69. package/templates/.claude/skills/springboot-best-practices/SKILL.md +1 -0
  70. package/templates/.claude/skills/status/SKILL.md +2 -2
  71. package/templates/.claude/skills/supabase-postgres-best-practices/SKILL.md +1 -0
  72. package/templates/.claude/skills/typescript-best-practices/SKILL.md +1 -0
  73. package/templates/.claude/skills/web-design-guidelines/SKILL.md +1 -0
  74. package/templates/.claude/skills/writing-clearly-and-concisely/SKILL.md +64 -0
  75. package/templates/CLAUDE.md.en +40 -13
  76. package/templates/CLAUDE.md.ko +40 -13
  77. package/templates/examples/code-review.yaml +1 -1
  78. package/templates/guides/elements-of-style/elements-of-style.html +2609 -0
  79. package/templates/guides/index.yaml +1 -1
  80. package/templates/index.yaml +1 -1
  81. package/templates/manifest.json +5 -11
  82. package/templates/pipelines/examples/code-review.yaml +1 -1
  83. package/templates/pipelines/index.yaml +1 -1
  84. package/templates/.claude/agents/tutor-go.md +0 -119
  85. package/templates/.claude/hooks/hud/index.yaml +0 -27
  86. package/templates/.claude/hooks/hud/update-status.sh +0 -32
  87. package/templates/.claude/hooks/index.yaml +0 -46
  88. package/templates/.claude/hooks/memory-persistence/pre-compact.sh +0 -37
  89. package/templates/.claude/hooks/memory-persistence/session-end.sh +0 -64
  90. package/templates/.claude/hooks/memory-persistence/session-start.sh +0 -41
  91. package/templates/.claude/hooks/strategic-compact/suggest-compact.sh +0 -50
  92. package/templates/.claude/rules/SHOULD-pipeline-mode.md +0 -165
  93. package/templates/.claude/skills/pipeline-execution/SKILL.md +0 -188
  94. package/templates/.claude/skills/pipeline-list/SKILL.md +0 -74
  95. package/templates/.claude/skills/pipeline-run/SKILL.md +0 -143
  96. package/templates/pipelines/templates/pipeline-template.yaml +0 -50
  97. package/templates/templates/pipeline-template.yaml +0 -50
@@ -5,110 +5,128 @@
5
5
 
6
6
  ## Purpose
7
7
 
8
- Integrate claude-mem for session context persistence across compaction.
8
+ Provide persistent memory for agents using Claude Code's native auto memory system.
9
9
 
10
- ## Requirements
10
+ ## Architecture: Native First
11
11
 
12
- ### 1. Save Before Compaction
13
- ```yaml
14
- trigger: PreCompact hook
15
- action:
16
- - Collect session context (tasks, decisions, key info)
17
- - Format with project tag "baekgom-agents"
18
- - Store in claude-mem with metadata
19
12
  ```
20
-
21
- ### 2. Restore on Session Start
22
- ```yaml
23
- trigger: SessionStart hook
24
- action:
25
- - Build semantic query with project prefix
26
- - Search claude-mem for relevant context
27
- - Load and present context to agent
13
+ Primary: Native Auto Memory (memory field in agent frontmatter)
14
+ - Agent-specific persistent knowledge
15
+ - Automatic system prompt injection (MEMORY.md)
16
+ - No external dependencies
17
+
18
+ Supplementary: claude-mem MCP (optional)
19
+ - Session-level temporal observations
20
+ - Cross-agent semantic search
21
+ - Only if installed and configured
22
+
23
+ RULE: If native auto memory can handle the task,
24
+ DO NOT use claude-mem.
28
25
  ```
29
26
 
30
- ### 3. Project Isolation
31
- ```yaml
32
- rule: Always include project name in queries
33
- reason: Prevent cross-contamination between projects
34
- ```
27
+ ## Native Auto Memory
35
28
 
36
- ## Storage Format
29
+ ### How It Works
37
30
 
38
- ```yaml
39
- project: baekgom-agents
40
- session: {date}-{uuid}
41
- tags: [session, task, decision]
42
- content:
43
- summary: Brief description of session context
44
- tasks_completed: List of completed tasks
45
- decisions: Key decisions made
46
- open_items: Unfinished work
47
- ```
31
+ 1. Agent frontmatter includes `memory` field:
32
+ ```yaml
33
+ memory: project # or user, local
34
+ ```
48
35
 
49
- ## Query Pattern
36
+ 2. System automatically:
37
+ - Creates memory directory for the agent
38
+ - Loads first 200 lines of MEMORY.md into system prompt
39
+ - Enables Read/Write/Edit tools for memory directory
40
+ - Agent learns and records patterns across conversations
50
41
 
51
- Always include project name in queries:
52
- - `"baekgom-agents session authentication"`
53
- - `"baekgom-agents 2025-01-24 bug fix"`
54
- - `"baekgom-agents agent creation workflow"`
42
+ ### Memory Scopes
55
43
 
56
- ### Effective Queries
57
- ```yaml
58
- good:
59
- - "baekgom-agents implementing oauth" (semantic, project-scoped)
60
- - "baekgom-agents 2025-01-24 memory system" (temporal)
61
- - "baekgom-agents decision agent architecture" (topic-based)
62
-
63
- bad:
64
- - "implementing oauth" (missing project scope)
65
- - "session context" (too generic)
66
- ```
44
+ | Scope | Location | Use Case | Git Tracked |
45
+ |-------|----------|----------|-------------|
46
+ | `user` | `~/.claude/agent-memory/<name>/` | Cross-project patterns | No |
47
+ | `project` | `.claude/agent-memory/<name>/` | Project-specific patterns | Yes |
48
+ | `local` | `.claude/agent-memory-local/<name>/` | Local-only knowledge | No |
67
49
 
68
- ## Commands
50
+ ### Current Agent Memory Map
69
51
 
70
- | Command | Description |
71
- |---------|-------------|
72
- | `sys-memory-keeper:save` | Save current context to claude-mem |
73
- | `sys-memory-keeper:recall` | Search and recall relevant memories |
52
+ | Scope | Agents | Count |
53
+ |-------|--------|-------|
54
+ | `project` | lang-*, be-*, fe-*, arch-*, tool-*, qa-*, mgr-creator, mgr-updater, mgr-gitnerd, mgr-sauron, mgr-claude-code-bible, sys-memory-keeper | 28 |
55
+ | `user` | infra-docker-expert, infra-aws-expert, db-supabase-expert | 3 |
56
+ | `local` | mgr-supplier, mgr-sync-checker, sys-naggy | 3 |
74
57
 
75
- ## Integration with Agents
58
+ ### Memory Best Practices
76
59
 
77
- ### sys-memory-keeper Agent
78
- ```
79
- Responsible for:
80
- - Executing save/recall operations
81
- - Managing session metadata
82
- - Handling PreCompact and SessionStart hooks
60
+ ```yaml
61
+ do:
62
+ - Let agents consult memory before starting work
63
+ - Update memory after discovering patterns or conventions
64
+ - Keep MEMORY.md under 200 lines (auto-curate if exceeded)
65
+ - Use separate topic files for detailed notes
66
+
67
+ dont:
68
+ - Store sensitive data (API keys, credentials)
69
+ - Duplicate information already in CLAUDE.md
70
+ - Use memory for temporary session state
83
71
  ```
84
72
 
85
- ### Other Agents
86
- ```
87
- When to trigger sys-memory-keeper:save:
88
- - Before complex task completion
89
- - When making significant decisions
90
- - Before expected context compaction
91
- ```
73
+ ## Claude-mem (Optional Supplement)
74
+
75
+ claude-mem MCP provides session-level observations and semantic search.
76
+ It is NOT required for basic memory functionality.
92
77
 
93
- ## Storage Provider
78
+ ### When to Use claude-mem
79
+
80
+ | Scenario | Use Native Memory | Use claude-mem |
81
+ |----------|------------------|---------------|
82
+ | Agent learns project patterns | Yes | |
83
+ | Record debugging insights | Yes | |
84
+ | Search across multiple sessions | | Yes |
85
+ | Temporal queries (date-based) | | Yes |
86
+ | Cross-agent knowledge sharing | | Yes |
87
+ | Basic context persistence | Yes | |
88
+
89
+ ### claude-mem Integration (if installed)
94
90
 
95
91
  ```yaml
96
92
  provider: claude-mem
97
93
  collection: claude_memories
98
- project_tag: baekgom-agents
99
- archive_path: ~/.claude-mem/archives/
94
+ project_tag: my-project
95
+ status: optional
96
+ ```
97
+
98
+ ## Context Compaction
99
+
100
+ ### Compaction Controls
101
+
102
+ ```yaml
103
+ # Targeted compaction - preserve specific context
104
+ /compact focus on {topic}
105
+
106
+ # Examples
107
+ /compact focus on agent routing decisions
108
+ /compact focus on authentication implementation
109
+ /compact focus on test failures and fixes
110
+ ```
111
+
112
+ ### Best Practices
113
+
114
+ ```
115
+ do:
116
+ - Use /compact focus when nearing context limits
117
+ - Focus on the most relevant topic for current work
118
+ - Let auto-compaction handle routine cleanup
119
+
120
+ dont:
121
+ - Manually compact when not near limits
122
+ - Lose important decision context by unfocused compaction
100
123
  ```
101
124
 
102
125
  ## Error Handling
103
126
 
104
127
  ```yaml
105
- on_save_failure:
128
+ on_memory_write_failure:
106
129
  - Log error
107
130
  - Continue without blocking main task
108
- - Notify user of memory save failure
109
-
110
- on_recall_failure:
111
- - Log error
112
- - Continue with available context
113
- - Notify user that memory recall failed
131
+ - Memory is enhancement, not requirement
114
132
  ```
@@ -1,4 +1,4 @@
1
- # Baekgom Agents - Global Rules
1
+ # Global Rules
2
2
  # Priority: MUST > SHOULD > MAY
3
3
 
4
4
  rules:
@@ -108,14 +108,6 @@ rules:
108
108
  priority: SHOULD
109
109
  scope: all
110
110
 
111
- # Pipeline Mode - SHOULD
112
- - id: R014
113
- name: pipeline-mode
114
- title: Pipeline Mode Rules
115
- path: ./SHOULD-pipeline-mode.md
116
- priority: SHOULD
117
- scope: orchestrator
118
-
119
111
  # Intent Transparency - MUST
120
112
  - id: R015
121
113
  name: intent-transparency
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: aws-best-practices
3
3
  description: AWS patterns from Well-Architected Framework
4
+ user-invocable: false
4
5
  ---
5
6
 
6
7
  ## Purpose
@@ -0,0 +1,180 @@
1
+ ---
2
+ name: claude-code-bible
3
+ description: Fetch and verify Claude Code official documentation. Use when checking official spec compliance or updating local reference docs.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Claude Code Bible
8
+
9
+ Official documentation reference management for Claude Code.
10
+
11
+ ## Purpose
12
+
13
+ Maintain up-to-date local copies of Claude Code official documentation and verify that agents/skills comply with the official specifications.
14
+
15
+ ## Commands
16
+
17
+ ### /claude-code-bible update
18
+
19
+ Fetch the latest documentation from code.claude.com.
20
+
21
+ **What it does:**
22
+ - Fetches `https://code.claude.com/docs/llms.txt`
23
+ - Extracts all documentation URLs from the llms.txt content
24
+ - Downloads each documentation page and saves as markdown
25
+ - Writes a timestamp file for cache tracking
26
+ - Respects a 24-hour cache (skip if fresh, unless `--force` used)
27
+
28
+ **Usage:**
29
+ ```bash
30
+ # Fetch latest docs (skip if cached < 24h)
31
+ node .claude/skills/claude-code-bible/scripts/fetch-docs.js
32
+
33
+ # Force update even if cache is fresh
34
+ node .claude/skills/claude-code-bible/scripts/fetch-docs.js --force
35
+
36
+ # Custom output directory
37
+ node .claude/skills/claude-code-bible/scripts/fetch-docs.js --output /path/to/output
38
+ ```
39
+
40
+ **Default output location:**
41
+ ```
42
+ ~/.claude/references/claude-code/
43
+ ├── llms.txt # Master index
44
+ ├── last-updated.txt # ISO timestamp
45
+ ├── <doc-name>.md # Individual doc pages
46
+ └── ...
47
+ ```
48
+
49
+ **Exit codes:**
50
+ - `0`: Success (or cache is fresh)
51
+ - `1`: Fatal error
52
+
53
+ ### /claude-code-bible verify
54
+
55
+ Verify agents and skills against official Claude Code specifications.
56
+
57
+ **What it checks:**
58
+ - Agent structure compliance (frontmatter fields, file format)
59
+ - Skill structure compliance (SKILL.md format, disable-model-invocation usage)
60
+ - Tool usage patterns match official recommendations
61
+ - Workflow patterns align with Claude Code best practices
62
+ - Agent/skill naming conventions follow official guidelines
63
+
64
+ **Usage:**
65
+ ```bash
66
+ # Verify all agents and skills
67
+ /claude-code-bible verify
68
+
69
+ # Verify specific agent
70
+ /claude-code-bible verify --agent mgr-creator
71
+
72
+ # Verify specific skill
73
+ /claude-code-bible verify --skill go-best-practices
74
+
75
+ # Verbose output
76
+ /claude-code-bible verify --verbose
77
+ ```
78
+
79
+ **Verification rules:**
80
+ 1. **Agent frontmatter** must include:
81
+ - `name`: kebab-case identifier
82
+ - `description`: one-line summary
83
+ - `model`: sonnet | opus | haiku
84
+ - `tools`: array of allowed tools
85
+ - `skills`: array of skill names
86
+
87
+ 2. **Skill frontmatter** must include:
88
+ - `name`: kebab-case identifier
89
+ - `description`: when/why to use this skill
90
+ - `disable-model-invocation`: true (if skill is procedural/scripted)
91
+
92
+ 3. **Agent files** should NOT contain:
93
+ - Detailed skill instructions (belongs in .claude/skills/)
94
+ - Reference documentation (belongs in guides/)
95
+ - Implementation scripts (belongs in .claude/skills/{name}/scripts/)
96
+
97
+ 4. **Skill files** should contain:
98
+ - Clear purpose statement
99
+ - Usage examples
100
+ - Input/output specifications
101
+ - Integration points with agents
102
+
103
+ ## Implementation Notes
104
+
105
+ ### Fetch Script (fetch-docs.js)
106
+
107
+ **Features:**
108
+ - Uses only Node.js built-in modules (https, fs, path)
109
+ - Handles HTTP redirects (3xx responses)
110
+ - Respects server with 200ms delay between requests
111
+ - 24-hour cache to avoid unnecessary fetches
112
+ - Comprehensive error reporting
113
+
114
+ **Cache behavior:**
115
+ - Checks `last-updated.txt` timestamp
116
+ - Skips fetch if < 24 hours old (unless --force)
117
+ - Always updates timestamp on successful fetch
118
+
119
+ **Error handling:**
120
+ - Reports HTTP errors with status codes
121
+ - Continues on individual page failures
122
+ - Prints summary of successes and failures
123
+
124
+ ### Verify Command (future implementation)
125
+
126
+ The verify command should:
127
+ 1. Read official specs from `~/.claude/references/claude-code/`
128
+ 2. Parse all agents in `.claude/agents/*.md`
129
+ 3. Parse all skills in `.claude/skills/*/SKILL.md`
130
+ 4. Check each against official requirements
131
+ 5. Report violations with suggestions for fixes
132
+
133
+ ## Integration with Other Skills
134
+
135
+ ### create-agent
136
+ - Should verify new agents against official spec
137
+ - Use `/claude-code-bible verify --agent <name>` after creation
138
+
139
+ ### update-docs
140
+ - Should update local docs first: `/claude-code-bible update`
141
+ - Then verify sync with: `/claude-code-bible verify`
142
+
143
+ ### dev-review
144
+ - Can reference official docs for best practices
145
+ - Verify code patterns against Claude Code recommendations
146
+
147
+ ## Benefits
148
+
149
+ 1. **Compliance**: Ensure agents/skills match official specifications
150
+ 2. **Up-to-date**: Always have latest documentation locally
151
+ 3. **Offline access**: Work with docs even without internet
152
+ 4. **Automation**: Verify compliance automatically before commits
153
+ 5. **Learning**: Reference official patterns when creating new components
154
+
155
+ ## Example Workflow
156
+
157
+ ```bash
158
+ # 1. Update local docs
159
+ node .claude/skills/claude-code-bible/scripts/fetch-docs.js
160
+
161
+ # 2. Create a new agent
162
+ /create-agent my-new-agent
163
+
164
+ # 3. Verify it matches official spec
165
+ /claude-code-bible verify --agent my-new-agent
166
+
167
+ # 4. Fix any violations
168
+
169
+ # 5. Verify again
170
+ /claude-code-bible verify --agent my-new-agent
171
+
172
+ # 6. Commit when all checks pass
173
+ ```
174
+
175
+ ## Notes
176
+
177
+ - The verify command implementation is left for future work
178
+ - The fetch script is production-ready and can be used immediately
179
+ - Consider running `/claude-code-bible update` weekly to stay current
180
+ - Add this as a pre-commit hook to enforce compliance automatically
@@ -0,0 +1,244 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * fetch-docs.js
5
+ *
6
+ * Fetches Claude Code official documentation from code.claude.com
7
+ * and saves it locally for reference.
8
+ *
9
+ * Usage:
10
+ * node fetch-docs.js [--force] [--output <dir>]
11
+ *
12
+ * Options:
13
+ * --force Skip 24-hour cache check
14
+ * --output <dir> Output directory (default: ~/.claude/references/claude-code/)
15
+ */
16
+
17
+ const https = require('https');
18
+ const fs = require('fs');
19
+ const path = require('path');
20
+ const { homedir } = require('os');
21
+
22
+ // Configuration
23
+ const LLMS_TXT_URL = 'https://code.claude.com/docs/llms.txt';
24
+ const DEFAULT_OUTPUT_DIR = path.join(homedir(), '.claude', 'references', 'claude-code');
25
+ const FETCH_DELAY_MS = 200;
26
+ const CACHE_HOURS = 24;
27
+
28
+ // Parse CLI arguments
29
+ function parseArgs() {
30
+ const args = {
31
+ force: false,
32
+ outputDir: DEFAULT_OUTPUT_DIR,
33
+ };
34
+
35
+ for (let i = 2; i < process.argv.length; i++) {
36
+ const arg = process.argv[i];
37
+ if (arg === '--force') {
38
+ args.force = true;
39
+ } else if (arg === '--output' && i + 1 < process.argv.length) {
40
+ args.outputDir = process.argv[++i];
41
+ }
42
+ }
43
+
44
+ return args;
45
+ }
46
+
47
+ // Check if cache is fresh
48
+ function isCacheFresh(outputDir) {
49
+ const lastUpdatedPath = path.join(outputDir, 'last-updated.txt');
50
+
51
+ if (!fs.existsSync(lastUpdatedPath)) {
52
+ return false;
53
+ }
54
+
55
+ try {
56
+ const content = fs.readFileSync(lastUpdatedPath, 'utf-8').trim();
57
+ const lastUpdated = new Date(content);
58
+ const now = new Date();
59
+ const hoursSince = (now - lastUpdated) / (1000 * 60 * 60);
60
+
61
+ return hoursSince < CACHE_HOURS;
62
+ } catch (error) {
63
+ return false;
64
+ }
65
+ }
66
+
67
+ // Fetch URL with redirect support
68
+ function fetchUrl(url) {
69
+ return new Promise((resolve, reject) => {
70
+ https.get(url, (res) => {
71
+ // Handle redirects
72
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
73
+ return fetchUrl(res.headers.location).then(resolve).catch(reject);
74
+ }
75
+
76
+ if (res.statusCode !== 200) {
77
+ return reject(new Error(`HTTP ${res.statusCode}: ${url}`));
78
+ }
79
+
80
+ let data = '';
81
+ res.on('data', (chunk) => data += chunk);
82
+ res.on('end', () => resolve(data));
83
+ }).on('error', reject);
84
+ });
85
+ }
86
+
87
+ // Extract documentation URLs from llms.txt
88
+ function extractDocUrls(llmsTxtContent) {
89
+ const urls = [];
90
+
91
+ // Match URLs in markdown links: [title](url) and bare URLs
92
+ const markdownLinkRegex = /\(https?:\/\/code\.claude\.com\/docs\/[^)]+\)/g;
93
+ const bareLinkRegex = /^https?:\/\/code\.claude\.com\/docs\/\S+/gm;
94
+
95
+ let match;
96
+ while ((match = markdownLinkRegex.exec(llmsTxtContent)) !== null) {
97
+ // Remove surrounding parentheses
98
+ urls.push(match[0].slice(1, -1));
99
+ }
100
+ while ((match = bareLinkRegex.exec(llmsTxtContent)) !== null) {
101
+ urls.push(match[0]);
102
+ }
103
+
104
+ return [...new Set(urls)]; // Remove duplicates
105
+ }
106
+
107
+ // Convert URL to filename
108
+ function urlToFilename(url) {
109
+ const urlObj = new URL(url);
110
+ let filename = urlObj.pathname.replace(/^\/docs\//, '').replace(/\/$/, '');
111
+
112
+ if (!filename) {
113
+ filename = 'index';
114
+ }
115
+
116
+ // Remove language prefix (e.g., "en/") to keep filenames clean
117
+ filename = filename.replace(/^en\//, '');
118
+
119
+ // Replace remaining slashes with dashes for nested paths
120
+ filename = filename.replace(/\//g, '-');
121
+
122
+ if (!filename.endsWith('.md')) {
123
+ filename += '.md';
124
+ }
125
+
126
+ return filename;
127
+ }
128
+
129
+ // Sleep utility
130
+ function sleep(ms) {
131
+ return new Promise(resolve => setTimeout(resolve, ms));
132
+ }
133
+
134
+ // Ensure directory exists
135
+ function ensureDir(dirPath) {
136
+ if (!fs.existsSync(dirPath)) {
137
+ fs.mkdirSync(dirPath, { recursive: true });
138
+ }
139
+ }
140
+
141
+ // Main execution
142
+ async function main() {
143
+ const args = parseArgs();
144
+ const { force, outputDir } = args;
145
+
146
+ console.log('Claude Code Documentation Fetcher');
147
+ console.log('==================================\n');
148
+
149
+ // Check cache freshness
150
+ if (!force && isCacheFresh(outputDir)) {
151
+ console.log('✓ Cache is fresh (less than 24 hours old)');
152
+ console.log(' Use --force to bypass cache check\n');
153
+ console.log(`Output directory: ${outputDir}`);
154
+ return;
155
+ }
156
+
157
+ // Ensure output directory exists
158
+ ensureDir(outputDir);
159
+
160
+ const stats = {
161
+ total: 0,
162
+ success: 0,
163
+ failed: 0,
164
+ failures: [],
165
+ };
166
+
167
+ try {
168
+ // Step 1: Fetch llms.txt
169
+ console.log('Fetching llms.txt...');
170
+ const llmsTxtContent = await fetchUrl(LLMS_TXT_URL);
171
+ console.log('✓ llms.txt fetched\n');
172
+
173
+ // Save llms.txt itself
174
+ const llmsTxtPath = path.join(outputDir, 'llms.txt');
175
+ fs.writeFileSync(llmsTxtPath, llmsTxtContent, 'utf-8');
176
+
177
+ // Step 2: Extract documentation URLs
178
+ const docUrls = extractDocUrls(llmsTxtContent);
179
+
180
+ if (docUrls.length === 0) {
181
+ console.log('⚠ No documentation URLs found in llms.txt');
182
+ return;
183
+ }
184
+
185
+ console.log(`Found ${docUrls.length} documentation URL(s)\n`);
186
+ stats.total = docUrls.length;
187
+
188
+ // Step 3: Fetch each documentation page
189
+ for (let i = 0; i < docUrls.length; i++) {
190
+ const url = docUrls[i];
191
+ const filename = urlToFilename(url);
192
+ const filepath = path.join(outputDir, filename);
193
+
194
+ try {
195
+ console.log(`[${i + 1}/${docUrls.length}] Fetching ${url}...`);
196
+ const content = await fetchUrl(url);
197
+ fs.writeFileSync(filepath, content, 'utf-8');
198
+ console.log(` ✓ Saved to ${filename}`);
199
+ stats.success++;
200
+ } catch (error) {
201
+ console.log(` ✗ Failed: ${error.message}`);
202
+ stats.failed++;
203
+ stats.failures.push({ url, error: error.message });
204
+ }
205
+
206
+ // Delay between requests
207
+ if (i < docUrls.length - 1) {
208
+ await sleep(FETCH_DELAY_MS);
209
+ }
210
+ }
211
+
212
+ // Step 4: Write last-updated timestamp
213
+ const timestamp = new Date().toISOString();
214
+ const lastUpdatedPath = path.join(outputDir, 'last-updated.txt');
215
+ fs.writeFileSync(lastUpdatedPath, timestamp, 'utf-8');
216
+
217
+ // Summary
218
+ console.log('\n==================================');
219
+ console.log('Summary:');
220
+ console.log(` Total URLs: ${stats.total}`);
221
+ console.log(` Downloaded: ${stats.success}`);
222
+ console.log(` Failed: ${stats.failed}`);
223
+ console.log(` Save location: ${outputDir}`);
224
+ console.log(` Last updated: ${timestamp}`);
225
+
226
+ if (stats.failures.length > 0) {
227
+ console.log('\nFailures:');
228
+ stats.failures.forEach(({ url, error }) => {
229
+ console.log(` - ${url}`);
230
+ console.log(` ${error}`);
231
+ });
232
+ }
233
+
234
+ } catch (error) {
235
+ console.error('\n✗ Fatal error:', error.message);
236
+ process.exit(1);
237
+ }
238
+ }
239
+
240
+ // Run
241
+ main().catch(error => {
242
+ console.error('Unexpected error:', error);
243
+ process.exit(1);
244
+ });
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: docker-best-practices
3
3
  description: Docker patterns for optimized containerization
4
+ user-invocable: false
4
5
  ---
5
6
 
6
7
  ## Purpose
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: fastapi-best-practices
3
3
  description: FastAPI patterns for high-performance async APIs
4
+ user-invocable: false
4
5
  ---
5
6
 
6
7
  ## Purpose
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: go-backend-best-practices
3
3
  description: Go backend patterns from Uber style and standard layout
4
+ user-invocable: false
4
5
  ---
5
6
 
6
7
  ## Purpose
@@ -0,0 +1,9 @@
1
+ <claude-mem-context>
2
+ # Recent Activity
3
+
4
+ ### Feb 5, 2026
5
+
6
+ | ID | Time | T | Title | Read |
7
+ |----|------|---|-------|------|
8
+ | #8 | 8:07 PM | 🔵 | Skill Definition Structure | ~626 |
9
+ </claude-mem-context>