Skill

/hanzo-web:init

Prepara un proyecto para usar el plugin: detecta cómo está hecho, te pregunta lo que falta y genera su contexto local.

Fuente: plugins/hanzo-web/skills/init/SKILL.md · hanzo-web v0.2.0

  • Claude Code /hanzo-web:init
  • Cursor /init

Cuándo usarlo

La primera vez que usas el plugin en un proyecto, y después de cambios grandes (apps, sitios o entornos nuevos) para refrescar el contexto.

Qué hace

  • Detecta las apps de Next y Strapi, el modelo de contenido, los sitios, la constante de versión de las releases y el CI.
  • Si el proyecto ya estaba preparado, te enseña qué ha cambiado y solo lo actualiza con tu visto bueno.
  • Te pregunta de una vez lo que no puede detectar: Jira, remote de GitLab, URLs de PRE y PRO, sitios y limpieza diaria de worktrees.
  • Escribe .claude/hanzo-project.json y CLAUDE.local.md en el checkout principal. No se versionan.
  • Comprueba que el contexto se carga y que el gate de CodeClimate encuentra ESLint.

Qué te entrega

Los dos ficheros de contexto, los valores que conviene revisar a mano y los agentes o skills propios del proyecto que se solapan con el plugin.

Pídelo así

/hanzo-web:init

O con tus palabras: «inicializa el proyecto», «genera el contexto», «configura hanzo-web».

A tener en cuenta

Si ya tenías un CLAUDE.local.md propio, hace una copia de seguridad antes de reescribirlo. Al terminar, abre una sesión nueva (o /clear) para cargar el contexto.

Definición en el plugin

Las instrucciones que sigue la skill, tal como están en el plugin (en inglés).

Qué hace

Set up (or refresh) the Claude context of a Hanzo web project built with Next.js + Strapi:
  • detects apps, Strapi content model, sites, release constant and CI
  • asks for the rest (Jira, environments)
  • writes .claude/hanzo-project.json and CLAUDE.local.md so the hanzo-web rules, skills and agents work in that repository

Cuándo usarlo

Use when the user says:
  • "inicializa el proyecto"
  • "genera el contexto"
  • "configura hanzo-web"
or the session context suggests running it.

Paths: ${CLAUDE_PLUGIN_ROOT} is this plugin's folder (Claude Code expands it). If you see it literally (e.g. in Cursor), use the "Plugin scripts" path from the session context, or the plugin folder two levels above this skill (../../ from the folder of this SKILL.md).

Generates the project-specific half of the context. The shared half (rules, skills, agents, scripts) lives in this plugin and is injected at session start once .claude/hanzo-project.json exists.

Files it writes, all in the main checkout and local-only (excluded via .git/info/exclude, never committed unless the user asks):

  • .claude/hanzo-project.json — machine-readable settings used by the scripts and skills (schema: ${CLAUDE_PLUGIN_ROOT}/templates/hanzo-project.example.json).
  • CLAUDE.local.md — project facts for humans and agents (template: ${CLAUDE_PLUGIN_ROOT}/templates/CLAUDE.local.md).

1. Detect

  1. Find the main checkout: parent of git rev-parse --path-format=absolute --git-common-dir. Work there, not in a worktree.
  2. node "${CLAUDE_PLUGIN_ROOT}/scripts/detect-project.mjs" <main> → JSON with git remotes and branches, Next app (version, router, static export, un-hashed CSS classes, Hanzo packages, block map), Strapi app (version, SQLite DB, content types, dynamic zones, component categories, local plugins), site env files, release constant, CI includes/stages, and existing Claude files.
  3. If it's not a Next.js + Strapi repo (no next or no @strapi/strapi), say so and stop.
  4. Fill what the JSON can't tell by reading a few files: locales (Strapi i18n locales in the DB i18n_locale table read-only, or the Next/i18n config), the block renderer and how it maps __component, the navigation single type per site (env vars), whether dynamic-zone blocks are usually added to several content types.

2. Existing setup

  • .claude/hanzo-project.json exists → refresh mode: show what changed vs the detected values and update only with the user's OK.
  • CLAUDE.local.md exists and was not generated by this skill → don't overwrite it. Keep a copy at CLAUDE.local.md.bak-<date>, then build the new file: project-specific facts and lessons from the old file go into Project facts / Local notes; sections that the plugin now covers (Jira start question, CodeClimate, MR template, releases, local testing procedure, worktree cleanup, agents table) are dropped. Show the user the list of what was moved, kept and dropped before writing.
  • Project-local .claude/agents / .claude/skills with the same role as the plugin's (e.g. code-reviewer, release) → list them and suggest removing them once the plugin versions are validated, because both would load. Project-specific details they contain go into Project facts. Never delete them without an explicit yes.

3. Ask (one AskUserQuestion, only what wasn't detected)

  • Jira project key and board URL (or "no Jira").
  • GitLab remote to push to, if there are several (default: the one on the Hanzo GitLab host, usually origin). Develop / production branch names if not detected.
  • PRE and PRO URLs, and whether PRE is deployed automatically or by hand.
  • Sites: confirm the detected envs-build-* files and the base path of each site.
  • Daily worktree cleanup (macOS launchd) yes/no and hour.

4. Write

  1. .claude/hanzo-project.json following the example schema: project (name, slug kebab-case), jira, gitlab (host, project, remote), git (develop, production), apps (next, strapi), codeclimate.srcDirs (from suggestedSrcDirs), release (versionFile, versionConst), local (strapiPort 1337, nextPort 3000, strapiDb), sites (id, envFile, basePath), locales, defaultLocale, environments (pre, pro), worktrees (dir .claude/worktrees, dailyCleanup).
  2. CLAUDE.local.md from the template: replace every {{…}} with detected/answered values written as short prose or lists. Drop a line rather than leaving a placeholder or "unknown". Keep it factual and short; no generic rules (those are in the plugin).
  3. Append to .git/info/exclude (if missing): /CLAUDE.local.md, /CLAUDE.local.md.bak-*, /.claude/hanzo-project.json, /.claude/worktrees/.
  4. Daily cleanup, if chosen: follow the "Daily automatic cleanup" section of /hanzo-web:clean-worktrees.

5. Check and report

  • Run CLAUDE_PROJECT_DIR=<main> "${CLAUDE_PLUGIN_ROOT}/scripts/session-context.sh" | head -20 to confirm the context is injected.
  • Run node "${CLAUDE_PLUGIN_ROOT}/scripts/quality-gate-local.mjs" <main> to confirm the CodeClimate script finds ESLint and the source dirs.
  • Tell the user: files written, values that need a human check, the old project agents/skills that overlap with the plugin, and that a new session (or /clear) loads the new context.