Xinqi Bao's Git

feat(claude): add xdev workflow configuration
[dotfiles.git] / claude / commands / xdev-setup.md
1 Analyze the current project and generate a health report. Then guide
2 the user through setting up CLAUDE.md if one doesn't exist.
3
4 ## Step 1: Project Analysis
5
6 Scan the project root and report findings for each quality dimension.
7 Do not assume any specific language or toolchain.
8
9 ### Build System
10 Detect build files: CMakeLists.txt, Makefile, meson.build, package.json,
11 pyproject.toml, setup.py, Cargo.toml, go.mod, build.gradle, pom.xml,
12 or other build configuration.
13 Report what was found, or note "no build system detected".
14
15 ### Testing
16 Detect test directories: tests/, test/, __tests__/, spec/, or test
17 files matching common patterns (*_test.*, test_*.*, *.spec.*, *_spec.*).
18 Detect test runner config: pytest.ini, jest.config.*, .mocharc.*,
19 CTestTestfile.cmake, Catch2/GoogleTest headers, etc.
20 Report what was found.
21
22 ### Code Quality Tools
23 Detect formatter/linter config: .clang-format, .clang-tidy, .eslintrc*,
24 .prettierrc*, pyproject.toml [tool.ruff/black/flake8], rustfmt.toml,
25 .editorconfig, .golangci.yml, or similar.
26 Detect git hooks: .pre-commit-config.yaml, .husky/, .githooks/.
27 Report what was found.
28
29 ### CI/CD
30 Detect: .github/workflows/, .gitlab-ci.yml, Jenkinsfile, .circleci/,
31 .travis.yml, bitbucket-pipelines.yml, or similar.
32 Report what was found.
33
34 ### Documentation
35 Check: README.md and CLAUDE.md existence. If they exist, note whether
36 they have meaningful content beyond just a title.
37
38 ## Step 2: Report
39
40 Present findings as a concise checklist:
41
42 ```
43 Project Health Report: <project-name>
44 Build system: ✓ CMake (CMakeLists.txt)
45 Tests: ✓ tests/ directory, GoogleTest
46 Code quality: ✓ .clang-format, .clang-tidy, pre-commit
47 CI/CD: ✗ No CI configuration found
48 README: ✓ Exists with content
49 CLAUDE.md: ✗ Missing
50 ```
51
52 For each ✗ item, provide a brief, actionable suggestion.
53 Do NOT mandate specific tools — suggest based on what fits the project.
54
55 ## Step 3: CLAUDE.md Creation (if missing or inadequate)
56
57 If CLAUDE.md doesn't exist or is just a placeholder, guide the user:
58
59 1. Ask about the project's purpose (one sentence).
60 2. Document detected build/test commands.
61 3. Ask about key code conventions or architectural constraints.
62 4. Generate a minimal CLAUDE.md (under 50 lines) following this structure:
63
64 ```markdown
65 # <Project Name>
66
67 <One-sentence project description.>
68
69 ## Quick Reference
70
71 \```bash
72 # Build
73 <build command>
74
75 # Test
76 <test command>
77 \```
78
79 ## Code Conventions
80
81 - <Convention 1>
82 - <Convention 2>
83
84 ## Constraints
85
86 - <Things Claude should NOT do>
87 - <Protected files/directories>
88 - <Dependency rules>
89 ```
90
91 Do NOT over-generate. A 20-line CLAUDE.md with accurate info is better
92 than a 100-line one with guesses.
93
94 ## Step 4: Hooks Suggestion (optional)
95
96 If a code formatter is detected, suggest a PostToolUse hook configuration
97 that auto-formats after edits. Present the suggestion and let the user
98 decide whether to add it to `.claude/settings.local.json`.