@vyuhlabs/dxkit 0.1.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/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +173 -0
- package/dist/cli.js.map +1 -0
- package/dist/codebase-scanner.d.ts +33 -0
- package/dist/codebase-scanner.d.ts.map +1 -0
- package/dist/codebase-scanner.js +497 -0
- package/dist/codebase-scanner.js.map +1 -0
- package/dist/constants.d.ts +17 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +80 -0
- package/dist/constants.js.map +1 -0
- package/dist/detect.d.ts +3 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +264 -0
- package/dist/detect.js.map +1 -0
- package/dist/doctor.d.ts +2 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +157 -0
- package/dist/doctor.js.map +1 -0
- package/dist/files.d.ts +17 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +99 -0
- package/dist/files.js.map +1 -0
- package/dist/generator.d.ts +10 -0
- package/dist/generator.d.ts.map +1 -0
- package/dist/generator.js +405 -0
- package/dist/generator.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +9 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +51 -0
- package/dist/logger.js.map +1 -0
- package/dist/prompts.d.ts +10 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +125 -0
- package/dist/prompts.js.map +1 -0
- package/dist/template-engine.d.ts +22 -0
- package/dist/template-engine.d.ts.map +1 -0
- package/dist/template-engine.js +63 -0
- package/dist/template-engine.js.map +1 -0
- package/dist/types.d.ts +68 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/update.d.ts +2 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +97 -0
- package/dist/update.js.map +1 -0
- package/package.json +43 -0
- package/templates/.ai/README.md +117 -0
- package/templates/.ai/prompts/execution-prompt.md +9 -0
- package/templates/.ai/prompts/planning-prompt.md +18 -0
- package/templates/.ai/prompts/session-end-template.md +182 -0
- package/templates/.ai/prompts/session-end.md +132 -0
- package/templates/.ai/prompts/session-start.md +109 -0
- package/templates/.ai/prompts/step-by-step.md +113 -0
- package/templates/.ai/sessions/.gitkeep +0 -0
- package/templates/.ai/templates/session-checkpoint-template.md +97 -0
- package/templates/.claude/agents/knowledge-bot.md +62 -0
- package/templates/.claude/agents/onboarding.md +61 -0
- package/templates/.claude/agents/quality-reviewer.md +85 -0
- package/templates/.claude/agents-available/code-reviewer.md +29 -0
- package/templates/.claude/agents-available/codebase-explorer.md +99 -0
- package/templates/.claude/agents-available/debugger.md +29 -0
- package/templates/.claude/agents-available/knowledge-bot.md +62 -0
- package/templates/.claude/agents-available/test-writer.md +34 -0
- package/templates/.claude/commands/ask.md +7 -0
- package/templates/.claude/commands/check.md.template +55 -0
- package/templates/.claude/commands/doctor.md +21 -0
- package/templates/.claude/commands/enable-agent.md +12 -0
- package/templates/.claude/commands/explore-codebase.md +12 -0
- package/templates/.claude/commands/fix-issue.md +12 -0
- package/templates/.claude/commands/fix.md.template +32 -0
- package/templates/.claude/commands/help.md +36 -0
- package/templates/.claude/commands/learn.md +48 -0
- package/templates/.claude/commands/onboarding.md +21 -0
- package/templates/.claude/commands/quality.md.template +42 -0
- package/templates/.claude/commands/session-end.md +40 -0
- package/templates/.claude/commands/session-start.md +30 -0
- package/templates/.claude/commands/setup-hooks.md +60 -0
- package/templates/.claude/commands/test.md.template +49 -0
- package/templates/.claude/rules/csharp.md +18 -0
- package/templates/.claude/rules/go.md +16 -0
- package/templates/.claude/rules/nextjs.md +17 -0
- package/templates/.claude/rules/python.md +19 -0
- package/templates/.claude/rules/rust.md +14 -0
- package/templates/.claude/skills/build/SKILL.md.template +98 -0
- package/templates/.claude/skills/deploy/SKILL.md.template +131 -0
- package/templates/.claude/skills/deploy/references/gotchas.md +5 -0
- package/templates/.claude/skills/doctor/SKILL.md +54 -0
- package/templates/.claude/skills/gcloud/SKILL.md +61 -0
- package/templates/.claude/skills/gcloud/references/gotchas.md +5 -0
- package/templates/.claude/skills/learned/SKILL.md +55 -0
- package/templates/.claude/skills/learned/references/conventions.md +11 -0
- package/templates/.claude/skills/learned/references/deny-recommendations.md +18 -0
- package/templates/.claude/skills/learned/references/gotchas.md +11 -0
- package/templates/.claude/skills/pulumi/SKILL.md +67 -0
- package/templates/.claude/skills/quality/SKILL.md.template +108 -0
- package/templates/.claude/skills/quality/references/gotchas.md +5 -0
- package/templates/.claude/skills/review/SKILL.md.template +73 -0
- package/templates/.claude/skills/scaffold/SKILL.md.template +123 -0
- package/templates/.claude/skills/secrets/SKILL.md +45 -0
- package/templates/.claude/skills/session/SKILL.md +43 -0
- package/templates/.claude/skills/test/SKILL.md.template +109 -0
- package/templates/.claude/skills/test/references/gotchas.md +5 -0
- package/templates/.devcontainer/Dockerfile.dev.template +89 -0
- package/templates/.devcontainer/devcontainer.json.template +184 -0
- package/templates/.devcontainer/docker-compose.yml.template +105 -0
- package/templates/.devcontainer/init-scripts/01-init.sql.template +12 -0
- package/templates/.devcontainer/post-create.sh.template +298 -0
- package/templates/.github/workflows/ci.yml.template +399 -0
- package/templates/.github/workflows/quality.yml.template +376 -0
- package/templates/.pre-commit-config.yaml.template +106 -0
- package/templates/.project/config/edit_config.py +275 -0
- package/templates/.project/config/project_config.py +894 -0
- package/templates/.project/scripts/codegen/generate-all.sh +20 -0
- package/templates/.project/scripts/codegen/validate-all.sh +17 -0
- package/templates/.project/scripts/docs/generate-all.sh +30 -0
- package/templates/.project/scripts/docs/serve.sh +20 -0
- package/templates/.project/scripts/quality/fix-all.sh +138 -0
- package/templates/.project/scripts/quality/lint-go.sh +34 -0
- package/templates/.project/scripts/quality/lint-python.sh +54 -0
- package/templates/.project/scripts/quality/run-all.sh +497 -0
- package/templates/.project/scripts/session/commit.sh +70 -0
- package/templates/.project/scripts/session/create-pr.sh +165 -0
- package/templates/.project/scripts/session/end.sh +207 -0
- package/templates/.project/scripts/session/start.sh +233 -0
- package/templates/.project/scripts/setup/doctor.sh +404 -0
- package/templates/.project/scripts/setup/interactive-setup.sh +581 -0
- package/templates/.project/scripts/sync/sync-template.sh +328 -0
- package/templates/.project/scripts/test/run-all.sh +179 -0
- package/templates/.project/scripts/test/run-quick.sh +25 -0
- package/templates/CLAUDE.md.template +228 -0
- package/templates/Makefile +514 -0
- package/templates/config/versions.yaml +57 -0
- package/templates/configs/go/.golangci.yml.template +172 -0
- package/templates/configs/go/go.mod.template +15 -0
- package/templates/configs/node/package.json.template +67 -0
- package/templates/configs/node/tsconfig.json.template +53 -0
- package/templates/configs/python/pyproject.toml.template +92 -0
- package/templates/configs/python/pytest.ini.template +64 -0
- package/templates/configs/python/ruff.toml.template +79 -0
- package/templates/configs/rust/Cargo.toml.template +51 -0
- package/templates/configs/shared/.editorconfig +67 -0
- package/templates/scripts/validate-templates.sh +449 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: learned
|
|
3
|
+
description: Project-specific learnings, gotchas, and conventions discovered during development. Check this before starting any task for accumulated team knowledge.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Learned Patterns & Gotchas
|
|
7
|
+
|
|
8
|
+
This skill accumulates project-specific knowledge over time.
|
|
9
|
+
It is updated during session-end checkpoints.
|
|
10
|
+
|
|
11
|
+
## How This Works
|
|
12
|
+
|
|
13
|
+
1. During `make session-end`, the checkpoint process reviews the session
|
|
14
|
+
2. Any new gotchas, patterns, or conventions are appended to the reference files
|
|
15
|
+
3. Over time, this becomes the most valuable skill — real failure points and patterns
|
|
16
|
+
|
|
17
|
+
## Files
|
|
18
|
+
|
|
19
|
+
- [references/gotchas.md](references/gotchas.md) - Accumulated gotchas and edge cases (append-only)
|
|
20
|
+
- [references/conventions.md](references/conventions.md) - Team conventions discovered during development
|
|
21
|
+
- [references/deny-recommendations.md](references/deny-recommendations.md) - Commands that should be added to `.claude/settings.json` deny list (requires human review)
|
|
22
|
+
|
|
23
|
+
## When to Update
|
|
24
|
+
|
|
25
|
+
Update these files when you encounter:
|
|
26
|
+
- Unexpected behaviors or edge cases
|
|
27
|
+
- Workarounds for tool/framework bugs
|
|
28
|
+
- Team conventions or patterns that aren't obvious from the code
|
|
29
|
+
- Configuration pitfalls
|
|
30
|
+
- Deployment or environment-specific issues
|
|
31
|
+
|
|
32
|
+
## When to Create a New Skill
|
|
33
|
+
|
|
34
|
+
If a learning is significant enough to warrant its own skill (e.g., a specific API integration, a migration workflow, a caching pattern), create a new directory under `.claude/skills/<name>/` with a `SKILL.md` instead of appending here. This skill (`learned`) is for general cross-cutting knowledge; domain-specific knowledge deserves its own skill.
|
|
35
|
+
|
|
36
|
+
## Format
|
|
37
|
+
|
|
38
|
+
### Gotchas
|
|
39
|
+
```markdown
|
|
40
|
+
## YYYY-MM-DD - Category / Short Title
|
|
41
|
+
Description of the issue.
|
|
42
|
+
**Resolution:** How it was resolved.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Conventions
|
|
46
|
+
```markdown
|
|
47
|
+
## Category - Convention Name
|
|
48
|
+
Description of the convention.
|
|
49
|
+
**Rationale:** Why this convention was adopted.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Security
|
|
53
|
+
|
|
54
|
+
**NEVER include secret values, tokens, passwords, or API keys in any file under this skill.**
|
|
55
|
+
If a gotcha involves credentials, describe the issue generically without exposing actual values.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Team Conventions
|
|
2
|
+
|
|
3
|
+
<!-- Discovered conventions are added here during session-end. -->
|
|
4
|
+
<!-- Format: category, convention, rationale -->
|
|
5
|
+
<!-- NEVER include secret values, tokens, or credentials here -->
|
|
6
|
+
|
|
7
|
+
<!-- Example:
|
|
8
|
+
## Python - Use App Factory Pattern
|
|
9
|
+
All FastAPI applications should use the app factory pattern (create_app function) rather than module-level app instantiation.
|
|
10
|
+
**Rationale:** Enables test isolation and configuration flexibility. Adopted after test pollution issues in the auth service.
|
|
11
|
+
-->
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Deny Rule Recommendations
|
|
2
|
+
|
|
3
|
+
<!--
|
|
4
|
+
This file tracks commands/actions that SHOULD be added to .claude/settings.json deny list.
|
|
5
|
+
Claude cannot modify settings.json directly (security boundary).
|
|
6
|
+
A developer should periodically review this file and promote entries to settings.json.
|
|
7
|
+
|
|
8
|
+
Format:
|
|
9
|
+
## YYYY-MM-DD - Rule
|
|
10
|
+
`DenyPattern` — reason this should be blocked
|
|
11
|
+
**Context:** what happened that surfaced this need
|
|
12
|
+
-->
|
|
13
|
+
|
|
14
|
+
<!-- Example:
|
|
15
|
+
## 2025-12-15 - Block database drop
|
|
16
|
+
`Bash(dropdb:*)` — accidentally dropped staging database during cleanup
|
|
17
|
+
**Context:** Claude ran dropdb instead of truncating tables during test cleanup
|
|
18
|
+
-->
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Project Gotchas
|
|
2
|
+
|
|
3
|
+
<!-- This file grows over time. Each entry is added during session-end. -->
|
|
4
|
+
<!-- Format: date, category, description, resolution -->
|
|
5
|
+
<!-- NEVER include secret values, tokens, or credentials here -->
|
|
6
|
+
|
|
7
|
+
<!-- Example:
|
|
8
|
+
## 2025-12-15 - Python / Import Order
|
|
9
|
+
ruff's isort rules conflict with local imports when using relative paths in the src/ directory.
|
|
10
|
+
**Resolution:** Use absolute imports from package root (e.g., `from mypackage.module import X`).
|
|
11
|
+
-->
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pulumi
|
|
3
|
+
description: Pulumi infrastructure as code — stacks, previews, deployments, config. Use when asked about IaC, Pulumi, cloud resources, infrastructure provisioning, or stack management.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pulumi (Infrastructure as Code)
|
|
7
|
+
|
|
8
|
+
## Setup
|
|
9
|
+
- **Auth:** `pulumi login` (configured during `make setup`)
|
|
10
|
+
- **SDK:** Installed via devcontainer post-create script
|
|
11
|
+
- **Path:** `~/.pulumi/bin/pulumi`
|
|
12
|
+
|
|
13
|
+
## Core Workflow
|
|
14
|
+
|
|
15
|
+
**ALWAYS preview before applying changes:**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# 1. Preview changes (safe, read-only)
|
|
19
|
+
pulumi preview
|
|
20
|
+
|
|
21
|
+
# 2. Review the diff carefully
|
|
22
|
+
|
|
23
|
+
# 3. Apply changes (REQUIRES explicit user confirmation)
|
|
24
|
+
pulumi up
|
|
25
|
+
|
|
26
|
+
# 4. Check outputs
|
|
27
|
+
pulumi stack output
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Common Commands
|
|
31
|
+
|
|
32
|
+
### Stack Management
|
|
33
|
+
```bash
|
|
34
|
+
pulumi stack ls # list stacks
|
|
35
|
+
pulumi stack select <name> # switch stack
|
|
36
|
+
pulumi stack output # view outputs
|
|
37
|
+
pulumi stack export # export state
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Configuration
|
|
41
|
+
```bash
|
|
42
|
+
pulumi config # view config
|
|
43
|
+
pulumi config set key value # set plain config
|
|
44
|
+
pulumi config set --secret key value # set encrypted secret
|
|
45
|
+
pulumi config get key # get value
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### State & History
|
|
49
|
+
```bash
|
|
50
|
+
pulumi stack history # deployment history
|
|
51
|
+
pulumi state # inspect state
|
|
52
|
+
pulumi refresh # sync state with cloud
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Security — CRITICAL
|
|
56
|
+
|
|
57
|
+
1. **ALWAYS `pulumi preview` before `pulumi up`** — review the diff
|
|
58
|
+
2. **NEVER run `pulumi destroy` without explicit user confirmation** — it deletes all resources
|
|
59
|
+
3. **Use `pulumi config set --secret`** for sensitive values — never plain-text
|
|
60
|
+
4. **NEVER output `pulumi config get --secret`** values in responses
|
|
61
|
+
5. **State files may contain secrets** — ensure backend is secure (encrypted)
|
|
62
|
+
6. Pulumi passphrase (if using local backend) should be in `.env`, never hardcoded
|
|
63
|
+
|
|
64
|
+
## Integration
|
|
65
|
+
|
|
66
|
+
- Secrets from Infisical can be used as Pulumi config values
|
|
67
|
+
- GCP project from `.env` (`GOOGLE_CLOUD_PROJECT`) can configure Pulumi GCP provider
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quality
|
|
3
|
+
description: Run code quality checks, linting, formatting, and auto-fixing. Use when asked to check code quality, fix lint errors, format code, or run pre-commit checks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Quality
|
|
7
|
+
|
|
8
|
+
## Commands
|
|
9
|
+
- `make quality` - Run all quality checks (report: `tmp/reports/quality-report.md`)
|
|
10
|
+
- `make quality-fix` - Auto-fix all fixable issues
|
|
11
|
+
- `make lint` - Lint only
|
|
12
|
+
- `make format` - Format all code
|
|
13
|
+
- `make fix` - Fix + format (shorthand)
|
|
14
|
+
- `make check` - Full pre-commit check (validate + quality + test)
|
|
15
|
+
- `make format-check` - Check formatting without modifying
|
|
16
|
+
|
|
17
|
+
## Quality Presets
|
|
18
|
+
- `make quality-strict` - 90% coverage, all checks
|
|
19
|
+
- `make quality-standard` - 80% coverage (default)
|
|
20
|
+
- `make quality-relaxed` - 50% coverage
|
|
21
|
+
- `make quality-off` - Disable checks
|
|
22
|
+
- `make quality-config` - Show current settings
|
|
23
|
+
|
|
24
|
+
{{#IF_PYTHON}}
|
|
25
|
+
## Python
|
|
26
|
+
|
|
27
|
+
**Tools:** ruff (lint + format), mypy (types)
|
|
28
|
+
**Config:** `ruff.toml`, `pyproject.toml`
|
|
29
|
+
**Script:** `.project/scripts/quality/lint-python.sh`
|
|
30
|
+
|
|
31
|
+
Common fixes:
|
|
32
|
+
```bash
|
|
33
|
+
ruff check --fix .
|
|
34
|
+
ruff format .
|
|
35
|
+
mypy src/
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Key ruff rules: pycodestyle (E), pyflakes (F), isort (I), mccabe (C90), bugbear (B).
|
|
39
|
+
Per-file ignores configured in `ruff.toml` for tests (assertions, fixtures).
|
|
40
|
+
{{/IF_PYTHON}}
|
|
41
|
+
|
|
42
|
+
{{#IF_GO}}
|
|
43
|
+
## Go
|
|
44
|
+
|
|
45
|
+
**Tools:** golangci-lint (27 linters), gofmt, goimports
|
|
46
|
+
**Config:** `.golangci.yml`
|
|
47
|
+
**Script:** `.project/scripts/quality/lint-go.sh`
|
|
48
|
+
|
|
49
|
+
Common fixes:
|
|
50
|
+
```bash
|
|
51
|
+
gofmt -w .
|
|
52
|
+
goimports -w .
|
|
53
|
+
golangci-lint run --fix
|
|
54
|
+
```
|
|
55
|
+
{{/IF_GO}}
|
|
56
|
+
|
|
57
|
+
{{#IF_NODE}}
|
|
58
|
+
## Node.js
|
|
59
|
+
|
|
60
|
+
**Tools:** ESLint, Prettier
|
|
61
|
+
Common fixes:
|
|
62
|
+
```bash
|
|
63
|
+
npx prettier --write .
|
|
64
|
+
npx eslint --fix .
|
|
65
|
+
```
|
|
66
|
+
{{/IF_NODE}}
|
|
67
|
+
|
|
68
|
+
{{#IF_NEXTJS}}
|
|
69
|
+
## Next.js
|
|
70
|
+
|
|
71
|
+
**Directory:** `frontend/`
|
|
72
|
+
```bash
|
|
73
|
+
cd frontend && npm run lint
|
|
74
|
+
cd frontend && npx prettier --write .
|
|
75
|
+
cd frontend && npx tsc --noEmit # type check
|
|
76
|
+
```
|
|
77
|
+
{{/IF_NEXTJS}}
|
|
78
|
+
|
|
79
|
+
{{#IF_RUST}}
|
|
80
|
+
## Rust
|
|
81
|
+
|
|
82
|
+
**Tools:** clippy, rustfmt
|
|
83
|
+
```bash
|
|
84
|
+
cargo fmt
|
|
85
|
+
cargo clippy --fix --allow-dirty
|
|
86
|
+
```
|
|
87
|
+
{{/IF_RUST}}
|
|
88
|
+
|
|
89
|
+
{{#IF_CSHARP}}
|
|
90
|
+
## C#
|
|
91
|
+
|
|
92
|
+
**Tools:** dotnet format, Roslyn Analyzers, StyleCop Analyzers
|
|
93
|
+
**Config:** `.editorconfig`, `Directory.Build.props`
|
|
94
|
+
|
|
95
|
+
Common fixes:
|
|
96
|
+
```bash
|
|
97
|
+
dotnet format # auto-fix formatting
|
|
98
|
+
dotnet format --verify-no-changes # CI check (no modifications)
|
|
99
|
+
```
|
|
100
|
+
{{/IF_CSHARP}}
|
|
101
|
+
|
|
102
|
+
## Gotchas
|
|
103
|
+
|
|
104
|
+
See [references/gotchas.md](references/gotchas.md) for known quality issues.
|
|
105
|
+
|
|
106
|
+
## Security
|
|
107
|
+
|
|
108
|
+
Never disable security-related lint rules. If a rule seems wrong, investigate before suppressing.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review
|
|
3
|
+
description: Review code for quality, security, and patterns. Use when asked to review code, a PR, check for problems, or audit for security issues.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review
|
|
7
|
+
|
|
8
|
+
## Quick Check
|
|
9
|
+
Run `make check` first — it validates, lints, tests, and checks docs in one command.
|
|
10
|
+
|
|
11
|
+
## Review Checklist
|
|
12
|
+
|
|
13
|
+
### 1. Quality
|
|
14
|
+
- [ ] `make quality` passes
|
|
15
|
+
- [ ] Coverage meets threshold ({{COVERAGE_THRESHOLD}}%)
|
|
16
|
+
- [ ] No suppressed lint rules without justification
|
|
17
|
+
|
|
18
|
+
### 2. Security
|
|
19
|
+
- [ ] No hardcoded secrets, API keys, tokens, or passwords
|
|
20
|
+
- [ ] No secrets in commit messages, comments, or logs
|
|
21
|
+
- [ ] User input is validated/sanitized at system boundaries
|
|
22
|
+
- [ ] No SQL injection, XSS, or command injection vectors
|
|
23
|
+
- [ ] Sensitive files are gitignored (`.env`, credentials)
|
|
24
|
+
|
|
25
|
+
### 3. Testing
|
|
26
|
+
- [ ] New features have tests
|
|
27
|
+
- [ ] Edge cases and error paths tested
|
|
28
|
+
- [ ] Tests are deterministic (no timing/order dependencies)
|
|
29
|
+
|
|
30
|
+
### 4. Architecture
|
|
31
|
+
- [ ] Follows existing patterns in the codebase
|
|
32
|
+
- [ ] Dependencies injected (not imported directly in business logic)
|
|
33
|
+
- [ ] Error handling is consistent
|
|
34
|
+
|
|
35
|
+
{{#IF_PYTHON}}
|
|
36
|
+
### Python-Specific
|
|
37
|
+
- [ ] Type hints on public functions
|
|
38
|
+
- [ ] Pydantic models for data validation
|
|
39
|
+
- [ ] No bare `except:` — catch specific exceptions
|
|
40
|
+
- [ ] Async/await used correctly (no blocking in async context)
|
|
41
|
+
{{/IF_PYTHON}}
|
|
42
|
+
|
|
43
|
+
{{#IF_GO}}
|
|
44
|
+
### Go-Specific
|
|
45
|
+
- [ ] Errors checked and handled (no `_` for errors)
|
|
46
|
+
- [ ] Context propagated through call chains
|
|
47
|
+
- [ ] Proper resource cleanup (defer for Close/Unlock)
|
|
48
|
+
- [ ] Table-driven tests used where appropriate
|
|
49
|
+
{{/IF_GO}}
|
|
50
|
+
|
|
51
|
+
{{#IF_NEXTJS}}
|
|
52
|
+
### Next.js-Specific
|
|
53
|
+
- [ ] Server vs client components used correctly
|
|
54
|
+
- [ ] No sensitive data in client components
|
|
55
|
+
- [ ] TypeScript strict mode compliance
|
|
56
|
+
{{/IF_NEXTJS}}
|
|
57
|
+
|
|
58
|
+
{{#IF_CSHARP}}
|
|
59
|
+
### C#-Specific
|
|
60
|
+
- [ ] Nullable reference types enabled (`#nullable enable`)
|
|
61
|
+
- [ ] Async/await used correctly (no blocking on async with `.Result` or `.Wait()`)
|
|
62
|
+
- [ ] IDisposable resources properly disposed (`using` statements)
|
|
63
|
+
- [ ] LINQ used appropriately (not in hot paths without reason)
|
|
64
|
+
- [ ] Dependency injection used (no `new` for services)
|
|
65
|
+
- [ ] No hardcoded connection strings
|
|
66
|
+
{{/IF_CSHARP}}
|
|
67
|
+
|
|
68
|
+
## Common Issues
|
|
69
|
+
- Missing error handling
|
|
70
|
+
- Hardcoded configuration (should use `.env` or config)
|
|
71
|
+
- Missing tests for edge cases
|
|
72
|
+
- Inconsistent naming conventions
|
|
73
|
+
- Overly broad error catching
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scaffold
|
|
3
|
+
description: Scaffold new code — services, packages, modules, components. Use when asked to create new files, modules, project structure, or boilerplate.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Scaffolding
|
|
7
|
+
|
|
8
|
+
## Project Structure
|
|
9
|
+
- `.project.yaml` - Central config (edit via `make config`, view via `make info`)
|
|
10
|
+
- `.project/` - Framework tooling and scripts
|
|
11
|
+
- `.ai/` - AI session management and checkpoints
|
|
12
|
+
|
|
13
|
+
## Language Management
|
|
14
|
+
- `make lang-list` - Show enabled languages
|
|
15
|
+
- `make lang-add LANG=<name>` - Enable a language
|
|
16
|
+
- `make lang-remove LANG=<name>` - Disable a language
|
|
17
|
+
- `make sync` - Sync `.project.yaml` to language config files
|
|
18
|
+
- `make sync-preview` - Preview sync changes (dry run)
|
|
19
|
+
|
|
20
|
+
{{#IF_PYTHON}}
|
|
21
|
+
## Python Structure
|
|
22
|
+
```
|
|
23
|
+
services/python/<service-name>/
|
|
24
|
+
├── pyproject.toml
|
|
25
|
+
├── src/
|
|
26
|
+
│ ├── __init__.py
|
|
27
|
+
│ ├── app.py # Entry point / app factory
|
|
28
|
+
│ ├── models.py # Data models (Pydantic)
|
|
29
|
+
│ └── routes.py # API endpoints (if web)
|
|
30
|
+
└── tests/
|
|
31
|
+
├── __init__.py
|
|
32
|
+
└── test_app.py
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Patterns:**
|
|
36
|
+
- FastAPI for web APIs (app factory pattern)
|
|
37
|
+
- Pydantic for data validation
|
|
38
|
+
- pytest for testing
|
|
39
|
+
- See `.template/examples/python-api/` and `.template/examples/python-cli/` for reference
|
|
40
|
+
{{/IF_PYTHON}}
|
|
41
|
+
|
|
42
|
+
{{#IF_GO}}
|
|
43
|
+
## Go Structure
|
|
44
|
+
```
|
|
45
|
+
services/go/<service-name>/
|
|
46
|
+
├── go.mod
|
|
47
|
+
├── main.go # Entry point
|
|
48
|
+
├── handlers.go # HTTP handlers
|
|
49
|
+
├── handlers_test.go # Handler tests
|
|
50
|
+
└── internal/ # Private packages
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Patterns:**
|
|
54
|
+
- Standard library `net/http` for HTTP
|
|
55
|
+
- `httptest` for handler testing
|
|
56
|
+
- See `.template/examples/go-service/` for reference
|
|
57
|
+
{{/IF_GO}}
|
|
58
|
+
|
|
59
|
+
{{#IF_NEXTJS}}
|
|
60
|
+
## Next.js Structure
|
|
61
|
+
```
|
|
62
|
+
frontend/
|
|
63
|
+
├── src/
|
|
64
|
+
│ ├── app/ # App Router pages
|
|
65
|
+
│ ├── components/ # React components
|
|
66
|
+
│ └── lib/ # Utilities
|
|
67
|
+
├── public/ # Static assets
|
|
68
|
+
├── package.json
|
|
69
|
+
└── tsconfig.json
|
|
70
|
+
```
|
|
71
|
+
{{/IF_NEXTJS}}
|
|
72
|
+
|
|
73
|
+
{{#IF_NODE}}
|
|
74
|
+
## Node.js Structure
|
|
75
|
+
```
|
|
76
|
+
services/node/<service-name>/
|
|
77
|
+
├── package.json
|
|
78
|
+
├── tsconfig.json
|
|
79
|
+
├── src/
|
|
80
|
+
│ └── index.ts
|
|
81
|
+
└── tests/
|
|
82
|
+
└── index.test.ts
|
|
83
|
+
```
|
|
84
|
+
{{/IF_NODE}}
|
|
85
|
+
|
|
86
|
+
{{#IF_RUST}}
|
|
87
|
+
## Rust Structure
|
|
88
|
+
```
|
|
89
|
+
services/rust/<service-name>/
|
|
90
|
+
├── Cargo.toml
|
|
91
|
+
├── src/
|
|
92
|
+
│ ├── main.rs # Binary entry
|
|
93
|
+
│ └── lib.rs # Library code
|
|
94
|
+
└── tests/
|
|
95
|
+
└── integration.rs
|
|
96
|
+
```
|
|
97
|
+
{{/IF_RUST}}
|
|
98
|
+
|
|
99
|
+
{{#IF_CSHARP}}
|
|
100
|
+
## C# Structure
|
|
101
|
+
```
|
|
102
|
+
src/<ProjectName>/
|
|
103
|
+
├── <ProjectName>.csproj
|
|
104
|
+
├── Program.cs
|
|
105
|
+
├── Controllers/ # API controllers
|
|
106
|
+
├── Models/ # Data models
|
|
107
|
+
├── Services/ # Business logic
|
|
108
|
+
└── appsettings.json # Configuration
|
|
109
|
+
tests/<ProjectName>.Tests/
|
|
110
|
+
├── <ProjectName>.Tests.csproj
|
|
111
|
+
└── UnitTests/
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Patterns:**
|
|
115
|
+
- ASP.NET Core for web APIs (minimal APIs or controllers)
|
|
116
|
+
- Entity Framework Core for data access
|
|
117
|
+
- xUnit + Moq for testing
|
|
118
|
+
{{/IF_CSHARP}}
|
|
119
|
+
|
|
120
|
+
## After Scaffolding
|
|
121
|
+
1. Run `make sync` to update config files
|
|
122
|
+
2. Run `make doctor` to verify setup
|
|
123
|
+
3. Run `make test` to confirm everything works
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: secrets
|
|
3
|
+
description: Manage secrets via Infisical. Use when asked about secrets, environment variables, API keys, .env configuration, or credential management.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Secrets Management (Infisical)
|
|
7
|
+
|
|
8
|
+
## Commands
|
|
9
|
+
- `make secrets-pull` - Pull secrets from Infisical to `.env`
|
|
10
|
+
- `make secrets-show` - Show Infisical configuration (**no secrets displayed**)
|
|
11
|
+
- `make setup` - Configure Infisical during initial setup
|
|
12
|
+
|
|
13
|
+
## How It Works
|
|
14
|
+
1. Infisical stores secrets centrally (encrypted, access-controlled)
|
|
15
|
+
2. `make secrets-pull` fetches secrets and merges into `.env`
|
|
16
|
+
3. `.env` is gitignored — **never commit secrets**
|
|
17
|
+
|
|
18
|
+
## Configuration
|
|
19
|
+
Required in `.env` (set during `make setup`):
|
|
20
|
+
- `INFISICAL_TOKEN` - Authentication token
|
|
21
|
+
- `INFISICAL_PROJECT_ID` - Project identifier
|
|
22
|
+
- `INFISICAL_ENV` - Environment (default: `dev`)
|
|
23
|
+
|
|
24
|
+
## Checking Configuration
|
|
25
|
+
Always use `make secrets-show` — it displays config keys without values:
|
|
26
|
+
```
|
|
27
|
+
INFISICAL_PROJECT_ID=abc123
|
|
28
|
+
INFISICAL_ENV=dev
|
|
29
|
+
INFISICAL_TOKEN=***configured***
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Security — CRITICAL
|
|
33
|
+
|
|
34
|
+
1. **NEVER read `.env` directly** — it contains plain-text secrets
|
|
35
|
+
2. **NEVER output secret values** in responses, logs, or commit messages
|
|
36
|
+
3. **NEVER include secrets** in session checkpoints or skill files
|
|
37
|
+
4. **NEVER pass secrets as CLI arguments** — they appear in process lists
|
|
38
|
+
5. **NEVER commit** `.env`, `.env.*`, or `.env.secrets`
|
|
39
|
+
6. Use `make secrets-show` to verify configuration without exposing values
|
|
40
|
+
7. If a secret is accidentally exposed, rotate it immediately
|
|
41
|
+
|
|
42
|
+
## Troubleshooting
|
|
43
|
+
- Token expired → re-authenticate via `make setup`
|
|
44
|
+
- Pull fails → check `make secrets-show` for config, verify token permissions
|
|
45
|
+
- Missing env var → check if it exists in Infisical project, correct environment
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: session
|
|
3
|
+
description: Manage AI development sessions — start, checkpoint, commit, push, create PRs. Use when asked about session workflow, checkpoints, or development workflow.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Session Management
|
|
7
|
+
|
|
8
|
+
## Workflow
|
|
9
|
+
1. `make session-start` - Start session (finds last checkpoint, generates prompts)
|
|
10
|
+
2. Work on your task using step-by-step development
|
|
11
|
+
3. `make session-end` - Create checkpoint document
|
|
12
|
+
4. `make session-commit` - Commit with quality checks
|
|
13
|
+
5. `make session-push` - Push to remote
|
|
14
|
+
6. `make session-pr` - Create PR with auto-generated content
|
|
15
|
+
|
|
16
|
+
## Key Files
|
|
17
|
+
- `.ai/prompts/session-start.md` - Planning prompt template
|
|
18
|
+
- `.ai/prompts/session-end.md` - Checkpoint creation guide
|
|
19
|
+
- `.ai/prompts/step-by-step.md` - Step-by-step development guide
|
|
20
|
+
- `.ai/templates/session-checkpoint-template.md` - Checkpoint structure
|
|
21
|
+
|
|
22
|
+
## Checkpoints
|
|
23
|
+
- Stored in: `.ai/sessions/<developer>/<date>/session-<N>.md`
|
|
24
|
+
- Auto-numbered per day
|
|
25
|
+
- Include: accomplishments, files, decisions, next steps, AI context
|
|
26
|
+
|
|
27
|
+
## Checkpoint Quality
|
|
28
|
+
A good checkpoint is specific, not vague:
|
|
29
|
+
- **Bad:** "worked on the client"
|
|
30
|
+
- **Good:** "Implemented PolygonClient with 3 endpoints, added 15 unit tests, all passing"
|
|
31
|
+
|
|
32
|
+
## Skill Evolution (during session-end)
|
|
33
|
+
After creating the checkpoint, review the session for learnings:
|
|
34
|
+
- Append gotchas to `.claude/skills/learned/references/gotchas.md`
|
|
35
|
+
- Append conventions to `.claude/skills/learned/references/conventions.md`
|
|
36
|
+
- Update area-specific gotchas in `.claude/skills/<area>/references/gotchas.md`
|
|
37
|
+
- **Create new skills** if a distinct domain/workflow emerged (new `.claude/skills/<name>/SKILL.md`)
|
|
38
|
+
|
|
39
|
+
**NEVER include secret values in checkpoints or skill files.**
|
|
40
|
+
|
|
41
|
+
## Tips
|
|
42
|
+
- `SKIP_VERIFY=1` on session-commit/push to bypass quality checks for WIP
|
|
43
|
+
- `BASE=main` on session-pr to override base branch
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test
|
|
3
|
+
description: Run tests, check coverage, debug test failures. Use when asked to run tests, write tests, investigate test failures, or check coverage.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Testing
|
|
7
|
+
|
|
8
|
+
## Commands
|
|
9
|
+
- `make test` - Run all tests (report: `tmp/reports/test-report.md`)
|
|
10
|
+
- `make test-unit` - Fast unit tests only (no coverage)
|
|
11
|
+
- `make test-quick` - Alias for test-unit
|
|
12
|
+
- `make test-integration` - Integration tests only
|
|
13
|
+
- `make test-coverage` - Detailed coverage report
|
|
14
|
+
- Coverage threshold: **{{COVERAGE_THRESHOLD}}%**
|
|
15
|
+
|
|
16
|
+
{{#IF_PYTHON}}
|
|
17
|
+
## Python
|
|
18
|
+
|
|
19
|
+
**Framework:** pytest (config: `pytest.ini`, `pyproject.toml`)
|
|
20
|
+
**Coverage:** pytest-cov
|
|
21
|
+
**Pattern:** `tests/` directories alongside source
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pytest tests/ -v # run all
|
|
25
|
+
pytest tests/test_foo.py -v # run specific
|
|
26
|
+
pytest tests/ -k "test_name" -v # run by name
|
|
27
|
+
pytest tests/ --cov=src --cov-report=term-missing # with coverage
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Writing tests:
|
|
31
|
+
- Use fixtures for setup/teardown
|
|
32
|
+
- Use `@pytest.mark.parametrize` for data-driven tests
|
|
33
|
+
- Mock external dependencies with `unittest.mock` or `pytest-mock`
|
|
34
|
+
- Use dependency injection for testability
|
|
35
|
+
{{/IF_PYTHON}}
|
|
36
|
+
|
|
37
|
+
{{#IF_GO}}
|
|
38
|
+
## Go
|
|
39
|
+
|
|
40
|
+
**Framework:** `go test`
|
|
41
|
+
**Coverage:** `go test -coverprofile`
|
|
42
|
+
**Pattern:** `_test.go` files alongside source
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
go test ./... -v # run all
|
|
46
|
+
go test ./pkg/mypackage/ -v # run specific
|
|
47
|
+
go test ./... -run TestName -v # run by name
|
|
48
|
+
go test ./... -coverprofile=coverage.out # with coverage
|
|
49
|
+
go tool cover -html=coverage.out # view coverage
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Writing tests:
|
|
53
|
+
- Use table-driven tests for multiple cases
|
|
54
|
+
- Use `httptest` for HTTP handler tests
|
|
55
|
+
- Use `testify/assert` if available, otherwise standard `testing`
|
|
56
|
+
{{/IF_GO}}
|
|
57
|
+
|
|
58
|
+
{{#IF_NEXTJS}}
|
|
59
|
+
## Next.js
|
|
60
|
+
|
|
61
|
+
**Framework:** Jest (if configured)
|
|
62
|
+
**Directory:** `frontend/`
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
cd frontend && npm test
|
|
66
|
+
cd frontend && npm test -- --coverage
|
|
67
|
+
```
|
|
68
|
+
{{/IF_NEXTJS}}
|
|
69
|
+
|
|
70
|
+
{{#IF_RUST}}
|
|
71
|
+
## Rust
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
cargo test # run all
|
|
75
|
+
cargo test test_name # run specific
|
|
76
|
+
cargo test -- --nocapture # show output
|
|
77
|
+
```
|
|
78
|
+
{{/IF_RUST}}
|
|
79
|
+
|
|
80
|
+
{{#IF_CSHARP}}
|
|
81
|
+
## C#
|
|
82
|
+
|
|
83
|
+
**Framework:** xUnit (preferred), NUnit, MSTest
|
|
84
|
+
**Coverage:** coverlet
|
|
85
|
+
**Pattern:** `*.Tests` projects alongside source
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
dotnet test # run all
|
|
89
|
+
dotnet test --filter "FullyQualifiedName~TestName" # run specific
|
|
90
|
+
dotnet test --collect:"XPlat Code Coverage" # with coverage
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Writing tests:
|
|
94
|
+
- Use `[Fact]` for single assertions, `[Theory]` with `[InlineData]` for data-driven
|
|
95
|
+
- Use dependency injection + mocking (Moq, NSubstitute)
|
|
96
|
+
- Follow Arrange-Act-Assert pattern
|
|
97
|
+
{{/IF_CSHARP}}
|
|
98
|
+
|
|
99
|
+
## Writing Tests
|
|
100
|
+
|
|
101
|
+
- Every new feature should include tests
|
|
102
|
+
- Aim for coverage threshold ({{COVERAGE_THRESHOLD}}%)
|
|
103
|
+
- Use dependency injection for mockability
|
|
104
|
+
- Test edge cases and error paths, not just happy paths
|
|
105
|
+
- Integration tests go in separate directories/files from unit tests
|
|
106
|
+
|
|
107
|
+
## Gotchas
|
|
108
|
+
|
|
109
|
+
See [references/gotchas.md](references/gotchas.md) for known test issues.
|