claudenv 1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +163 -11
- package/bin/cli.js +167 -1
- package/package.json +1 -1
- package/scaffold/.claude/commands/improve.md +60 -0
- package/scaffold/.claude/commands/setup-mcp.md +115 -0
- package/scaffold/.claude/commands/update-docs.md +1 -0
- package/scaffold/.claude/skills/doc-generator/SKILL.md +3 -0
- package/scaffold/.claude/skills/doc-generator/templates/mcp-servers.md +168 -0
- package/scaffold/global/.claude/commands/claudenv.md +50 -4
- package/scaffold/global/.claude/commands/improve.md +60 -0
- package/scaffold/global/.claude/commands/setup-mcp.md +115 -0
- package/scaffold/global/.claude/skills/claudenv/SKILL.md +11 -0
- package/scaffold/global/.claude/skills/claudenv/scaffold/.claude/commands/improve.md +60 -0
- package/scaffold/global/.claude/skills/claudenv/scaffold/.claude/commands/setup-mcp.md +115 -0
- package/scaffold/global/.claude/skills/claudenv/scaffold/.claude/commands/update-docs.md +1 -0
- package/scaffold/global/.claude/skills/claudenv/scaffold/.claude/skills/doc-generator/SKILL.md +3 -0
- package/scaffold/global/.claude/skills/claudenv/scaffold/.claude/skills/doc-generator/templates/mcp-servers.md +168 -0
- package/scaffold/global/.claude/skills/claudenv/templates/mcp-servers.md +168 -0
- package/src/autonomy.js +117 -0
- package/src/hooks-gen.js +279 -0
- package/src/index.js +4 -0
- package/src/installer.js +2 -0
- package/src/loop.js +617 -0
- package/src/profiles.js +113 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# MCP Server Reference — Registry Search & Configuration
|
|
2
|
+
|
|
3
|
+
## 1. How to Search the Registry
|
|
4
|
+
|
|
5
|
+
The official MCP Registry API provides a searchable catalog of MCP servers. No authentication required.
|
|
6
|
+
|
|
7
|
+
**Endpoint**: `GET https://registry.modelcontextprotocol.io/v0.1/servers`
|
|
8
|
+
|
|
9
|
+
**Parameters**:
|
|
10
|
+
- `search=<term>` — case-insensitive substring match on server names and descriptions
|
|
11
|
+
- `version=latest` — return only the latest version of each server
|
|
12
|
+
- `limit=<n>` — max results per page (default ~100)
|
|
13
|
+
|
|
14
|
+
**Search strategy**:
|
|
15
|
+
1. Analyze the project's tech stack from manifest files, configs, and source code
|
|
16
|
+
2. Extract key technology names (languages, frameworks, databases, cloud services, tools)
|
|
17
|
+
3. Search each technology individually — specific terms yield better results
|
|
18
|
+
|
|
19
|
+
**Example searches**:
|
|
20
|
+
```bash
|
|
21
|
+
# Database
|
|
22
|
+
curl -s 'https://registry.modelcontextprotocol.io/v0.1/servers?search=postgres&version=latest&limit=10'
|
|
23
|
+
|
|
24
|
+
# Cloud provider
|
|
25
|
+
curl -s 'https://registry.modelcontextprotocol.io/v0.1/servers?search=aws&version=latest&limit=10'
|
|
26
|
+
|
|
27
|
+
# Monitoring
|
|
28
|
+
curl -s 'https://registry.modelcontextprotocol.io/v0.1/servers?search=sentry&version=latest&limit=10'
|
|
29
|
+
|
|
30
|
+
# Version control
|
|
31
|
+
curl -s 'https://registry.modelcontextprotocol.io/v0.1/servers?search=github&version=latest&limit=10'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 2. How to Evaluate and Trust Results
|
|
35
|
+
|
|
36
|
+
### Primary trust signal: npm download counts
|
|
37
|
+
|
|
38
|
+
For each candidate server that has an npm package, check monthly downloads:
|
|
39
|
+
```bash
|
|
40
|
+
curl -s 'https://api.npmjs.org/downloads/point/last-month/<npm-package-name>'
|
|
41
|
+
# Returns: { "downloads": N, "package": "...", ... }
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **Filter out** servers with <100 monthly downloads — likely unmaintained or experimental
|
|
45
|
+
- **Prefer** servers with 10,000+ monthly downloads — well-established and community-trusted
|
|
46
|
+
- **Strong signal** at 100,000+ downloads — widely adopted
|
|
47
|
+
|
|
48
|
+
### Secondary trust signal: GitHub stars
|
|
49
|
+
|
|
50
|
+
If the server has a repository URL, check GitHub stars:
|
|
51
|
+
```bash
|
|
52
|
+
curl -s 'https://api.github.com/repos/<owner>/<repo>'
|
|
53
|
+
# Check the "stargazers_count" field
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- Prefer repos with 100+ stars
|
|
57
|
+
- Stars indicate community interest but downloads are a stronger usage signal
|
|
58
|
+
|
|
59
|
+
### Additional evaluation criteria
|
|
60
|
+
|
|
61
|
+
- **Prefer `packages` (npm/stdio) over `remotes` (hosted)** — stdio runs locally with no external dependency
|
|
62
|
+
- **Prefer well-known namespaces**: `io.modelcontextprotocol/*`, `io.github.modelcontextprotocol/*` are official
|
|
63
|
+
- **Read descriptions carefully** — pick servers that match the project's actual use case
|
|
64
|
+
- **Skip** servers that appear to be forks, test entries, or clearly unmaintained
|
|
65
|
+
- **When multiple servers exist for the same tech**, pick the one with highest npm downloads
|
|
66
|
+
- **Check `environmentVariables`** — servers requiring many complex env vars may be harder to set up
|
|
67
|
+
|
|
68
|
+
## 3. How to Build .mcp.json
|
|
69
|
+
|
|
70
|
+
The `.mcp.json` file configures MCP servers for a project. It lives in the project root.
|
|
71
|
+
|
|
72
|
+
**Root structure**:
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"server-name": { ... }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### stdio servers (npm packages)
|
|
82
|
+
|
|
83
|
+
For servers with a `packages` entry of `registryType: "npm"`:
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"server-name": {
|
|
88
|
+
"command": "npx",
|
|
89
|
+
"args": ["-y", "<package-identifier>@latest"],
|
|
90
|
+
"env": {
|
|
91
|
+
"VAR_NAME": "${VAR_NAME}"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- Add any `packageArguments` with `type: "positional"` to the `args` array after the package name
|
|
99
|
+
- Map `environmentVariables` to the `env` object
|
|
100
|
+
- Use `${ENV_VAR}` placeholders for all variables with `isSecret: true`
|
|
101
|
+
- Non-secret env vars can use literal values when the value is project-specific and non-sensitive
|
|
102
|
+
|
|
103
|
+
### HTTP/SSE servers (remote)
|
|
104
|
+
|
|
105
|
+
For servers with a `remotes` entry:
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"mcpServers": {
|
|
109
|
+
"server-name": {
|
|
110
|
+
"type": "streamable-http",
|
|
111
|
+
"url": "https://example.com/mcp"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Use the `type` and `url` from the remote entry directly. Add `headers` if authentication is needed:
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"type": "streamable-http",
|
|
121
|
+
"url": "https://example.com/mcp",
|
|
122
|
+
"headers": {
|
|
123
|
+
"Authorization": "Bearer ${API_KEY}"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 4. Well-Known Servers
|
|
129
|
+
|
|
130
|
+
These are hints to help find the best option when search results are noisy. Always verify via the registry API — these names and packages may change.
|
|
131
|
+
|
|
132
|
+
| Technology | Search term | Known namespace | Notes |
|
|
133
|
+
|---|---|---|---|
|
|
134
|
+
| Library docs | `context7` | `io.github.upstash/context7` | Up-to-date docs for any library; useful for most projects |
|
|
135
|
+
| GitHub | `github` | `io.github.modelcontextprotocol/github` | Repo management, PRs, issues |
|
|
136
|
+
| PostgreSQL | `postgres` | `io.github.modelcontextprotocol/postgres` | Database queries; prefer read-only config |
|
|
137
|
+
| Filesystem | `filesystem` | `io.github.modelcontextprotocol/filesystem` | Scoped file access |
|
|
138
|
+
| Fetch | `fetch` | `io.github.modelcontextprotocol/fetch` | Web content retrieval |
|
|
139
|
+
| Sentry | `sentry` | — | Error tracking integration |
|
|
140
|
+
| Stripe | `stripe` | — | Payment API |
|
|
141
|
+
| Docker | `docker` | — | Container management |
|
|
142
|
+
| AWS | `aws` | — | Cloud services |
|
|
143
|
+
| Redis | `redis` | — | Cache and data store |
|
|
144
|
+
| MongoDB | `mongodb` | — | Document database |
|
|
145
|
+
| Slack | `slack` | — | Team communication |
|
|
146
|
+
| Linear | `linear` | — | Issue tracking |
|
|
147
|
+
|
|
148
|
+
## 5. Security Rules
|
|
149
|
+
|
|
150
|
+
### Secrets management
|
|
151
|
+
- **NEVER** put actual secret values in `.mcp.json` — use `${ENV_VAR}` placeholders
|
|
152
|
+
- Secret values go in `~/.claude.json` (user-level config, not committed to version control)
|
|
153
|
+
- Tell the user how to configure each secret:
|
|
154
|
+
```
|
|
155
|
+
claude config set env.VAR_NAME "actual-value"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Safe to commit
|
|
159
|
+
- `.mcp.json` is safe to commit to version control — it contains only placeholders, never real secrets
|
|
160
|
+
- Add `.mcp.json` to the git commit alongside other Claude Code config files
|
|
161
|
+
|
|
162
|
+
### Database safety
|
|
163
|
+
- Prefer read-only database connection strings
|
|
164
|
+
- If read-write access is needed, document this clearly in the recommendation
|
|
165
|
+
|
|
166
|
+
### Principle of least privilege
|
|
167
|
+
- Only recommend servers that the project actually needs
|
|
168
|
+
- Prefer servers with narrow, well-defined capabilities over general-purpose ones
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Set up Claude Code documentation for this project — analyze tech stack, generate CLAUDE.md, rules, hooks, commands, and skills
|
|
3
|
-
allowed-tools: Read, Write, Glob, Grep, Bash(find:*), Bash(cat:*), Bash(mkdir:*), Bash(cp:*), Bash(chmod:*)
|
|
3
|
+
allowed-tools: Read, Write, Glob, Grep, Bash(find:*), Bash(cat:*), Bash(mkdir:*), Bash(cp:*), Bash(chmod:*), Bash(curl:*)
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
argument-hint: [--force]
|
|
6
6
|
---
|
|
@@ -105,13 +105,53 @@ cp ~/.claude/skills/claudenv/scaffold/.claude/commands/validate-docs.md .claude/
|
|
|
105
105
|
cp ~/.claude/skills/claudenv/scaffold/.claude/skills/doc-generator/SKILL.md .claude/skills/doc-generator/SKILL.md
|
|
106
106
|
cp ~/.claude/skills/claudenv/scaffold/.claude/skills/doc-generator/scripts/validate.sh .claude/skills/doc-generator/scripts/validate.sh
|
|
107
107
|
cp ~/.claude/skills/claudenv/scaffold/.claude/skills/doc-generator/templates/detection-patterns.md .claude/skills/doc-generator/templates/detection-patterns.md
|
|
108
|
+
cp ~/.claude/skills/claudenv/scaffold/.claude/skills/doc-generator/templates/mcp-servers.md .claude/skills/doc-generator/templates/mcp-servers.md
|
|
109
|
+
cp ~/.claude/skills/claudenv/scaffold/.claude/commands/setup-mcp.md .claude/commands/setup-mcp.md
|
|
110
|
+
cp ~/.claude/skills/claudenv/scaffold/.claude/commands/improve.md .claude/commands/improve.md
|
|
108
111
|
cp ~/.claude/skills/claudenv/scaffold/.claude/agents/doc-analyzer.md .claude/agents/doc-analyzer.md
|
|
109
112
|
chmod +x .claude/skills/doc-generator/scripts/validate.sh
|
|
110
113
|
```
|
|
111
114
|
|
|
112
115
|
If any file already exists, **skip it** unless `$ARGUMENTS` includes `--force`.
|
|
113
116
|
|
|
114
|
-
## Phase 5:
|
|
117
|
+
## Phase 5: MCP Server Configuration
|
|
118
|
+
|
|
119
|
+
Configure MCP servers for this project by searching the official MCP Registry.
|
|
120
|
+
|
|
121
|
+
Read the MCP server reference:
|
|
122
|
+
@~/.claude/skills/claudenv/templates/mcp-servers.md
|
|
123
|
+
|
|
124
|
+
**5.1 Identify technologies to search for:**
|
|
125
|
+
Based on your Phase 1 analysis, list the key technologies that might have MCP servers (databases, cloud services, APIs, dev tools).
|
|
126
|
+
|
|
127
|
+
**5.2 Search the registry:**
|
|
128
|
+
For each technology, query the MCP Registry API:
|
|
129
|
+
```bash
|
|
130
|
+
curl -s 'https://registry.modelcontextprotocol.io/v0.1/servers?search=<tech>&version=latest&limit=10'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**5.3 Verify trust:**
|
|
134
|
+
For each candidate with an npm package, check monthly downloads:
|
|
135
|
+
```bash
|
|
136
|
+
curl -s 'https://api.npmjs.org/downloads/point/last-month/<npm-package>'
|
|
137
|
+
```
|
|
138
|
+
Filter out servers with <100 monthly downloads.
|
|
139
|
+
|
|
140
|
+
**5.4 Present recommendations:**
|
|
141
|
+
Group as Essential / Recommended / Optional. For each, explain why it's relevant and show download counts.
|
|
142
|
+
|
|
143
|
+
Ask the user which to configure. If `$ARGUMENTS` includes `--force`, auto-select Essential + Recommended.
|
|
144
|
+
|
|
145
|
+
**5.5 Generate `.mcp.json`:**
|
|
146
|
+
Write `.mcp.json` with selected servers using `${ENV_VAR}` placeholders for secrets. Follow the format in the MCP server reference.
|
|
147
|
+
|
|
148
|
+
**5.6 List environment variables:**
|
|
149
|
+
Tell the user how to configure required secrets:
|
|
150
|
+
```
|
|
151
|
+
claude config set env.VAR_NAME "your-value"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Phase 6: Validate
|
|
115
155
|
|
|
116
156
|
Run the validation script:
|
|
117
157
|
```bash
|
|
@@ -120,7 +160,7 @@ bash .claude/skills/doc-generator/scripts/validate.sh 2>&1 || true
|
|
|
120
160
|
|
|
121
161
|
Fix any errors found.
|
|
122
162
|
|
|
123
|
-
## Phase
|
|
163
|
+
## Phase 7: Summary
|
|
124
164
|
|
|
125
165
|
Print a summary of everything created:
|
|
126
166
|
```
|
|
@@ -136,15 +176,21 @@ Created:
|
|
|
136
176
|
+ .claude/commands/init-docs.md
|
|
137
177
|
+ .claude/commands/update-docs.md
|
|
138
178
|
+ .claude/commands/validate-docs.md
|
|
179
|
+
+ .claude/commands/setup-mcp.md
|
|
180
|
+
+ .claude/commands/improve.md
|
|
139
181
|
+ .claude/skills/doc-generator/
|
|
140
182
|
+ .claude/agents/doc-analyzer.md
|
|
183
|
+
+ .mcp.json (if MCP servers were configured)
|
|
141
184
|
|
|
142
185
|
Available commands:
|
|
143
186
|
/init-docs — Regenerate documentation from scratch
|
|
144
187
|
/update-docs — Update docs when project changes
|
|
145
188
|
/validate-docs — Check documentation completeness
|
|
189
|
+
/setup-mcp — Add or update MCP server configuration
|
|
190
|
+
/improve — Analyze and make one improvement
|
|
146
191
|
|
|
147
192
|
Next steps:
|
|
148
193
|
1. Review and edit CLAUDE.md
|
|
149
|
-
2.
|
|
194
|
+
2. Configure any required MCP secrets: claude config set env.VAR_NAME "value"
|
|
195
|
+
3. git add .claude/ CLAUDE.md _state.md .mcp.json && git commit -m "Add Claude Code docs"
|
|
150
196
|
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Analyze this project and make one high-impact improvement — fix bugs, add tests, improve code quality
|
|
3
|
+
allowed-tools: Read, Write, Glob, Grep, Bash
|
|
4
|
+
argument-hint: [area-to-improve]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /improve — Single Improvement Iteration
|
|
8
|
+
|
|
9
|
+
You are an expert software engineer. Your job is to analyze this project and make one high-impact improvement.
|
|
10
|
+
|
|
11
|
+
## Step 1: Read Context
|
|
12
|
+
|
|
13
|
+
Read these files if they exist:
|
|
14
|
+
- `CLAUDE.md` — project overview and conventions
|
|
15
|
+
- `_state.md` — session memory
|
|
16
|
+
- `.claude/improvement-plan.md` — existing improvement plan (if any)
|
|
17
|
+
|
|
18
|
+
## Step 2: Choose What to Improve
|
|
19
|
+
|
|
20
|
+
**If `.claude/improvement-plan.md` exists:**
|
|
21
|
+
- Read the plan and pick the top unfinished item from the "## Pending" section
|
|
22
|
+
- If `$ARGUMENTS` is provided, use it as a focus area instead of the plan
|
|
23
|
+
|
|
24
|
+
**If no plan exists:**
|
|
25
|
+
- Analyze the project: read manifest files, scan source code, check test coverage
|
|
26
|
+
- If `$ARGUMENTS` is provided, focus on that area
|
|
27
|
+
- Identify the single highest-impact improvement you can make
|
|
28
|
+
|
|
29
|
+
## Step 3: Implement the Change
|
|
30
|
+
|
|
31
|
+
- Write the code changes
|
|
32
|
+
- Add or update tests if applicable
|
|
33
|
+
- Follow existing code style and conventions
|
|
34
|
+
|
|
35
|
+
## Step 4: Verify
|
|
36
|
+
|
|
37
|
+
- Run tests (if a test command is available)
|
|
38
|
+
- Run linter (if configured)
|
|
39
|
+
- Fix any issues found
|
|
40
|
+
|
|
41
|
+
## Step 5: Update Plan
|
|
42
|
+
|
|
43
|
+
If `.claude/improvement-plan.md` exists:
|
|
44
|
+
- Move the completed item from "## Pending" to "## Completed"
|
|
45
|
+
- Add the commit hash and notes about what was done
|
|
46
|
+
- If you discovered new issues, add them to "## Pending"
|
|
47
|
+
|
|
48
|
+
## Step 6: Commit and Report
|
|
49
|
+
|
|
50
|
+
- Commit all changes with a descriptive message
|
|
51
|
+
- Report:
|
|
52
|
+
- What you changed and why
|
|
53
|
+
- What tests were added/updated
|
|
54
|
+
- What's next (remaining plan items or suggested improvements)
|
|
55
|
+
|
|
56
|
+
## Important Rules
|
|
57
|
+
|
|
58
|
+
- Do NOT delete files unless the deletion IS the improvement
|
|
59
|
+
- Make exactly ONE improvement per invocation
|
|
60
|
+
- If there's nothing left to improve, output: NO_MORE_IMPROVEMENTS
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Recommend and configure MCP servers based on project analysis
|
|
3
|
+
allowed-tools: Read, Write, Glob, Grep, Bash(curl:*), Bash(find:*), Bash(cat:*)
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
argument-hint: [--force]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MCP Server Setup
|
|
9
|
+
|
|
10
|
+
You are configuring MCP servers for this project. Analyze the tech stack, search the official MCP Registry, verify trust signals, and generate `.mcp.json`.
|
|
11
|
+
|
|
12
|
+
## Step 1: Analyze the Project
|
|
13
|
+
|
|
14
|
+
Understand what this project uses:
|
|
15
|
+
|
|
16
|
+
**Read existing documentation:**
|
|
17
|
+
- Read CLAUDE.md if it exists — it contains the tech stack summary
|
|
18
|
+
- Read _state.md if it exists
|
|
19
|
+
|
|
20
|
+
**Check for existing MCP config:**
|
|
21
|
+
- Read `.mcp.json` if it exists — you will merge new entries, not overwrite
|
|
22
|
+
|
|
23
|
+
**Scan manifest files:**
|
|
24
|
+
!`find . -maxdepth 3 \( -name "package.json" -o -name "pyproject.toml" -o -name "go.mod" -o -name "Cargo.toml" -o -name "Gemfile" -o -name "composer.json" -o -name "requirements.txt" \) -not -path "*/node_modules/*" -not -path "*/.venv/*" -not -path "*/vendor/*" 2>/dev/null | head -20`
|
|
25
|
+
|
|
26
|
+
**Scan framework and tooling configs:**
|
|
27
|
+
!`find . -maxdepth 2 \( -name "tsconfig*.json" -o -name "next.config.*" -o -name "vite.config.*" -o -name "docker-compose.*" -o -name "Dockerfile" -o -name ".env*" -o -name "prisma" -o -name "drizzle.config.*" \) -not -path "*/node_modules/*" 2>/dev/null | head -20`
|
|
28
|
+
|
|
29
|
+
Read the manifest files you found. Identify:
|
|
30
|
+
- Programming languages and frameworks
|
|
31
|
+
- Databases (PostgreSQL, MongoDB, Redis, etc.)
|
|
32
|
+
- Cloud services (AWS, GCP, Azure)
|
|
33
|
+
- External APIs (Stripe, Sentry, etc.)
|
|
34
|
+
- Dev tools (Docker, GitHub Actions, etc.)
|
|
35
|
+
|
|
36
|
+
## Step 2: Search the MCP Registry
|
|
37
|
+
|
|
38
|
+
Read the MCP server reference for search and evaluation guidance:
|
|
39
|
+
@~/.claude/skills/claudenv/templates/mcp-servers.md
|
|
40
|
+
|
|
41
|
+
For each major technology in the project, search the official MCP Registry API:
|
|
42
|
+
```bash
|
|
43
|
+
curl -s 'https://registry.modelcontextprotocol.io/v0.1/servers?search=<tech>&version=latest&limit=10'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For each candidate server with an npm package, verify trust by checking monthly downloads:
|
|
47
|
+
```bash
|
|
48
|
+
curl -s 'https://api.npmjs.org/downloads/point/last-month/<npm-package>'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Optionally check GitHub stars for additional trust signal:
|
|
52
|
+
```bash
|
|
53
|
+
curl -s 'https://api.github.com/repos/<owner>/<repo>'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Filtering rules:**
|
|
57
|
+
- Remove servers with <100 monthly npm downloads
|
|
58
|
+
- Rank by: npm downloads (primary) + GitHub stars (secondary) + description relevance
|
|
59
|
+
- When multiple servers exist for the same technology, pick the one with the highest downloads
|
|
60
|
+
|
|
61
|
+
## Step 3: Present Recommendations
|
|
62
|
+
|
|
63
|
+
Group your recommendations into three tiers:
|
|
64
|
+
|
|
65
|
+
**Essential** — servers that directly support the project's core technologies (e.g., PostgreSQL server for a project using PostgreSQL)
|
|
66
|
+
|
|
67
|
+
**Recommended** — servers that enhance the development workflow (e.g., Context7 for library docs, GitHub for repo management)
|
|
68
|
+
|
|
69
|
+
**Optional** — servers that could be useful but aren't critical (e.g., Fetch for web content, Docker if Docker is used occasionally)
|
|
70
|
+
|
|
71
|
+
For each recommendation, explain:
|
|
72
|
+
- **What it does** and why it's relevant to THIS project
|
|
73
|
+
- **Monthly npm downloads** (trust signal)
|
|
74
|
+
- **Environment variables required** and whether they need secrets
|
|
75
|
+
|
|
76
|
+
Ask the user which servers to configure.
|
|
77
|
+
|
|
78
|
+
If `$ARGUMENTS` includes `--force`, auto-select all Essential and Recommended servers.
|
|
79
|
+
|
|
80
|
+
## Step 4: Generate .mcp.json
|
|
81
|
+
|
|
82
|
+
Build the `.mcp.json` file with the selected servers following the format in the MCP server reference.
|
|
83
|
+
|
|
84
|
+
**If `.mcp.json` already exists:**
|
|
85
|
+
- Read it and parse the existing `mcpServers` entries
|
|
86
|
+
- Merge new servers into the existing config — do NOT remove or overwrite existing entries
|
|
87
|
+
- If a server key already exists, skip it (preserve the user's existing config)
|
|
88
|
+
|
|
89
|
+
**Key rules:**
|
|
90
|
+
- Use `${ENV_VAR}` placeholders for ALL secret environment variables — NEVER literal values
|
|
91
|
+
- Non-secret env vars can use literal values when appropriate
|
|
92
|
+
- Use `npx -y <package>@latest` for stdio/npm servers
|
|
93
|
+
- Use the `type` and `url` from remotes for HTTP/SSE servers
|
|
94
|
+
|
|
95
|
+
Write the `.mcp.json` file.
|
|
96
|
+
|
|
97
|
+
## Step 5: Update CLAUDE.md
|
|
98
|
+
|
|
99
|
+
If CLAUDE.md exists, add or update an `## MCP Servers` section listing the configured servers and what they do. Keep it concise — one line per server.
|
|
100
|
+
|
|
101
|
+
If CLAUDE.md doesn't exist, skip this step and suggest running `/claudenv` first.
|
|
102
|
+
|
|
103
|
+
## Step 6: Environment Variables
|
|
104
|
+
|
|
105
|
+
List all required environment variables and how to configure them:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
To configure secrets, run:
|
|
109
|
+
claude config set env.VAR_NAME "your-value"
|
|
110
|
+
|
|
111
|
+
Required environment variables:
|
|
112
|
+
VAR_NAME — Description of what this is and where to get it
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Remind the user that `.mcp.json` is safe to commit — it only contains placeholders, not actual secrets.
|
|
@@ -8,7 +8,9 @@ allowed-tools: Read, Write, Glob, Grep, Bash(find:*), Bash(cat:*), Bash(mkdir:*)
|
|
|
8
8
|
|
|
9
9
|
## When to auto-trigger
|
|
10
10
|
- CLAUDE.md does not exist in the project root
|
|
11
|
+
- `.mcp.json` does not exist in a project that has CLAUDE.md
|
|
11
12
|
- User mentions "documentation", "CLAUDE.md", "project setup", or "claudenv"
|
|
13
|
+
- User mentions "MCP", "MCP servers", or "mcp.json"
|
|
12
14
|
- User asks to configure Claude Code for their project
|
|
13
15
|
- After major refactoring that changes directory structure
|
|
14
16
|
|
|
@@ -26,6 +28,9 @@ When working in a project with existing documentation, watch for:
|
|
|
26
28
|
|
|
27
29
|
When changes are detected, suggest running `/update-docs`.
|
|
28
30
|
|
|
31
|
+
### MCP Configuration
|
|
32
|
+
When `.mcp.json` is missing in a project that already has CLAUDE.md, suggest running `/setup-mcp` to configure MCP servers. When the user mentions MCP servers, offer to run `/setup-mcp`.
|
|
33
|
+
|
|
29
34
|
### Validation
|
|
30
35
|
After documentation changes, run the validation script:
|
|
31
36
|
```bash
|
|
@@ -37,6 +42,9 @@ bash .claude/skills/doc-generator/scripts/validate.sh 2>&1 || true
|
|
|
37
42
|
For tech stack detection patterns, see:
|
|
38
43
|
@~/.claude/skills/claudenv/templates/detection-patterns.md
|
|
39
44
|
|
|
45
|
+
For MCP server search, evaluation, and configuration, see:
|
|
46
|
+
@~/.claude/skills/claudenv/templates/mcp-servers.md
|
|
47
|
+
|
|
40
48
|
## Project-level scaffold
|
|
41
49
|
|
|
42
50
|
The following files are available for installation into projects at `~/.claude/skills/claudenv/scaffold/`:
|
|
@@ -46,4 +54,7 @@ The following files are available for installation into projects at `~/.claude/s
|
|
|
46
54
|
- `.claude/skills/doc-generator/SKILL.md` — Per-project doc generation skill
|
|
47
55
|
- `.claude/skills/doc-generator/scripts/validate.sh` — Bash validation script
|
|
48
56
|
- `.claude/skills/doc-generator/templates/detection-patterns.md` — Detection reference
|
|
57
|
+
- `.claude/commands/setup-mcp.md` — MCP server recommendation and setup
|
|
58
|
+
- `.claude/commands/improve.md` — Single improvement iteration (used by claudenv loop)
|
|
59
|
+
- `.claude/skills/doc-generator/templates/mcp-servers.md` — MCP registry reference
|
|
49
60
|
- `.claude/agents/doc-analyzer.md` — Read-only analysis subagent
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Analyze this project and make one high-impact improvement — fix bugs, add tests, improve code quality
|
|
3
|
+
allowed-tools: Read, Write, Glob, Grep, Bash
|
|
4
|
+
argument-hint: [area-to-improve]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /improve — Single Improvement Iteration
|
|
8
|
+
|
|
9
|
+
You are an expert software engineer. Your job is to analyze this project and make one high-impact improvement.
|
|
10
|
+
|
|
11
|
+
## Step 1: Read Context
|
|
12
|
+
|
|
13
|
+
Read these files if they exist:
|
|
14
|
+
- `CLAUDE.md` — project overview and conventions
|
|
15
|
+
- `_state.md` — session memory
|
|
16
|
+
- `.claude/improvement-plan.md` — existing improvement plan (if any)
|
|
17
|
+
|
|
18
|
+
## Step 2: Choose What to Improve
|
|
19
|
+
|
|
20
|
+
**If `.claude/improvement-plan.md` exists:**
|
|
21
|
+
- Read the plan and pick the top unfinished item from the "## Pending" section
|
|
22
|
+
- If `$ARGUMENTS` is provided, use it as a focus area instead of the plan
|
|
23
|
+
|
|
24
|
+
**If no plan exists:**
|
|
25
|
+
- Analyze the project: read manifest files, scan source code, check test coverage
|
|
26
|
+
- If `$ARGUMENTS` is provided, focus on that area
|
|
27
|
+
- Identify the single highest-impact improvement you can make
|
|
28
|
+
|
|
29
|
+
## Step 3: Implement the Change
|
|
30
|
+
|
|
31
|
+
- Write the code changes
|
|
32
|
+
- Add or update tests if applicable
|
|
33
|
+
- Follow existing code style and conventions
|
|
34
|
+
|
|
35
|
+
## Step 4: Verify
|
|
36
|
+
|
|
37
|
+
- Run tests (if a test command is available)
|
|
38
|
+
- Run linter (if configured)
|
|
39
|
+
- Fix any issues found
|
|
40
|
+
|
|
41
|
+
## Step 5: Update Plan
|
|
42
|
+
|
|
43
|
+
If `.claude/improvement-plan.md` exists:
|
|
44
|
+
- Move the completed item from "## Pending" to "## Completed"
|
|
45
|
+
- Add the commit hash and notes about what was done
|
|
46
|
+
- If you discovered new issues, add them to "## Pending"
|
|
47
|
+
|
|
48
|
+
## Step 6: Commit and Report
|
|
49
|
+
|
|
50
|
+
- Commit all changes with a descriptive message
|
|
51
|
+
- Report:
|
|
52
|
+
- What you changed and why
|
|
53
|
+
- What tests were added/updated
|
|
54
|
+
- What's next (remaining plan items or suggested improvements)
|
|
55
|
+
|
|
56
|
+
## Important Rules
|
|
57
|
+
|
|
58
|
+
- Do NOT delete files unless the deletion IS the improvement
|
|
59
|
+
- Make exactly ONE improvement per invocation
|
|
60
|
+
- If there's nothing left to improve, output: NO_MORE_IMPROVEMENTS
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Recommend and configure MCP servers based on project analysis
|
|
3
|
+
allowed-tools: Read, Write, Glob, Grep, Bash(curl:*), Bash(find:*), Bash(cat:*)
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
argument-hint: [--force]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MCP Server Setup
|
|
9
|
+
|
|
10
|
+
You are configuring MCP servers for this project. Analyze the tech stack, search the official MCP Registry, verify trust signals, and generate `.mcp.json`.
|
|
11
|
+
|
|
12
|
+
## Step 1: Analyze the Project
|
|
13
|
+
|
|
14
|
+
Understand what this project uses:
|
|
15
|
+
|
|
16
|
+
**Read existing documentation:**
|
|
17
|
+
- Read CLAUDE.md if it exists — it contains the tech stack summary
|
|
18
|
+
- Read _state.md if it exists
|
|
19
|
+
|
|
20
|
+
**Check for existing MCP config:**
|
|
21
|
+
- Read `.mcp.json` if it exists — you will merge new entries, not overwrite
|
|
22
|
+
|
|
23
|
+
**Scan manifest files:**
|
|
24
|
+
!`find . -maxdepth 3 \( -name "package.json" -o -name "pyproject.toml" -o -name "go.mod" -o -name "Cargo.toml" -o -name "Gemfile" -o -name "composer.json" -o -name "requirements.txt" \) -not -path "*/node_modules/*" -not -path "*/.venv/*" -not -path "*/vendor/*" 2>/dev/null | head -20`
|
|
25
|
+
|
|
26
|
+
**Scan framework and tooling configs:**
|
|
27
|
+
!`find . -maxdepth 2 \( -name "tsconfig*.json" -o -name "next.config.*" -o -name "vite.config.*" -o -name "docker-compose.*" -o -name "Dockerfile" -o -name ".env*" -o -name "prisma" -o -name "drizzle.config.*" \) -not -path "*/node_modules/*" 2>/dev/null | head -20`
|
|
28
|
+
|
|
29
|
+
Read the manifest files you found. Identify:
|
|
30
|
+
- Programming languages and frameworks
|
|
31
|
+
- Databases (PostgreSQL, MongoDB, Redis, etc.)
|
|
32
|
+
- Cloud services (AWS, GCP, Azure)
|
|
33
|
+
- External APIs (Stripe, Sentry, etc.)
|
|
34
|
+
- Dev tools (Docker, GitHub Actions, etc.)
|
|
35
|
+
|
|
36
|
+
## Step 2: Search the MCP Registry
|
|
37
|
+
|
|
38
|
+
Read the MCP server reference for search and evaluation guidance:
|
|
39
|
+
@.claude/skills/doc-generator/templates/mcp-servers.md
|
|
40
|
+
|
|
41
|
+
For each major technology in the project, search the official MCP Registry API:
|
|
42
|
+
```bash
|
|
43
|
+
curl -s 'https://registry.modelcontextprotocol.io/v0.1/servers?search=<tech>&version=latest&limit=10'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For each candidate server with an npm package, verify trust by checking monthly downloads:
|
|
47
|
+
```bash
|
|
48
|
+
curl -s 'https://api.npmjs.org/downloads/point/last-month/<npm-package>'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Optionally check GitHub stars for additional trust signal:
|
|
52
|
+
```bash
|
|
53
|
+
curl -s 'https://api.github.com/repos/<owner>/<repo>'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Filtering rules:**
|
|
57
|
+
- Remove servers with <100 monthly npm downloads
|
|
58
|
+
- Rank by: npm downloads (primary) + GitHub stars (secondary) + description relevance
|
|
59
|
+
- When multiple servers exist for the same technology, pick the one with the highest downloads
|
|
60
|
+
|
|
61
|
+
## Step 3: Present Recommendations
|
|
62
|
+
|
|
63
|
+
Group your recommendations into three tiers:
|
|
64
|
+
|
|
65
|
+
**Essential** — servers that directly support the project's core technologies (e.g., PostgreSQL server for a project using PostgreSQL)
|
|
66
|
+
|
|
67
|
+
**Recommended** — servers that enhance the development workflow (e.g., Context7 for library docs, GitHub for repo management)
|
|
68
|
+
|
|
69
|
+
**Optional** — servers that could be useful but aren't critical (e.g., Fetch for web content, Docker if Docker is used occasionally)
|
|
70
|
+
|
|
71
|
+
For each recommendation, explain:
|
|
72
|
+
- **What it does** and why it's relevant to THIS project
|
|
73
|
+
- **Monthly npm downloads** (trust signal)
|
|
74
|
+
- **Environment variables required** and whether they need secrets
|
|
75
|
+
|
|
76
|
+
Ask the user which servers to configure.
|
|
77
|
+
|
|
78
|
+
If `$ARGUMENTS` includes `--force`, auto-select all Essential and Recommended servers.
|
|
79
|
+
|
|
80
|
+
## Step 4: Generate .mcp.json
|
|
81
|
+
|
|
82
|
+
Build the `.mcp.json` file with the selected servers following the format in the MCP server reference.
|
|
83
|
+
|
|
84
|
+
**If `.mcp.json` already exists:**
|
|
85
|
+
- Read it and parse the existing `mcpServers` entries
|
|
86
|
+
- Merge new servers into the existing config — do NOT remove or overwrite existing entries
|
|
87
|
+
- If a server key already exists, skip it (preserve the user's existing config)
|
|
88
|
+
|
|
89
|
+
**Key rules:**
|
|
90
|
+
- Use `${ENV_VAR}` placeholders for ALL secret environment variables — NEVER literal values
|
|
91
|
+
- Non-secret env vars can use literal values when appropriate
|
|
92
|
+
- Use `npx -y <package>@latest` for stdio/npm servers
|
|
93
|
+
- Use the `type` and `url` from remotes for HTTP/SSE servers
|
|
94
|
+
|
|
95
|
+
Write the `.mcp.json` file.
|
|
96
|
+
|
|
97
|
+
## Step 5: Update CLAUDE.md
|
|
98
|
+
|
|
99
|
+
If CLAUDE.md exists, add or update an `## MCP Servers` section listing the configured servers and what they do. Keep it concise — one line per server.
|
|
100
|
+
|
|
101
|
+
If CLAUDE.md doesn't exist, skip this step and suggest running `/claudenv` first.
|
|
102
|
+
|
|
103
|
+
## Step 6: Environment Variables
|
|
104
|
+
|
|
105
|
+
List all required environment variables and how to configure them:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
To configure secrets, run:
|
|
109
|
+
claude config set env.VAR_NAME "your-value"
|
|
110
|
+
|
|
111
|
+
Required environment variables:
|
|
112
|
+
VAR_NAME — Description of what this is and where to get it
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Remind the user that `.mcp.json` is safe to commit — it only contains placeholders, not actual secrets.
|
|
@@ -34,6 +34,7 @@ Compare the current state against the existing documentation:
|
|
|
34
34
|
- **New directories** not covered in Architecture section
|
|
35
35
|
- **Stale references** to files or directories that no longer exist
|
|
36
36
|
- **Missing conventions** based on new config files (e.g., new linter added)
|
|
37
|
+
- **Missing or outdated `.mcp.json`** — if `.mcp.json` doesn't exist, or if new technologies have been added that could benefit from MCP servers, suggest running `/setup-mcp`
|
|
37
38
|
|
|
38
39
|
## Step 4: Propose Updates
|
|
39
40
|
|
package/scaffold/global/.claude/skills/claudenv/scaffold/.claude/skills/doc-generator/SKILL.md
CHANGED
|
@@ -12,6 +12,7 @@ allowed-tools: Read, Write, Glob, Grep, Bash(find:*), Bash(cat:*), Bash(node:*)
|
|
|
12
12
|
- New files detected that change the tech stack (new framework, test runner, etc.)
|
|
13
13
|
- After major refactoring that changes directory structure
|
|
14
14
|
- When CLAUDE.md references files or directories that no longer exist
|
|
15
|
+
- When `.mcp.json` is missing and the project has significant external dependencies
|
|
15
16
|
|
|
16
17
|
## Process
|
|
17
18
|
|
|
@@ -28,6 +29,7 @@ If CLAUDE.md already exists, read it and identify:
|
|
|
28
29
|
|
|
29
30
|
### 3. Generate or Update
|
|
30
31
|
- For new documentation: generate CLAUDE.md, _state.md, .claude/rules/code-style.md, .claude/rules/testing.md, .claude/rules/workflow.md
|
|
32
|
+
- For MCP configuration: suggest running `/setup-mcp` to search the MCP Registry and generate `.mcp.json`
|
|
31
33
|
- For updates: propose specific changes and wait for user approval
|
|
32
34
|
- Always present generated content for review before writing
|
|
33
35
|
- NEVER create .md files beyond the ones listed above unless the user explicitly asks
|
|
@@ -54,3 +56,4 @@ Generated CLAUDE.md should follow this structure:
|
|
|
54
56
|
Additionally generate:
|
|
55
57
|
- `_state.md` — project state tracking (decisions, focus, known issues)
|
|
56
58
|
- `.claude/rules/workflow.md` — Claude Code workflow best practices
|
|
59
|
+
- `.mcp.json` — MCP server configuration (via `/setup-mcp`)
|