Skip to content

Commit 0576308

Browse files
baijumclaude
andcommitted
feat: add Claude skills and hooks for platform workflows
Add project-specific skills (/validate, /setup-repo, /docs-preview) and an auto-invoked spec-context skill. Add PostToolUse hook to remind about doc cross-references when editing docs/ files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 411c53a commit 0576308

5 files changed

Lines changed: 110 additions & 0 deletions

File tree

.claude/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"hooks": {
3+
"PostToolUse": [
4+
{
5+
"matcher": "Edit|Write",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "filepath=\"$TOOL_INPUT_file_path\"; case \"$filepath\" in */docs/*) echo '[Hook] Editing a docs/ file — check cross-references between spec.md, ecosystem.md, governance.md, and ROADMAP.md' ;; esac; exit 0"
10+
}
11+
]
12+
}
13+
]
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
disable-model-invocation: true
3+
allowed-tools: Bash
4+
description: Start MkDocs local server for documentation preview
5+
---
6+
7+
# /docs-preview — Preview Documentation
8+
9+
Start a local MkDocs development server for previewing documentation.
10+
11+
## Instructions
12+
13+
1. Run `mkdocs serve` in the background
14+
2. Tell the user to visit http://127.0.0.1:8000
15+
3. If mkdocs is not installed, suggest: `pip install mkdocs`

.claude/skills/setup-repo/SKILL.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
disable-model-invocation: true
3+
allowed-tools: Bash
4+
argument-hint: "<repo-name>"
5+
description: Run the governance setup script for a towlion repository
6+
---
7+
8+
# /setup-repo — Configure Repository Governance
9+
10+
Run the governance setup script to configure repo settings, branch protection, and standard labels for a towlion repository.
11+
12+
## Instructions
13+
14+
1. `$ARGUMENTS` must contain the repository name (e.g., `app-template`, `uku-companion`)
15+
2. If no argument is provided, tell the user they need to specify a repo name
16+
3. Run: `bash scripts/setup-repo.sh $ARGUMENTS`
17+
4. Show the output to the user
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
user-invocable: false
3+
description: Use when discussing app structure, deployment, or spec compliance
4+
---
5+
6+
# Towlion Spec Context (v1.0)
7+
8+
Key rules from the Towlion platform specification:
9+
10+
## Required Structure
11+
- `app/` — FastAPI backend with `Dockerfile` and `main.py`
12+
- `deploy/``docker-compose.yml`, `docker-compose.standalone.yml`, `Caddyfile`, `env.template`
13+
- `.github/workflows/deploy.yml`
14+
- `scripts/health-check.sh`
15+
- `README.md`
16+
- `frontend/` — optional (Next.js)
17+
18+
## Backend
19+
- HTTP server on **port 8000**: `uvicorn app.main:app --host 0.0.0.0 --port 8000`
20+
- Health endpoint: `GET /health` returns `200` with `{"status": "ok"}`
21+
22+
## Environment Variables
23+
- **Required**: `APP_DOMAIN`, `DATABASE_URL`, `REDIS_URL`
24+
- **Optional**: `S3_ENDPOINT`, `S3_BUCKET`, `S3_ACCESS_KEY`, `S3_SECRET_KEY`, `EMAIL_API_KEY`, `EMAIL_FROM`
25+
26+
## Dependencies
27+
- `requirements.txt` (at repo root) or `pyproject.toml`
28+
- Must include `fastapi` and `uvicorn`
29+
30+
## Docker
31+
- `app/Dockerfile` is required, `frontend/Dockerfile` if frontend exists
32+
- Container must expose port 8000 and read config from env vars
33+
34+
## Compose Files
35+
- `docker-compose.yml` — app containers only (multi-app setup, no infra)
36+
- `docker-compose.standalone.yml` — full stack with postgres/redis/minio/caddy (for self-hosted forks)
37+
38+
## Validation Tiers
39+
- **Tier 1**: Structure — required files and directories exist
40+
- **Tier 2**: Content — YAML valid, port 8000 referenced, env vars present, FastAPI used, no hardcoded secrets
41+
- **Tier 3**: Runtime — containers build, compose validates, health endpoint responds

.claude/skills/validate/SKILL.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
disable-model-invocation: true
3+
allowed-tools: Bash, Read
4+
argument-hint: "[path-to-app-repo]"
5+
description: Run the Towlion spec validator against an application repository
6+
---
7+
8+
# /validate — Run Spec Validator
9+
10+
Run the Towlion spec conformance validator against an app repo.
11+
12+
## Instructions
13+
14+
1. Determine the target directory:
15+
- If `$ARGUMENTS` is provided, use it as the path
16+
- Otherwise, default to the current working directory
17+
2. Run: `python validator/validate.py --tier 2 --dir <target>`
18+
- The validator script is at `validator/validate.py` in the platform repo
19+
- Use tier 2 by default (structure + content checks)
20+
- If the user specifies `--tier 1` or `--tier 3` in arguments, respect that
21+
3. Show the output to the user
22+
4. If there are failures, summarize what needs to be fixed

0 commit comments

Comments
 (0)