Initial commit
This commit is contained in:
116
commands/setup-claude-md.md
Normal file
116
commands/setup-claude-md.md
Normal file
@@ -0,0 +1,116 @@
|
||||
---
|
||||
name: setup-claude-md
|
||||
description: Generate or update a minimal CLAUDE.md with project guidelines and structure
|
||||
---
|
||||
|
||||
Generate or update a minimal CLAUDE.md with project structure, guidelines, and quality checks.
|
||||
|
||||
## Step 1: Check if CLAUDE.md Exists
|
||||
|
||||
If `CLAUDE.md` exists:
|
||||
- Read the existing file
|
||||
- Preserve custom sections the user may have added
|
||||
- Update the structure, quality checks, and organization rules
|
||||
|
||||
If `CLAUDE.md` does NOT exist:
|
||||
- Create a new one from scratch
|
||||
|
||||
## Step 2: Analyze Project (Use Explore Agents in Parallel)
|
||||
|
||||
Spawn parallel Explore agents to understand the codebase:
|
||||
|
||||
1. **Project Purpose Agent**: Analyze README, package.json description, main files to understand what the project does
|
||||
2. **Directory Structure Agent**: Map out the folder structure and what each folder contains
|
||||
3. **Tech Stack Agent**: Identify languages, frameworks, tools, dependencies
|
||||
|
||||
Wait for all agents to complete, then synthesize the information.
|
||||
|
||||
## Step 3: Detect Project Type & Commands
|
||||
|
||||
Check for config files:
|
||||
- `package.json` → JavaScript/TypeScript (extract lint, typecheck, server scripts)
|
||||
- `pyproject.toml` or `requirements.txt` → Python
|
||||
- `go.mod` → Go
|
||||
- `Cargo.toml` → Rust
|
||||
|
||||
Extract:
|
||||
- Linting commands
|
||||
- Typechecking commands
|
||||
- Server start command (if applicable)
|
||||
|
||||
## Step 4: Generate Project Tree
|
||||
|
||||
Create a concise tree structure showing key directories and files with brief descriptions.
|
||||
|
||||
Example format:
|
||||
```
|
||||
src/
|
||||
├── api/ # API endpoints and routes
|
||||
├── components/ # Reusable UI components
|
||||
├── utils/ # Helper functions and utilities
|
||||
├── types/ # TypeScript type definitions
|
||||
└── main.ts # Application entry point
|
||||
```
|
||||
|
||||
## Step 5: Generate or Update CLAUDE.md
|
||||
|
||||
Create `CLAUDE.md` with this structure:
|
||||
|
||||
```markdown
|
||||
# [Project Name]
|
||||
|
||||
[Brief 1-2 sentence description of what this project does]
|
||||
|
||||
## Project Structure
|
||||
|
||||
[INSERT TREE HERE]
|
||||
|
||||
## Organization Rules
|
||||
|
||||
**Keep code organized and modularized:**
|
||||
- API routes → `/api` folder, one file per route/resource
|
||||
- Components → `/components`, one component per file
|
||||
- Utilities → `/utils`, grouped by functionality
|
||||
- Types/Interfaces → `/types` or co-located with usage
|
||||
- Tests → Next to the code they test or in `/tests`
|
||||
|
||||
**Modularity principles:**
|
||||
- Single responsibility per file
|
||||
- Clear, descriptive file names
|
||||
- Group related functionality together
|
||||
- Avoid monolithic files
|
||||
|
||||
## Code Quality - Zero Tolerance
|
||||
|
||||
After editing ANY file, run:
|
||||
|
||||
```bash
|
||||
[EXACT COMMANDS FROM PROJECT]
|
||||
```
|
||||
|
||||
Fix ALL errors/warnings before continuing.
|
||||
|
||||
[IF SERVER EXISTS:]
|
||||
If changes require server restart (not hot-reloadable):
|
||||
1. Restart server: `[SERVER COMMAND]`
|
||||
2. Read server output/logs
|
||||
3. Fix ALL warnings/errors before continuing
|
||||
```
|
||||
|
||||
**Keep total file under 100 lines.**
|
||||
|
||||
## Step 6: Preserve Custom Sections
|
||||
|
||||
If updating an existing CLAUDE.md:
|
||||
- Keep any custom sections the user added
|
||||
- Update the generated sections (Project Structure, Quality Checks)
|
||||
- Merge carefully without losing user content
|
||||
|
||||
## Step 7: Confirm Completion
|
||||
|
||||
Tell the user:
|
||||
- ✅ CLAUDE.md [created/updated]
|
||||
- 📋 Project: [brief description]
|
||||
- 🗂️ Structure mapped with [X] directories
|
||||
- 📐 Organization rules enforced
|
||||
- 🎯 Zero-tolerance quality checks active
|
||||
168
commands/setup-code-quality.md
Normal file
168
commands/setup-code-quality.md
Normal file
@@ -0,0 +1,168 @@
|
||||
---
|
||||
name: setup-code-quality
|
||||
description: Detect project tools and generate a /check command for linting and typechecking
|
||||
---
|
||||
|
||||
You are setting up a project for automated code quality checks. Follow these steps carefully:
|
||||
|
||||
## Step 1: Detect Project Type
|
||||
|
||||
Check for these files in the current directory to determine the project type:
|
||||
- `package.json` → JavaScript/TypeScript (Node.js)
|
||||
- `pyproject.toml` or `requirements.txt` or `setup.py` → Python
|
||||
- `go.mod` → Go
|
||||
- `Cargo.toml` → Rust
|
||||
- `composer.json` → PHP
|
||||
- `build.gradle` or `pom.xml` → Java
|
||||
|
||||
Read the relevant config file to understand the project structure.
|
||||
|
||||
## Step 2: Check Existing Tools
|
||||
|
||||
Based on the project type, check if these tools are already configured:
|
||||
|
||||
### JavaScript/TypeScript:
|
||||
- Check `package.json` for: `eslint`, `prettier`, `typescript`, `@typescript-eslint/*`
|
||||
- Check for config files: `.eslintrc.*`, `.prettierrc.*`, `tsconfig.json`
|
||||
- Check `package.json` scripts for: `lint`, `typecheck`, `type-check`, or `tsc`
|
||||
|
||||
### Python:
|
||||
- Check for: `mypy`, `pylint`, `black`, `ruff`, `flake8` in dependencies
|
||||
- Check for config files: `mypy.ini`, `.pylintrc`, `pyproject.toml`
|
||||
- Look for linting/type checking configurations
|
||||
|
||||
### Go:
|
||||
- Check for: `golint`, `gofmt`, `staticcheck`
|
||||
- Go has built-in tools, check if project uses them
|
||||
|
||||
### Rust:
|
||||
- Check for: `clippy`, `rustfmt` (built-in to Rust toolchain)
|
||||
- Check `Cargo.toml` for workspace configuration
|
||||
|
||||
## Step 3: Install Missing Tools (if needed)
|
||||
|
||||
If tools are missing, install them based on the project type:
|
||||
|
||||
### JavaScript/TypeScript:
|
||||
```bash
|
||||
# Detect package manager (npm, yarn, pnpm, bun)
|
||||
# Install missing tools, e.g.:
|
||||
npm install --save-dev eslint prettier typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin
|
||||
|
||||
# Add scripts to package.json if missing:
|
||||
# "lint": "eslint ."
|
||||
# "typecheck": "tsc --noEmit"
|
||||
```
|
||||
|
||||
### Python:
|
||||
```bash
|
||||
pip install mypy pylint black ruff
|
||||
# or add to requirements-dev.txt / pyproject.toml
|
||||
```
|
||||
|
||||
### Go:
|
||||
```bash
|
||||
go install golang.org/x/lint/golint@latest
|
||||
go install honnef.co/go/tools/cmd/staticcheck@latest
|
||||
```
|
||||
|
||||
### Rust:
|
||||
```bash
|
||||
rustup component add clippy rustfmt
|
||||
```
|
||||
|
||||
**IMPORTANT**: Always check if tools exist first. Only install if missing.
|
||||
|
||||
## Step 4: Generate /fix Command
|
||||
|
||||
Create a file at `.claude/commands/fix.md` with the following structure:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: fix
|
||||
description: Run typechecking and linting, then spawn parallel agents to fix all issues
|
||||
---
|
||||
|
||||
# Project Code Quality Check
|
||||
|
||||
This command runs all linting and typechecking tools for this project, collects errors, groups them by domain, and spawns parallel agents to fix them.
|
||||
|
||||
## Step 1: Run Linting and Typechecking
|
||||
|
||||
Run the appropriate commands for this project:
|
||||
|
||||
[INSERT PROJECT-SPECIFIC COMMANDS HERE]
|
||||
|
||||
## Step 2: Collect and Parse Errors
|
||||
|
||||
Parse the output from the linting and typechecking commands. Group errors by domain:
|
||||
- **Type errors**: Issues from TypeScript, mypy, etc.
|
||||
- **Lint errors**: Issues from eslint, pylint, ruff, clippy, etc.
|
||||
- **Format errors**: Issues from prettier, black, rustfmt, gofmt
|
||||
|
||||
Create a list of all files with issues and the specific problems in each file.
|
||||
|
||||
## Step 3: Spawn Parallel Agents
|
||||
|
||||
For each domain that has issues, spawn an agent in parallel using the Task tool:
|
||||
|
||||
**IMPORTANT**: Use a SINGLE response with MULTIPLE Task tool calls to run agents in parallel.
|
||||
|
||||
Example:
|
||||
- Spawn a "type-fixer" agent for type errors
|
||||
- Spawn a "lint-fixer" agent for lint errors
|
||||
- Spawn a "format-fixer" agent for formatting errors
|
||||
|
||||
Each agent should:
|
||||
1. Receive the list of files and specific errors in their domain
|
||||
2. Fix all errors in their domain
|
||||
3. Run the relevant check command to verify fixes
|
||||
4. Report completion
|
||||
|
||||
## Step 4: Verify All Fixes
|
||||
|
||||
After all agents complete, run the full check again to ensure all issues are resolved.
|
||||
```
|
||||
|
||||
**Replace `[INSERT PROJECT-SPECIFIC COMMANDS HERE]` with the actual commands for the detected project type.**
|
||||
|
||||
### JavaScript/TypeScript Example:
|
||||
```bash
|
||||
npm run lint
|
||||
npm run typecheck
|
||||
```
|
||||
|
||||
### Python Example:
|
||||
```bash
|
||||
mypy .
|
||||
pylint src/
|
||||
black --check .
|
||||
```
|
||||
|
||||
### Go Example:
|
||||
```bash
|
||||
go vet ./...
|
||||
staticcheck ./...
|
||||
gofmt -l .
|
||||
```
|
||||
|
||||
### Rust Example:
|
||||
```bash
|
||||
cargo clippy -- -D warnings
|
||||
cargo fmt -- --check
|
||||
```
|
||||
|
||||
## Step 5: Confirm Completion
|
||||
|
||||
After generating the `/fix` command, inform the user:
|
||||
1. What project type was detected
|
||||
2. Which tools were already present
|
||||
3. Which tools were installed (if any)
|
||||
4. That the `/fix` command has been created at `.claude/commands/fix.md`
|
||||
5. How to use it: "Run `/fix` to lint, typecheck, and auto-fix all issues"
|
||||
|
||||
**Important Notes**:
|
||||
- Always create the `.claude/commands/` directory if it doesn't exist
|
||||
- Ensure the YAML frontmatter includes both `name` and `description`
|
||||
- The generated `/fix` command must spawn agents in parallel (single response, multiple Task tool calls)
|
||||
- Tailor the commands to what's actually available in the project
|
||||
51
commands/setup-commits.md
Normal file
51
commands/setup-commits.md
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
name: setup-commits
|
||||
description: Generate a /commit command that runs checks, then commits with AI-generated messages
|
||||
---
|
||||
|
||||
Generate a minimal `/commit` command that enforces quality checks before committing.
|
||||
|
||||
## Step 1: Detect Project and Extract Commands
|
||||
|
||||
Check for config files:
|
||||
- `package.json` → Extract `lint`, `typecheck` scripts
|
||||
- `pyproject.toml` → Use `mypy`, `pylint`
|
||||
- `go.mod` → Use `go vet ./...`, `gofmt -l .`
|
||||
- `Cargo.toml` → Use `cargo clippy`, `cargo fmt --check`
|
||||
|
||||
## Step 2: Generate /commit Command
|
||||
|
||||
Create `.claude/commands/commit.md`:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: commit
|
||||
description: Run checks, commit with AI message, and push
|
||||
---
|
||||
|
||||
1. Run quality checks:
|
||||
```bash
|
||||
[PROJECT COMMANDS]
|
||||
```
|
||||
Fix ALL errors before continuing.
|
||||
|
||||
2. Review changes: `git status` and `git diff`
|
||||
|
||||
3. Generate commit message:
|
||||
- Start with verb (Add/Update/Fix/Remove/Refactor)
|
||||
- Be specific and concise
|
||||
- One line preferred
|
||||
|
||||
4. Commit and push:
|
||||
```bash
|
||||
git add -A
|
||||
git commit -m "your generated message"
|
||||
git push
|
||||
```
|
||||
```
|
||||
|
||||
**Keep it under 20 lines.**
|
||||
|
||||
## Step 3: Confirm
|
||||
|
||||
Tell user: ✅ `/commit` created. Quality checks + AI commits + auto-push enabled.
|
||||
237
commands/setup-updates.md
Normal file
237
commands/setup-updates.md
Normal file
@@ -0,0 +1,237 @@
|
||||
---
|
||||
name: setup-updates
|
||||
description: Generate a /update-app command for dependency updates and deprecation fixes
|
||||
---
|
||||
|
||||
Generate a minimal `/update-app` command that updates dependencies and fixes deprecations.
|
||||
|
||||
## Step 1: Detect Project Type
|
||||
|
||||
Check for config files:
|
||||
- `package.json` → JavaScript/TypeScript (npm/yarn/pnpm/bun)
|
||||
- `pyproject.toml` or `requirements.txt` → Python (pip/poetry)
|
||||
- `go.mod` → Go
|
||||
- `Cargo.toml` → Rust
|
||||
- `composer.json` → PHP
|
||||
|
||||
## Step 2: Detect Package Manager
|
||||
|
||||
**For JavaScript/TypeScript**: Check for lock files:
|
||||
- `package-lock.json` → npm
|
||||
- `yarn.lock` → yarn
|
||||
- `pnpm-lock.yaml` → pnpm
|
||||
- `bun.lockb` → bun
|
||||
|
||||
**For Python**: Check for:
|
||||
- `poetry.lock` → poetry
|
||||
- Otherwise → pip
|
||||
|
||||
## Step 3: Generate /update-app Command
|
||||
|
||||
Create `.claude/commands/update-app.md`:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: update-app
|
||||
description: Update dependencies, fix deprecations and warnings
|
||||
---
|
||||
|
||||
# Dependency Update & Deprecation Fix
|
||||
|
||||
## Step 1: Check for Updates
|
||||
|
||||
[INSERT CHECK COMMAND]
|
||||
|
||||
## Step 2: Update Dependencies
|
||||
|
||||
[INSERT UPDATE COMMAND]
|
||||
|
||||
## Step 3: Check for Deprecations & Warnings
|
||||
|
||||
Run installation and check output:
|
||||
[INSERT INSTALL COMMAND]
|
||||
|
||||
Read ALL output carefully. Look for:
|
||||
- Deprecation warnings
|
||||
- Security vulnerabilities
|
||||
- Peer dependency warnings
|
||||
- Breaking changes
|
||||
|
||||
## Step 4: Fix Issues
|
||||
|
||||
For each warning/deprecation:
|
||||
1. Research the recommended replacement or fix
|
||||
2. Update code/dependencies accordingly
|
||||
3. Re-run installation
|
||||
4. Verify no warnings remain
|
||||
|
||||
## Step 5: Run Quality Checks
|
||||
|
||||
[INSERT QUALITY CHECK COMMANDS]
|
||||
|
||||
Fix all errors before completing.
|
||||
|
||||
## Step 6: Verify Clean Install
|
||||
|
||||
Ensure a fresh install works:
|
||||
1. Delete dependency folders/caches
|
||||
2. Run clean install
|
||||
3. Verify ZERO warnings/errors
|
||||
4. Confirm all dependencies resolve correctly
|
||||
```
|
||||
|
||||
## Step 4: Customize by Project Type
|
||||
|
||||
**Replace placeholders with actual commands:**
|
||||
|
||||
### JavaScript/TypeScript (npm):
|
||||
```markdown
|
||||
## Step 1: Check for Updates
|
||||
```bash
|
||||
npm outdated
|
||||
```
|
||||
|
||||
## Step 2: Update Dependencies
|
||||
```bash
|
||||
npm update
|
||||
npm audit fix
|
||||
```
|
||||
|
||||
## Step 3: Check for Deprecations & Warnings
|
||||
```bash
|
||||
rm -rf node_modules package-lock.json
|
||||
npm install
|
||||
```
|
||||
|
||||
## Step 5: Run Quality Checks
|
||||
```bash
|
||||
npm run lint
|
||||
npm run typecheck
|
||||
```
|
||||
|
||||
## Step 6: Verify Clean Install
|
||||
```bash
|
||||
rm -rf node_modules package-lock.json
|
||||
npm install
|
||||
```
|
||||
```
|
||||
|
||||
### JavaScript/TypeScript (yarn):
|
||||
```markdown
|
||||
## Step 1: Check for Updates
|
||||
```bash
|
||||
yarn outdated
|
||||
```
|
||||
|
||||
## Step 2: Update Dependencies
|
||||
```bash
|
||||
yarn upgrade
|
||||
yarn audit
|
||||
```
|
||||
|
||||
## Step 3: Check for Deprecations & Warnings
|
||||
```bash
|
||||
rm -rf node_modules yarn.lock
|
||||
yarn install
|
||||
```
|
||||
```
|
||||
|
||||
### Python (pip):
|
||||
```markdown
|
||||
## Step 1: Check for Updates
|
||||
```bash
|
||||
pip list --outdated
|
||||
```
|
||||
|
||||
## Step 2: Update Dependencies
|
||||
```bash
|
||||
pip install --upgrade -r requirements.txt
|
||||
```
|
||||
|
||||
## Step 3: Check for Deprecations & Warnings
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Step 5: Run Quality Checks
|
||||
```bash
|
||||
mypy .
|
||||
pylint src/
|
||||
```
|
||||
```
|
||||
|
||||
### Python (poetry):
|
||||
```markdown
|
||||
## Step 1: Check for Updates
|
||||
```bash
|
||||
poetry show --outdated
|
||||
```
|
||||
|
||||
## Step 2: Update Dependencies
|
||||
```bash
|
||||
poetry update
|
||||
```
|
||||
|
||||
## Step 3: Check for Deprecations & Warnings
|
||||
```bash
|
||||
poetry install
|
||||
```
|
||||
```
|
||||
|
||||
### Go:
|
||||
```markdown
|
||||
## Step 1: Check for Updates
|
||||
```bash
|
||||
go list -u -m all
|
||||
```
|
||||
|
||||
## Step 2: Update Dependencies
|
||||
```bash
|
||||
go get -u ./...
|
||||
go mod tidy
|
||||
```
|
||||
|
||||
## Step 3: Check for Deprecations & Warnings
|
||||
```bash
|
||||
go mod download
|
||||
```
|
||||
|
||||
## Step 5: Run Quality Checks
|
||||
```bash
|
||||
go vet ./...
|
||||
gofmt -l .
|
||||
```
|
||||
```
|
||||
|
||||
### Rust:
|
||||
```markdown
|
||||
## Step 1: Check for Updates
|
||||
```bash
|
||||
cargo outdated
|
||||
```
|
||||
|
||||
## Step 2: Update Dependencies
|
||||
```bash
|
||||
cargo update
|
||||
```
|
||||
|
||||
## Step 3: Check for Deprecations & Warnings
|
||||
```bash
|
||||
cargo check
|
||||
```
|
||||
|
||||
## Step 5: Run Quality Checks
|
||||
```bash
|
||||
cargo clippy
|
||||
cargo fmt --check
|
||||
```
|
||||
```
|
||||
|
||||
## Step 5: Confirm Completion
|
||||
|
||||
Tell the user:
|
||||
- ✅ `/update-app` created
|
||||
- 🔄 Updates: [package manager commands]
|
||||
- ⚠️ Zero-tolerance for deprecations/warnings
|
||||
- 🛡️ Security audit included
|
||||
- ✨ Clean install verification enabled
|
||||
Reference in New Issue
Block a user