Skip to content
Public template

About

This is a template repo for projects leveraging Claude Code CLI.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Claude Secure Template

ci semgrep secret-scan

A language-agnostic, production-ready template for Claude-first development. Provides secure defaults, AI task routing, BMAD workflow integration, and deterministic CI gates so you can focus on your project rather than its scaffolding.

What's Included

  • AI routing — routes low-risk work to a local Ollama model; escalates to Claude for security, architecture, and cross-cutting changes
  • Security gates — gitleaks secret scanning, semgrep SAST (including MITRE ATLAS AI/ML rules), Trivy container scanning, all enforced in CI
  • BMAD workflow — structured product → engineering planning via the /bmad skill
  • Kanban orchestration — a per-repo GitHub Project board where a human orchestrator hands work to Claude sessions or local models; agents claim issues collision-free via /next-issue and /run-epic (see docs/KANBAN_WORKFLOW.md)
  • Devcontainer — deny-by-default network firewall, pre-installed tooling, Claude CLI with mounted auth volume
  • Agent guardrails — permissions.deny over credential material, a Bash sandbox, and hooks that guard the harness's own config, label external issue/PR text as untrusted data, and scan files for secrets as they are written (see docs/THREAT_MODEL.md)
  • Branch protection bootstrap — one-command GitHub branch protection with required status checks
  • Day-0 validation — /day0-check walks you through every setup step with pass/fail output and remediation hints

How it works

Work comes in as a board card, gets routed by risk — to a human, to Claude, or to a cheaper local model — and every change runs the same security gates before it merges. The whole loop runs inside a devcontainer whose network is deny-by-default.

📊 Open the visual overview → — a one-page briefing (for technical and non-technical readers) covering the devcontainer, the two engines, caveman token compression, and the CI gates. Served from docs/explainer/ via GitHub Pages; the page is self-contained, so you can also open the HTML locally.

  • Routing derives from scripts/route-model.sh; the same Human/Claude/Local decision shows up as the Route field on each board card.
  • Gates are required, not advisory — a red check blocks the merge (see .github/workflows/). This assumes a reviewer other than the author: with a single maintainer, required review is self-review and admins can bypass protection.
  • Caveman trims Claude's prose to cut output tokens and surfaces a live per-session token/cost tally in the statusline (see docs/TEMPLATE_GUIDE.md).

Prerequisites

  • Docker + VS Code Dev Containers extension
  • Git with SSH access to GitHub
  • Claude Code CLI (authenticated before first session)
  • Optional: Ollama on host port 11434 for local model offload

See docs/TEMPLATE_GUIDE.md for the full setup guide including Caveman token compression and PII-Shield (which needs a manual per-machine install, so it is opt-in rather than something this template ships).

Read docs/THREAT_MODEL.md before relying on the security posture, especially its non-goals. In particular: the devcontainer is a host-protection boundary, not a data-containment one. Its firewall allowlist admits the entire GitHub CIDR range, so git push is an accepted exfiltration path rather than a closed one.

Quick Start

  1. Use this template — click "Use this template" on GitHub, or clone and re-init:

    git clone <this-repo> my-project && cd my-project && rm -rf .git && git init
  2. Open in devcontainer — VS Code prompts to reopen; accept. The container installs all tooling automatically on start.

  3. Complete day-0 setup — two browser logins; everything else is applied automatically on container start:

    gh auth login --hostname github.com --git-protocol https --web -s project && gh auth setup-git
    claude auth login
    bash scripts/setup-day0.sh   # finishes the auth-gated bootstraps, prints status

    Verify anytime with bash scripts/check-day0.sh — or from Claude: /day0-check

  4. Validate the template — check structure, syntax, and security-control behaviour:

    bash scripts/validate-template.sh

    A green run means the files are well-formed, the credential deny rules are present, every wired hook is executable, the harness guard both blocks governing files and leaves ordinary ones alone, and routing refuses to send a high-risk security task to the local model. It does not mean the open findings in docs/THREAT_MODEL.md are closed.

Repository Structure

.claude/commands/    Claude Code skills (/bmad, /bmad-to-board, /next-issue, /run-epic, /day0-check, /route-task, /security-audit, /firewall-allow)
.devcontainer/       Dev environment with deny-by-default firewall and pre-installed tooling
.github/             Workflows (CI, secret scan, semgrep, container scan, weekly audit); issue & PR templates
docs/                TEMPLATE_GUIDE.md, AI_ROUTING_POLICY.md, BMAD_WORKFLOW.md, KANBAN_WORKFLOW.md
scripts/             Bootstrap (incl. board), routing, CI helpers, and template validator

Deriving a New Project

When you start a new project from this template:

  1. Replace this README.md with your project README — describe what the project is, not the template it came from.
  2. Add scripts/ci/lint-*.sh and scripts/ci/test-*.sh for your language stack (see scripts/ci/README.md).
  3. Do the two day-0 logins (quick start step 3) — scripts/setup-day0.sh then fills CODEOWNERS, copies configs, applies branch protection, and creates the Kanban board (see docs/KANBAN_WORKFLOW.md).
  4. Replace or remove docs/explainer/ — it describes this template, not your project. If you keep a project explainer there, enable GitHub Pages to serve it (Settings → Pages → Source: "GitHub Actions"); the pages workflow publishes it on the next push. Leave Pages disabled if the page shouldn't be public.

License

Apache 2.0 — see LICENSE.

About

This is a template repo for projects leveraging Claude Code CLI.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages