@cregis-dev/cckit 0.5.0 → 0.6.2
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 +221 -215
- package/package.json +54 -53
- package/registry.json +116 -92
- package/src/cli.js +2 -2
- package/src/commands/init.js +1 -1
- package/src/commands/update.js +1 -1
- package/src/steps/configure-user.js +23 -8
- package/src/steps/install-rules.js +11 -52
- package/templates/rules/README.md +103 -0
- package/templates/rules/common/agents.md +49 -0
- package/templates/rules/common/coding-style.md +48 -0
- package/templates/rules/common/development-workflow.md +37 -0
- package/templates/rules/common/git-workflow.md +24 -0
- package/templates/rules/common/hooks.md +30 -0
- package/templates/rules/common/patterns.md +31 -0
- package/templates/rules/common/performance.md +55 -0
- package/templates/rules/common/security.md +29 -0
- package/templates/rules/common/testing.md +29 -0
- package/templates/rules/golang/coding-style.md +32 -0
- package/templates/rules/golang/hooks.md +17 -0
- package/templates/rules/golang/patterns.md +45 -0
- package/templates/rules/golang/security.md +34 -0
- package/templates/rules/golang/testing.md +31 -0
- package/templates/rules/python/coding-style.md +42 -0
- package/templates/rules/python/hooks.md +19 -0
- package/templates/rules/python/patterns.md +39 -0
- package/templates/rules/python/security.md +30 -0
- package/templates/rules/python/testing.md +38 -0
- package/templates/rules/swift/coding-style.md +47 -0
- package/templates/rules/swift/hooks.md +20 -0
- package/templates/rules/swift/patterns.md +66 -0
- package/templates/rules/swift/security.md +33 -0
- package/templates/rules/swift/testing.md +45 -0
- package/templates/rules/typescript/coding-style.md +65 -0
- package/templates/rules/typescript/hooks.md +22 -0
- package/templates/rules/typescript/patterns.md +52 -0
- package/templates/rules/typescript/security.md +28 -0
- package/templates/rules/typescript/testing.md +18 -0
package/registry.json
CHANGED
|
@@ -1,92 +1,116 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "2.0.0",
|
|
3
|
-
"plugins": {
|
|
4
|
-
"everything-claude-code": {
|
|
5
|
-
"name": "Everything Claude Code",
|
|
6
|
-
"marketplace": "everything-claude-code",
|
|
7
|
-
"marketplaceSource": {
|
|
8
|
-
"source": "github",
|
|
9
|
-
"repo": "affaan-m/everything-claude-code"
|
|
10
|
-
},
|
|
11
|
-
"default": true,
|
|
12
|
-
"description": "Rules, agents, commands, skills, and hooks for Claude Code"
|
|
13
|
-
},
|
|
14
|
-
"superpowers": {
|
|
15
|
-
"name": "Superpowers",
|
|
16
|
-
"marketplace": "claude-plugins-official",
|
|
17
|
-
"default": true,
|
|
18
|
-
"description": "Structured workflows with brainstorming, debugging, TDD, and code review skills"
|
|
19
|
-
},
|
|
20
|
-
"claude-code-setup": {
|
|
21
|
-
"name": "Claude Code Setup",
|
|
22
|
-
"marketplace": "claude-plugins-official",
|
|
23
|
-
"default": true,
|
|
24
|
-
"description": "Analyze codebases and recommend Claude Code automations, audit and improve CLAUDE.md files"
|
|
25
|
-
},
|
|
26
|
-
"claude-md-management": {
|
|
27
|
-
"name": "Claude MD Management",
|
|
28
|
-
"marketplace": "claude-plugins-official",
|
|
29
|
-
"default": true,
|
|
30
|
-
"description": "Audit, improve, and update CLAUDE.md documentation files"
|
|
31
|
-
},
|
|
32
|
-
"code-simplifier": {
|
|
33
|
-
"name": "Code Simplifier",
|
|
34
|
-
"marketplace": "claude-plugins-official",
|
|
35
|
-
"default": true,
|
|
36
|
-
"description": "Simplify and refine code for clarity, consistency, and maintainability"
|
|
37
|
-
},
|
|
38
|
-
"commit-commands": {
|
|
39
|
-
"name": "Commit Commands",
|
|
40
|
-
"marketplace": "claude-plugins-official",
|
|
41
|
-
"default": true,
|
|
42
|
-
"description": "Git commit workflows: commit, push, PR creation, and branch cleanup"
|
|
43
|
-
},
|
|
44
|
-
"firecrawl": {
|
|
45
|
-
"name": "Firecrawl",
|
|
46
|
-
"marketplace": "claude-plugins-official",
|
|
47
|
-
"default": true,
|
|
48
|
-
"description": "Web scraping, search, and skill generation using Firecrawl"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"rules": {
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"plugins": {
|
|
4
|
+
"everything-claude-code": {
|
|
5
|
+
"name": "Everything Claude Code",
|
|
6
|
+
"marketplace": "everything-claude-code",
|
|
7
|
+
"marketplaceSource": {
|
|
8
|
+
"source": "github",
|
|
9
|
+
"repo": "affaan-m/everything-claude-code"
|
|
10
|
+
},
|
|
11
|
+
"default": true,
|
|
12
|
+
"description": "Rules, agents, commands, skills, and hooks for Claude Code"
|
|
13
|
+
},
|
|
14
|
+
"superpowers": {
|
|
15
|
+
"name": "Superpowers",
|
|
16
|
+
"marketplace": "claude-plugins-official",
|
|
17
|
+
"default": true,
|
|
18
|
+
"description": "Structured workflows with brainstorming, debugging, TDD, and code review skills"
|
|
19
|
+
},
|
|
20
|
+
"claude-code-setup": {
|
|
21
|
+
"name": "Claude Code Setup",
|
|
22
|
+
"marketplace": "claude-plugins-official",
|
|
23
|
+
"default": true,
|
|
24
|
+
"description": "Analyze codebases and recommend Claude Code automations, audit and improve CLAUDE.md files"
|
|
25
|
+
},
|
|
26
|
+
"claude-md-management": {
|
|
27
|
+
"name": "Claude MD Management",
|
|
28
|
+
"marketplace": "claude-plugins-official",
|
|
29
|
+
"default": true,
|
|
30
|
+
"description": "Audit, improve, and update CLAUDE.md documentation files"
|
|
31
|
+
},
|
|
32
|
+
"code-simplifier": {
|
|
33
|
+
"name": "Code Simplifier",
|
|
34
|
+
"marketplace": "claude-plugins-official",
|
|
35
|
+
"default": true,
|
|
36
|
+
"description": "Simplify and refine code for clarity, consistency, and maintainability"
|
|
37
|
+
},
|
|
38
|
+
"commit-commands": {
|
|
39
|
+
"name": "Commit Commands",
|
|
40
|
+
"marketplace": "claude-plugins-official",
|
|
41
|
+
"default": true,
|
|
42
|
+
"description": "Git commit workflows: commit, push, PR creation, and branch cleanup"
|
|
43
|
+
},
|
|
44
|
+
"firecrawl": {
|
|
45
|
+
"name": "Firecrawl",
|
|
46
|
+
"marketplace": "claude-plugins-official",
|
|
47
|
+
"default": true,
|
|
48
|
+
"description": "Web scraping, search, and skill generation using Firecrawl"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"rules": {
|
|
52
|
+
"template": "templates/rules",
|
|
53
|
+
"target": ".claude/rules"
|
|
54
|
+
},
|
|
55
|
+
"skills": [
|
|
56
|
+
{
|
|
57
|
+
"id": "pinchtab",
|
|
58
|
+
"repo": "https://github.com/pinchtab/pinchtab",
|
|
59
|
+
"skill": "pinchtab",
|
|
60
|
+
"installCommand": "npx skills add https://github.com/pinchtab/pinchtab --skill pinchtab -y -a claude-code"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "find-skills",
|
|
64
|
+
"repo": "https://github.com/vercel-labs/skills",
|
|
65
|
+
"skill": "find-skills",
|
|
66
|
+
"installCommand": "npx skills add https://github.com/vercel-labs/skills --skill find-skills -y -a claude-code"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "skill-vetter",
|
|
70
|
+
"repo": "https://github.com/useai-pro/openclaw-skills-security",
|
|
71
|
+
"skill": "skill-vetter",
|
|
72
|
+
"installCommand": "npx skills add https://github.com/useai-pro/openclaw-skills-security@skill-vetter -y -a claude-code"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"bmad": {
|
|
76
|
+
"command": "npx",
|
|
77
|
+
"args": [
|
|
78
|
+
"bmad-method",
|
|
79
|
+
"install",
|
|
80
|
+
"--directory",
|
|
81
|
+
".",
|
|
82
|
+
"--modules",
|
|
83
|
+
"bmm,tea",
|
|
84
|
+
"--communication-language",
|
|
85
|
+
"Chinese",
|
|
86
|
+
"--document-output-language",
|
|
87
|
+
"Chinese",
|
|
88
|
+
"--tools",
|
|
89
|
+
"claude-code",
|
|
90
|
+
"--yes",
|
|
91
|
+
"--output-folder",
|
|
92
|
+
"_bmad-output"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"mcp": {
|
|
96
|
+
"template": "templates/mcp/claude-code/.mcp.json",
|
|
97
|
+
"target": ".mcp.json"
|
|
98
|
+
},
|
|
99
|
+
"userSettings": {
|
|
100
|
+
"apiUrl": "https://gateway.cregis.ai",
|
|
101
|
+
"models": {
|
|
102
|
+
"minimax": "MiniMax-M2.5",
|
|
103
|
+
"kimi": "Kimi-K2.5",
|
|
104
|
+
"gemini": "gemini-3.1-pro-preview",
|
|
105
|
+
"gpt": "gpt-5.3-codex"
|
|
106
|
+
},
|
|
107
|
+
"defaultModel": "minimax",
|
|
108
|
+
"modelEnvKeys": [
|
|
109
|
+
"ANTHROPIC_MODEL",
|
|
110
|
+
"ANTHROPIC_SMALL_FAST_MODEL",
|
|
111
|
+
"ANTHROPIC_DEFAULT_SONNET_MODEL",
|
|
112
|
+
"ANTHROPIC_DEFAULT_OPUS_MODEL",
|
|
113
|
+
"ANTHROPIC_DEFAULT_HAIKU_MODEL"
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
}
|
package/src/cli.js
CHANGED
|
@@ -11,8 +11,8 @@ export function run(argv) {
|
|
|
11
11
|
.version(VERSION)
|
|
12
12
|
|
|
13
13
|
program
|
|
14
|
-
.command('
|
|
15
|
-
.description('
|
|
14
|
+
.command('install')
|
|
15
|
+
.description('Install enterprise Claude Code configuration')
|
|
16
16
|
.option('-y, --yes', 'Accept all defaults', false)
|
|
17
17
|
.option('-d, --dir <path>', 'Target directory', process.cwd())
|
|
18
18
|
.option('--user-name <name>', 'Your name for agents')
|
package/src/commands/init.js
CHANGED
|
@@ -105,7 +105,7 @@ export async function runInit(opts = {}, _deps = {}) {
|
|
|
105
105
|
fn: _deps.installRules || installRules,
|
|
106
106
|
opts: {
|
|
107
107
|
targetDir,
|
|
108
|
-
rulesConfig: registry.rules
|
|
108
|
+
rulesConfig: registry.rules,
|
|
109
109
|
skip: config.excludeGroups.includes('ecc'),
|
|
110
110
|
},
|
|
111
111
|
},
|
package/src/commands/update.js
CHANGED
|
@@ -47,8 +47,14 @@ export async function configureUser(opts, logger, _deps = {}) {
|
|
|
47
47
|
|
|
48
48
|
const existingEnv = existing.env || {}
|
|
49
49
|
|
|
50
|
-
// 1. API URL —
|
|
51
|
-
|
|
50
|
+
// 1. API URL — prompt for confirmation if not provided via CLI
|
|
51
|
+
let apiUrl = opts.apiUrl
|
|
52
|
+
if (!opts.yes && !opts.apiUrl) {
|
|
53
|
+
const input = await askFn(' Enter API URL (default: ' + opts.apiUrl + '): ')
|
|
54
|
+
if (input && input.trim()) {
|
|
55
|
+
apiUrl = input.trim()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
52
58
|
|
|
53
59
|
// 2. API Key — resolve from CLI flag, readline, or existing
|
|
54
60
|
let apiKey = existingEnv.ANTHROPIC_AUTH_TOKEN || ''
|
|
@@ -67,19 +73,28 @@ export async function configureUser(opts, logger, _deps = {}) {
|
|
|
67
73
|
if (input) {
|
|
68
74
|
apiKey = input
|
|
69
75
|
} else if (!hasExistingKey) {
|
|
70
|
-
logger.warn('No API Key provided. You can set it later with `cckit
|
|
76
|
+
logger.warn('No API Key provided. You can set it later with `cckit install --api-key <key>`')
|
|
71
77
|
}
|
|
72
78
|
}
|
|
73
79
|
// --yes mode without --api-key: skip prompt, keep existing
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
// 3. Model
|
|
82
|
+
// 3. Model — prompt for confirmation
|
|
83
|
+
let modelId = opts.modelId
|
|
84
|
+
if (!opts.yes && !opts.model) {
|
|
85
|
+
const input = await askFn(' Enter model (default: ' + opts.modelId + '): ')
|
|
86
|
+
if (input && input.trim()) {
|
|
87
|
+
modelId = input.trim()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 4. Model env vars
|
|
77
92
|
const modelEnvEntries = {}
|
|
78
93
|
for (const key of opts.modelEnvKeys) {
|
|
79
|
-
modelEnvEntries[key] =
|
|
94
|
+
modelEnvEntries[key] = modelId
|
|
80
95
|
}
|
|
81
96
|
|
|
82
|
-
//
|
|
97
|
+
// 5. Merge and write
|
|
83
98
|
const merged = {
|
|
84
99
|
...existing,
|
|
85
100
|
env: {
|
|
@@ -97,7 +112,7 @@ export async function configureUser(opts, logger, _deps = {}) {
|
|
|
97
112
|
|
|
98
113
|
logger.info(` API URL: ${apiUrl}`)
|
|
99
114
|
logger.info(` API Key: ${maskedKey}`)
|
|
100
|
-
logger.info(` Model: ${
|
|
115
|
+
logger.info(` Model: ${modelId}`)
|
|
101
116
|
logger.info(` Settings: ${settingsPath}`)
|
|
102
117
|
|
|
103
118
|
return {
|
|
@@ -108,7 +123,7 @@ export async function configureUser(opts, logger, _deps = {}) {
|
|
|
108
123
|
details: {
|
|
109
124
|
apiUrl,
|
|
110
125
|
hasApiKey: Boolean(apiKey),
|
|
111
|
-
modelId
|
|
126
|
+
modelId,
|
|
112
127
|
settingsPath,
|
|
113
128
|
},
|
|
114
129
|
}
|
|
@@ -1,60 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Step: Install ECC rules via
|
|
2
|
+
* Step: Install ECC rules via template copy.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* then copies the `rules/` subtree to `.claude/rules/`.
|
|
6
|
-
* Cache is reused within 24 hours.
|
|
4
|
+
* Copies the bundled rules template to `.claude/rules/`.
|
|
7
5
|
*/
|
|
8
6
|
|
|
9
|
-
import { execFile } from 'node:child_process'
|
|
10
|
-
import { promisify } from 'node:util'
|
|
11
|
-
import os from 'node:os'
|
|
12
7
|
import path from 'node:path'
|
|
13
8
|
import fse from 'fs-extra'
|
|
14
9
|
import { listFiles } from '../utils/fs.js'
|
|
10
|
+
import { fileURLToPath } from 'node:url'
|
|
15
11
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const CACHE_MAX_AGE_MS = 24 * 60 * 60 * 1000 // 24 hours
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Clone a git repo to cache, reusing if fresh.
|
|
22
|
-
*
|
|
23
|
-
* @param {string} cacheKey - Cache directory name
|
|
24
|
-
* @param {string} repo - Git repository URL
|
|
25
|
-
* @param {boolean} forceRefresh - Force re-clone even if cache exists
|
|
26
|
-
* @param {object} [_deps] - Injectable dependencies
|
|
27
|
-
* @returns {Promise<string>} Absolute path to cached clone
|
|
28
|
-
*/
|
|
29
|
-
async function getCachedClone(cacheKey, repo, forceRefresh = false, _deps = {}) {
|
|
30
|
-
const { execFileFn = execFileAsync } = _deps
|
|
31
|
-
const cacheBase = path.join(os.homedir(), '.cckit', 'cache')
|
|
32
|
-
const cacheDir = path.join(cacheBase, cacheKey)
|
|
33
|
-
|
|
34
|
-
if (!forceRefresh && await fse.pathExists(cacheDir)) {
|
|
35
|
-
const stat = await fse.stat(cacheDir)
|
|
36
|
-
const ageMs = Date.now() - stat.mtimeMs
|
|
37
|
-
if (ageMs < CACHE_MAX_AGE_MS) {
|
|
38
|
-
return cacheDir
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Remove stale cache if exists
|
|
43
|
-
if (await fse.pathExists(cacheDir)) {
|
|
44
|
-
await fse.remove(cacheDir)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
await fse.ensureDir(cacheBase)
|
|
48
|
-
await execFileFn('git', ['clone', '--depth', '1', repo, cacheDir])
|
|
49
|
-
return cacheDir
|
|
50
|
-
}
|
|
12
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
51
13
|
|
|
52
14
|
/**
|
|
53
15
|
* @param {object} opts
|
|
54
16
|
* @param {string} opts.targetDir - Project root
|
|
55
|
-
* @param {object} opts.rulesConfig - {
|
|
17
|
+
* @param {object} opts.rulesConfig - { template, target }
|
|
56
18
|
* @param {boolean} opts.skip - Skip this step
|
|
57
|
-
* @param {boolean} [opts.forceRefresh] - Force re-clone
|
|
58
19
|
* @param {object} logger
|
|
59
20
|
* @param {object} [_deps] - Injectable dependencies
|
|
60
21
|
* @returns {Promise<import('../core/orchestrator.js').StepResult>}
|
|
@@ -64,28 +25,26 @@ export async function installRules(opts, logger, _deps = {}) {
|
|
|
64
25
|
return { stepId: 'install-rules', name: 'Install ECC Rules', success: true, skipped: true, details: {} }
|
|
65
26
|
}
|
|
66
27
|
|
|
67
|
-
const {
|
|
28
|
+
const { template, target } = opts.rulesConfig
|
|
68
29
|
|
|
69
30
|
try {
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const srcDir = path.join(cloneDir, rulesPath)
|
|
31
|
+
// Resolve template path - use absolute path if provided, otherwise relative to cckit package
|
|
32
|
+
const templatePath = path.resolve(__dirname, '../../', template)
|
|
74
33
|
const destDir = path.join(opts.targetDir, target)
|
|
75
34
|
|
|
76
|
-
if (!await fse.pathExists(
|
|
35
|
+
if (!await fse.pathExists(templatePath)) {
|
|
77
36
|
return {
|
|
78
37
|
stepId: 'install-rules',
|
|
79
38
|
name: 'Install ECC Rules',
|
|
80
39
|
success: false,
|
|
81
40
|
skipped: false,
|
|
82
41
|
details: {},
|
|
83
|
-
error: `Rules
|
|
42
|
+
error: `Rules template not found: ${templatePath}`,
|
|
84
43
|
}
|
|
85
44
|
}
|
|
86
45
|
|
|
87
46
|
await fse.ensureDir(destDir)
|
|
88
|
-
await fse.copy(
|
|
47
|
+
await fse.copy(templatePath, destDir, { overwrite: true })
|
|
89
48
|
|
|
90
49
|
const files = await listFiles(destDir)
|
|
91
50
|
logger.debug(`Copied ${files.length} rule files to ${target}`)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Rules
|
|
2
|
+
## Structure
|
|
3
|
+
|
|
4
|
+
Rules are organized into a **common** layer plus **language-specific** directories:
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
rules/
|
|
8
|
+
├── common/ # Language-agnostic principles (always install)
|
|
9
|
+
│ ├── coding-style.md
|
|
10
|
+
│ ├── git-workflow.md
|
|
11
|
+
│ ├── testing.md
|
|
12
|
+
│ ├── performance.md
|
|
13
|
+
│ ├── patterns.md
|
|
14
|
+
│ ├── hooks.md
|
|
15
|
+
│ ├── agents.md
|
|
16
|
+
│ └── security.md
|
|
17
|
+
├── typescript/ # TypeScript/JavaScript specific
|
|
18
|
+
├── python/ # Python specific
|
|
19
|
+
├── golang/ # Go specific
|
|
20
|
+
└── swift/ # Swift specific
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- **common/** contains universal principles — no language-specific code examples.
|
|
24
|
+
- **Language directories** extend the common rules with framework-specific patterns, tools, and code examples. Each file references its common counterpart.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
### Option 1: Install Script (Recommended)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Install common + one or more language-specific rule sets
|
|
32
|
+
./install.sh typescript
|
|
33
|
+
./install.sh python
|
|
34
|
+
./install.sh golang
|
|
35
|
+
./install.sh swift
|
|
36
|
+
|
|
37
|
+
# Install multiple languages at once
|
|
38
|
+
./install.sh typescript python
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Option 2: Manual Installation
|
|
42
|
+
|
|
43
|
+
> **Important:** Copy entire directories — do NOT flatten with `/*`.
|
|
44
|
+
> Common and language-specific directories contain files with the same names.
|
|
45
|
+
> Flattening them into one directory causes language-specific files to overwrite
|
|
46
|
+
> common rules, and breaks the relative `../common/` references used by
|
|
47
|
+
> language-specific files.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Install common rules (required for all projects)
|
|
51
|
+
cp -r rules/common ~/.claude/rules/common
|
|
52
|
+
|
|
53
|
+
# Install language-specific rules based on your project's tech stack
|
|
54
|
+
cp -r rules/typescript ~/.claude/rules/typescript
|
|
55
|
+
cp -r rules/python ~/.claude/rules/python
|
|
56
|
+
cp -r rules/golang ~/.claude/rules/golang
|
|
57
|
+
cp -r rules/swift ~/.claude/rules/swift
|
|
58
|
+
|
|
59
|
+
# Attention ! ! ! Configure according to your actual project requirements; the configuration here is for reference only.
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Rules vs Skills
|
|
63
|
+
|
|
64
|
+
- **Rules** define standards, conventions, and checklists that apply broadly (e.g., "80% test coverage", "no hardcoded secrets").
|
|
65
|
+
- **Skills** (`skills/` directory) provide deep, actionable reference material for specific tasks (e.g., `python-patterns`, `golang-testing`).
|
|
66
|
+
|
|
67
|
+
Language-specific rule files reference relevant skills where appropriate. Rules tell you *what* to do; skills tell you *how* to do it.
|
|
68
|
+
|
|
69
|
+
## Adding a New Language
|
|
70
|
+
|
|
71
|
+
To add support for a new language (e.g., `rust/`):
|
|
72
|
+
|
|
73
|
+
1. Create a `rules/rust/` directory
|
|
74
|
+
2. Add files that extend the common rules:
|
|
75
|
+
- `coding-style.md` — formatting tools, idioms, error handling patterns
|
|
76
|
+
- `testing.md` — test framework, coverage tools, test organization
|
|
77
|
+
- `patterns.md` — language-specific design patterns
|
|
78
|
+
- `hooks.md` — PostToolUse hooks for formatters, linters, type checkers
|
|
79
|
+
- `security.md` — secret management, security scanning tools
|
|
80
|
+
3. Each file should start with:
|
|
81
|
+
```
|
|
82
|
+
> This file extends [common/xxx.md](../common/xxx.md) with <Language> specific content.
|
|
83
|
+
```
|
|
84
|
+
4. Reference existing skills if available, or create new ones under `skills/`.
|
|
85
|
+
|
|
86
|
+
## Rule Priority
|
|
87
|
+
|
|
88
|
+
When language-specific rules and common rules conflict, **language-specific rules take precedence** (specific overrides general). This follows the standard layered configuration pattern (similar to CSS specificity or `.gitignore` precedence).
|
|
89
|
+
|
|
90
|
+
- `rules/common/` defines universal defaults applicable to all projects.
|
|
91
|
+
- `rules/golang/`, `rules/python/`, `rules/typescript/`, etc. override those defaults where language idioms differ.
|
|
92
|
+
|
|
93
|
+
### Example
|
|
94
|
+
|
|
95
|
+
`common/coding-style.md` recommends immutability as a default principle. A language-specific `golang/coding-style.md` can override this:
|
|
96
|
+
|
|
97
|
+
> Idiomatic Go uses pointer receivers for struct mutation — see [common/coding-style.md](../common/coding-style.md) for the general principle, but Go-idiomatic mutation is preferred here.
|
|
98
|
+
|
|
99
|
+
### Common rules with override notes
|
|
100
|
+
|
|
101
|
+
Rules in `rules/common/` that may be overridden by language-specific files are marked with:
|
|
102
|
+
|
|
103
|
+
> **Language note**: This rule may be overridden by language-specific rules for languages where this pattern is not idiomatic.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Agent Orchestration
|
|
2
|
+
|
|
3
|
+
## Available Agents
|
|
4
|
+
|
|
5
|
+
Located in `~/.claude/agents/`:
|
|
6
|
+
|
|
7
|
+
| Agent | Purpose | When to Use |
|
|
8
|
+
|-------|---------|-------------|
|
|
9
|
+
| planner | Implementation planning | Complex features, refactoring |
|
|
10
|
+
| architect | System design | Architectural decisions |
|
|
11
|
+
| tdd-guide | Test-driven development | New features, bug fixes |
|
|
12
|
+
| code-reviewer | Code review | After writing code |
|
|
13
|
+
| security-reviewer | Security analysis | Before commits |
|
|
14
|
+
| build-error-resolver | Fix build errors | When build fails |
|
|
15
|
+
| e2e-runner | E2E testing | Critical user flows |
|
|
16
|
+
| refactor-cleaner | Dead code cleanup | Code maintenance |
|
|
17
|
+
| doc-updater | Documentation | Updating docs |
|
|
18
|
+
|
|
19
|
+
## Immediate Agent Usage
|
|
20
|
+
|
|
21
|
+
No user prompt needed:
|
|
22
|
+
1. Complex feature requests - Use **planner** agent
|
|
23
|
+
2. Code just written/modified - Use **code-reviewer** agent
|
|
24
|
+
3. Bug fix or new feature - Use **tdd-guide** agent
|
|
25
|
+
4. Architectural decision - Use **architect** agent
|
|
26
|
+
|
|
27
|
+
## Parallel Task Execution
|
|
28
|
+
|
|
29
|
+
ALWAYS use parallel Task execution for independent operations:
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
# GOOD: Parallel execution
|
|
33
|
+
Launch 3 agents in parallel:
|
|
34
|
+
1. Agent 1: Security analysis of auth module
|
|
35
|
+
2. Agent 2: Performance review of cache system
|
|
36
|
+
3. Agent 3: Type checking of utilities
|
|
37
|
+
|
|
38
|
+
# BAD: Sequential when unnecessary
|
|
39
|
+
First agent 1, then agent 2, then agent 3
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Multi-Perspective Analysis
|
|
43
|
+
|
|
44
|
+
For complex problems, use split role sub-agents:
|
|
45
|
+
- Factual reviewer
|
|
46
|
+
- Senior engineer
|
|
47
|
+
- Security expert
|
|
48
|
+
- Consistency reviewer
|
|
49
|
+
- Redundancy checker
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Coding Style
|
|
2
|
+
|
|
3
|
+
## Immutability (CRITICAL)
|
|
4
|
+
|
|
5
|
+
ALWAYS create new objects, NEVER mutate existing ones:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
// Pseudocode
|
|
9
|
+
WRONG: modify(original, field, value) → changes original in-place
|
|
10
|
+
CORRECT: update(original, field, value) → returns new copy with change
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Rationale: Immutable data prevents hidden side effects, makes debugging easier, and enables safe concurrency.
|
|
14
|
+
|
|
15
|
+
## File Organization
|
|
16
|
+
|
|
17
|
+
MANY SMALL FILES > FEW LARGE FILES:
|
|
18
|
+
- High cohesion, low coupling
|
|
19
|
+
- 200-400 lines typical, 800 max
|
|
20
|
+
- Extract utilities from large modules
|
|
21
|
+
- Organize by feature/domain, not by type
|
|
22
|
+
|
|
23
|
+
## Error Handling
|
|
24
|
+
|
|
25
|
+
ALWAYS handle errors comprehensively:
|
|
26
|
+
- Handle errors explicitly at every level
|
|
27
|
+
- Provide user-friendly error messages in UI-facing code
|
|
28
|
+
- Log detailed error context on the server side
|
|
29
|
+
- Never silently swallow errors
|
|
30
|
+
|
|
31
|
+
## Input Validation
|
|
32
|
+
|
|
33
|
+
ALWAYS validate at system boundaries:
|
|
34
|
+
- Validate all user input before processing
|
|
35
|
+
- Use schema-based validation where available
|
|
36
|
+
- Fail fast with clear error messages
|
|
37
|
+
- Never trust external data (API responses, user input, file content)
|
|
38
|
+
|
|
39
|
+
## Code Quality Checklist
|
|
40
|
+
|
|
41
|
+
Before marking work complete:
|
|
42
|
+
- [ ] Code is readable and well-named
|
|
43
|
+
- [ ] Functions are small (<50 lines)
|
|
44
|
+
- [ ] Files are focused (<800 lines)
|
|
45
|
+
- [ ] No deep nesting (>4 levels)
|
|
46
|
+
- [ ] Proper error handling
|
|
47
|
+
- [ ] No hardcoded values (use constants or config)
|
|
48
|
+
- [ ] No mutation (immutable patterns used)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Development Workflow
|
|
2
|
+
|
|
3
|
+
> This file extends [common/git-workflow.md](./git-workflow.md) with the full feature development process that happens before git operations.
|
|
4
|
+
|
|
5
|
+
The Feature Implementation Workflow describes the development pipeline: research, planning, TDD, code review, and then committing to git.
|
|
6
|
+
|
|
7
|
+
## Feature Implementation Workflow
|
|
8
|
+
|
|
9
|
+
0. **Research & Reuse** _(mandatory before any new implementation)_
|
|
10
|
+
- **GitHub code search first:** Run `gh search repos` and `gh search code` to find existing implementations, templates, and patterns before writing anything new.
|
|
11
|
+
- **Exa MCP for research:** Use `exa-web-search` MCP during the planning phase for broader research, data ingestion, and discovering prior art.
|
|
12
|
+
- **Check package registries:** Search npm, PyPI, crates.io, and other registries before writing utility code. Prefer battle-tested libraries over hand-rolled solutions.
|
|
13
|
+
- **Search for adaptable implementations:** Look for open-source projects that solve 80%+ of the problem and can be forked, ported, or wrapped.
|
|
14
|
+
- Prefer adopting or porting a proven approach over writing net-new code when it meets the requirement.
|
|
15
|
+
|
|
16
|
+
1. **Plan First**
|
|
17
|
+
- Use **planner** agent to create implementation plan
|
|
18
|
+
- Generate planning docs before coding: PRD, architecture, system_design, tech_doc, task_list
|
|
19
|
+
- Identify dependencies and risks
|
|
20
|
+
- Break down into phases
|
|
21
|
+
|
|
22
|
+
2. **TDD Approach**
|
|
23
|
+
- Use **tdd-guide** agent
|
|
24
|
+
- Write tests first (RED)
|
|
25
|
+
- Implement to pass tests (GREEN)
|
|
26
|
+
- Refactor (IMPROVE)
|
|
27
|
+
- Verify 80%+ coverage
|
|
28
|
+
|
|
29
|
+
3. **Code Review**
|
|
30
|
+
- Use **code-reviewer** agent immediately after writing code
|
|
31
|
+
- Address CRITICAL and HIGH issues
|
|
32
|
+
- Fix MEDIUM issues when possible
|
|
33
|
+
|
|
34
|
+
4. **Commit & Push**
|
|
35
|
+
- Detailed commit messages
|
|
36
|
+
- Follow conventional commits format
|
|
37
|
+
- See [git-workflow.md](./git-workflow.md) for commit message format and PR process
|