Skip to content

Commit 778bc15

Browse files
committed
Add claude instruction files
1 parent 515841c commit 778bc15

3 files changed

Lines changed: 117 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Cloud Harness
2+
3+
Cloud Harness provides software infrastructure and tools for neuroscience data computing and analysis in a monorepo.
4+
5+
## Repository Layout
6+
7+
- `applications/` — Cloud Harness custom server applications
8+
- `client/` — generated client API
9+
- `deployment/` — deployment-related scripts and files
10+
- `deployment-configuration/` — deployment customization files
11+
- `infrastructure/` — infrastructure utilities
12+
- `libraries/` — Cloud Harness shared libraries
13+
- `docs/` — developer documentation
14+
- `tools/` — Cloud Harness CLI and other tools
15+
- `test/` — test utilities and test code
16+
17+
Before working on a task, identify which application/component is in scope and read any `CLAUDE.md` inside that subtree.
18+
19+
## Environment Setup
20+
21+
- **Conda environment**: `ch` (Python 3.12+) — activate with `conda activate ch`
22+
- **Frontend package manager**: Yarn — **never** use npm
23+
- **Backend package manager**: pip — only inside the conda environment
24+
25+
Always activate `conda activate ch` before any backend command.
26+
27+
## Development Principles
28+
29+
- Configuration lives in `values.yaml` files and is injected via Helm templates and Kubernetes manifests. Never hardcode configuration in application code or templates.
30+
- Structured configuration can be injected via resources processed by Helm templates and loaded as ConfigMaps automatically (e.g. `applications/accounts/deploy/resources/realm.json`).
31+
- The Cloud Harness configuration API is defined as an [OpenAPI spec](libraries/models/api/openapi.yaml). Run `harness-generate models` after changing the spec.
32+
33+
## Code Style
34+
35+
- Keep architecture lean — avoid unnecessary layers and abstractions.
36+
- Use **utils** for stateless pure functions that don't touch external data sources or the ORM.
37+
- Use **helpers** for pieces of business logic; keep them stateless when possible.
38+
- Use **services** for business workflows and cross-model coordination.
39+
- Keep model logic close to the model when it represents domain rules or invariants.
40+
- Handle exceptions only at the highest level; let lower layers raise. Never catch in helpers or services unless adding context and re-raising.
41+
- Cover critical logic with unit tests, especially helpers and services. Use mocks to isolate units.
42+
- Prefer model classes for helpers and services. Use typed dicts for structured data not covered by schema classes. Use plain dicts only for genuinely unstructured data. Avoid returning tuples.
43+
- Bubble exceptions up to where they can be handled. Avoid return-value error signalling. Wrap library and untyped exceptions in custom exceptions with clear meaning.
44+
45+
## Important Constraints
46+
47+
- **Never** create README or documentation files unless explicitly requested.
48+
- **Never** start development servers — assume they are already running.
49+
- **Always** ask before opening a browser.
50+
- **Frontend**: Yarn only. **Backend**: pip inside the `ch` conda environment only.
51+
52+
53+
# Using Cloudharness CLI Tools
54+
55+
## Environment
56+
- Activate `conda activate ch` before any backend command.
57+
- Run `sh install.sh` to install cli tools
58+
59+
## Key Scripts
60+
61+
- `harness-generate` — generate code
62+
- `harness-deployment` — generate deployment files (Helm charts, CI/CD files, etc.)
63+
- `harness-application` — generate application code (e.g. Django apps)
64+
- `harness-migrate` — migration helper
65+
- `ch_cli_tools` — Python package for deployment and other tools
66+
- `tests/` — unit test utilities

test/e2e/CLAUDE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# E2E Tests
2+
3+
**Framework**: Jest + Puppeteer. Follow patterns in existing `*.spec.ts` files.
4+
5+
## Login Flow
6+
7+
Tests that point `APP_URL` at the accounts domain must handle the 2-step login redirect:
8+
9+
1. Navigate to `APP_URL` and detect the redirect to accounts.
10+
2. Enter the username from `USERNAME`, submit, wait for the password field.
11+
3. Enter the password from `PASSWORD`, submit.
12+
4. Wait for redirect back to the app and confirm the expected route.
13+
14+
## Stability Requirements
15+
16+
- **Waits**: always use explicit Puppeteer waits (`waitForSelector`, `waitForFunction`, `waitForNavigation`) with timeouts.
17+
- **Selectors**: use stable custom selectors from `test/e2e/selectors.ts`. Never depend on UI copy, text content, or fragile DOM structure.
18+
- **No fixed sleeps** unless there is no deterministic signal — prefer state-based waits.
19+
- **Resilience**: guard against flaky overlays (cookie/announcement modals) where possible.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Deployment CLI Tools
2+
3+
## Environment
4+
5+
- Activate `conda activate ch` before any backend command.
6+
- Use pip (inside `ch`) for backend dependencies; Yarn for any frontend work.
7+
8+
## Key Scripts
9+
10+
- `harness-generate` — generate code
11+
- `harness-deployment` — generate deployment files (Helm charts, CI/CD files, etc.)
12+
- `harness-application` — generate application code (e.g. Django apps)
13+
- `harness-migrate` — migration helper
14+
- `ch_cli_tools` — Python package for deployment and other tools
15+
- `tests/` — unit test utilities
16+
17+
## Code Style
18+
19+
Follow the project-wide style in the root [CLAUDE.md](../../CLAUDE.md). Key points for this package:
20+
21+
- Keep architecture lean — avoid unnecessary layers and abstractions.
22+
- Utils: stateless pure functions, no ORM or external data sources.
23+
- Helpers: stateless business logic pieces.
24+
- Services: business workflows and cross-model coordination.
25+
- Bubble exceptions up; never swallow them silently in helpers or services.
26+
- Cover critical logic with unit tests using mocks to isolate units.
27+
28+
## Constraints
29+
30+
- Never start development servers.
31+
- Never create documentation files unless explicitly asked.
32+
- Always use pip inside `ch` conda env; never use npm.

0 commit comments

Comments
 (0)