skills/init-project/SKILL.md
# Init Project Unified project initialization hub with subcommand routing. Detects, scaffolds, documents, and refines an OpenCode JOC project. Works for both first-time setup and iterative re-runs. ## When to Use - First time setting up JOC in a project - Adding JOC to an existing codebase - Refreshing config after major changes (refactors, new deps, team growth) - Re-running to capture new context and refine docs - Replacing `/joc-setup`, `/deepinit`, or `/init-project-config` ## No-Argumen
npx skillsauth add Thomashighbaugh/opencode skills/init-projectInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Unified project initialization hub with subcommand routing. Detects, scaffolds, documents, and refines an OpenCode JOC project. Works for both first-time setup and iterative re-runs.
/joc-setup, /deepinit, or /init-project-configWhen invoked without arguments (/init-project), list the subcommands as plain text and ask the user to choose. Do NOT call hubMenu or any other tool — just output the list directly. Available phases: setup, detect, docs, context, verify, refresh, status, map-codebase, doctor.
Directly invoke the matching subcommand. Print the reminder, then delegate to the appropriate phase or agent.
| Subcommand | Phases | Skill/Delegate | What It Does |
|------------|--------|----------------|--------------|
| setup | 0-7 | self (all phases) | Full project initialization from scratch |
| detect | 0-1 | explore agent | Verify global JOC + detect language, framework, tooling |
| docs | 4 | deepinit skill | Regenerate hierarchical AGENTS.md documentation |
| context | 5 | remember + wiki | Capture session knowledge, promote insights |
| verify | 7 | verifier agent | Validate configuration completeness and integrity |
| refresh | 0-7 (merge) | self (all phases, merge mode) | Update existing config, preserve manual edits |
| status | — | self (inline) | List state files and show checkpoint progress |
Each subcommand follows the hub pattern:
.opencode/state/init/| Subcommand | Reminder on Invoke |
|------------|-------------------|
| setup | Full init from scratch. I'll verify global JOC, detect your stack, scaffold config, generate docs, and validate. |
| detect | Detecting your project stack. I'll identify language, framework, package manager, build system, and CI. |
| docs | Generating codebase documentation. I'll create hierarchical AGENTS.md files across your directories. |
| context | Capturing session knowledge. I'll promote insights to project memory, notepad, and AGENTS.md. |
| verify | Validating configuration. I'll check file existence, config syntax, parent refs, and gitignore. |
| refresh | Updating existing config. I'll preserve your manual edits and merge new detections. |
| status | Showing init state and checkpoint progress. |
Flags modify subcommand behavior and are passed through:
| Flag | Effect | Applies To |
|------|--------|------------|
| --minimal | Essential files only, no docs | setup, refresh |
| --full | Everything including context and routing | setup, refresh |
| --force | Skip "already exists" checks | setup, refresh, docs |
| --language <lang> | Force language, skip detection | setup, detect, refresh |
| --no-detect | Use generic defaults | setup, refresh |
| --no-docs | Skip Phase 4 | setup, refresh |
Default (no flags, setup subcommand): Phases 0-4 (full scaffold + docs, no context/routing).
Init state lives in .opencode/state/init/ (gitignored).
| Path | Purpose |
|------|---------|
| .opencode/state/init/init-checkpoint.json | Last completed phase checkpoint |
| .opencode/state/init/init-detection.json | Phase 1 detection results |
| .opencode/state/init/init-plan.json | Phase 2 initialization plan |
| .opencode/state/init/init-report.md | Phase 7 verification report |
| .opencode/state/init/ | All init state files |
{
"lastCompletedPhase": 3,
"timestamp": "2024-01-15T10:30:00Z",
"subcommand": "setup",
"mode": "full",
"files": [
".opencode/opencode.jsonc",
".opencode/AGENTS.md",
".opencode/state/"
]
}
.opencode/state/init/ with timestamps/init-project setup --full completion can trigger /harvest-context offer/init-project docs output feeds into /ideation as project context/init-project verify results can inform /project operations/ideation final plans may reference /init-project detection results| Phase | Agent/Skill | Purpose |
|-------|-------------|---------|
| 0 - Global Verify | self | Ensure ~/.config/opencode/ is healthy |
| 1 - Detection | explore | Scan project files, detect language/framework |
| 2 - Planning | planner | Generate initialization plan from detection |
| 3 - Scaffolding | executor | Create .opencode/ structure, opencode.jsonc, AGENTS.md |
| 4 - Docs | deepinit | Hierarchical AGENTS.md across codebase |
| 5 - Context Capture | remember + wiki | Promote session knowledge, scan state artifacts |
| 6 - Routing | architect | Optimize agent selection for detected stack |
| 7 - Verification | verifier | Validate completeness, references, config |
Full project initialization from scratch. Runs all applicable phases (0-7 by default, 0-3 with --minimal, 0-7 with --full).
Before starting any phases, determine scope:
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
OPENCODE_DIR="$PROJECT_ROOT/.opencode"
GLOBAL_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}"
if [ -d "$OPENCODE_DIR" ] && [ -f "$OPENCODE_DIR/opencode.jsonc" ]; then
IS_RERUN="true"
echo "Existing .opencode/ configuration found — running in refresh mode"
else
IS_RERUN="false"
echo "No .opencode/ found — running initial setup"
fi
if [ -f "$GLOBAL_DIR/AGENTS.md" ] && [ -f "$GLOBAL_DIR/opencode.jsonc" ]; then
GLOBAL_HEALTHY="true"
else
GLOBAL_HEALTHY="false"
echo "WARNING: Global JOC config incomplete or missing"
fi
If IS_RERUN=true and no --force or --refresh flag was passed, ask:
Question: "This project already has .opencode/ configured. What would you like to do?"
Options:
--force)docs subcommand)Run phases sequentially, saving checkpoints after each phase:
.opencode/--minimal or --no-docs)--full)--full)Save checkpoint after each phase to .opencode/state/init/init-checkpoint.json.
On completion, display summary and offer next step:
--minimal: Offer /init-project docs/init-project context or /init-project verify--full: Offer /harvest-contextVerify global JOC installation and detect project configuration. Phases 0-1 only.
~/.config/opencode/ for essential files.opencode/state/init/init-detection.jsonDelegate Phase 1 to explore agent. See phases/01-detection.md for full detection sequence.
{
"language": "typescript",
"framework": "nextjs",
"packageManager": "npm",
"buildSystem": "tsc",
"directories": ["src", "tests", "docs", ".github"],
"ci": "github-actions",
"confidence": "high"
}
On completion, offer next step: /init-project setup or /init-project docs
Regenerate hierarchical AGENTS.md documentation. Phase 4 only.
.opencode/state/init/init-detection.json — if missing, run detect firstdeepinit skill for documentation generationphases/04-documentation.md for full workflowWhen AGENTS.md files already exist:
<!-- MANUAL --> annotationsOn completion, offer next step: /init-project context or /init-project verify
Capture session knowledge and promote insights to durable documentation. Phase 5 only.
.opencode/state/ for useful artifactsremember skill to classify session knowledgeproject-memory.json with durable project factsnotepad.md with high-signal session contextOn completion, offer next step: /init-project verify
Validate configuration completeness and integrity. Phase 7 only.
See phases/05-verification.md for full verification checklist.
Display verification report:
✓ Project initialized: {project_name}
Created/Updated:
.opencode/opencode.jsonc ✓
.opencode/AGENTS.md ✓
.opencode/rules/*.md 3 files
.opencode/state/ ✓
Verified:
✓ All required files present
✓ Configuration syntax valid
✓ AGENTS.md structure complete
✓ Parent references valid
✓ .gitignore configured
✓ State directories created
Update existing configuration, preserving manual edits. Phases 0-7 in merge mode.
Identical to setup but in merge mode:
.opencode/opencode.jsonc and AGENTS.md<!-- MANUAL --> blocks in AGENTS.md filesEquivalent to setup with --refresh flag.
List initialization state files and show checkpoint progress. No phases.
STATE_DIR=".opencode/state/init"
echo "=== Init Project State ==="
if [ -f "$STATE_DIR/init-checkpoint.json" ]; then
echo "Last checkpoint:"
cat "$STATE_DIR/init-checkpoint.json"
else
echo "No checkpoint found — project not yet initialized"
fi
echo ""
echo "State files:"
ls -la "$STATE_DIR/" 2>/dev/null || echo " (none)"
echo ""
echo "Detection results:"
if [ -f "$STATE_DIR/init-detection.json" ]; then
cat "$STATE_DIR/init-detection.json"
else
echo " No detection results — run detect first"
fi
Detailed phase documentation is in phases/:
phases/01-detection.md — Language, framework, tooling detectionphases/02-planning.md — Configuration planningphases/03-configuration.md — Scaffolding and file generationphases/04-documentation.md — Hierarchical AGENTS.md generationphases/05-verification.md — Validation and integrity checksThis command is safe to re-run. It:
<!-- MANUAL --> blocks in AGENTS.md filesIf a phase fails, save checkpoint:
mkdir -p ".opencode/state/init"
echo "{\"lastCompletedPhase\":$COMPLETED_PHASE,\"timestamp\":\"$(date -Iseconds)\"}" > ".opencode/state/init/init-checkpoint.json"
Resume with /init-project setup --force or /init-project refresh.
deepinit skill — Standalone docs generation (called by docs subcommand)remember skill — Context promotion (called by context subcommand)wiki skill — Persistent knowledge base (used by context subcommand)mcp-setup skill — MCP server configurationjoc-doctor skill — Diagnose installation issues/ideation hub — Planning and research/orchestrate hub — Execution patterns/harvest-context hub — Context and artifact extractiondocumentation
Agentic memory system for writers - track characters, relationships, scenes, and themes
documentation
LLM Wiki — persistent markdown knowledge base that compounds across sessions (Karpathy model)
tools
Use ONLY when the user explicitly says: 'use the skill web-to-markdown ...' (or 'use a skill web-to-markdown ...'). Converts webpage URLs to clean Markdown by calling the local web2md CLI (Puppeteer + Readability), suitable for JS-rendered pages.
testing
Structured visual QA verdict for screenshot-to-reference comparisons