بنقرة واحدة
claude-code-patterns
Claude Code architecture — artifact design, context, agentic patterns. For CC audit/build.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Claude Code architecture — artifact design, context, agentic patterns. For CC audit/build.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Conformance Walk — freeze-then-judge on the source→delivered→live axis: one cw_core + Source/Delivered/Live adapter families, coverage vs pass-rate, discrete verdicts. Use for any testable surface.
Kailash security (Python) — validation, secrets, injection, authn/z. Hardcoded secrets BLOCKED.
/onboard procedure: read roster + team-memory + posture + claims + codify lease + rules-changed for a new operator joining a multi-operator COC repo.
/certify procedure: brief → probe → gate at 100%; loops failed questions until pass. NO Claude-assistance during gate phase. Curated bank, not LLM-generated.
/ecosystem-init procedure — write the D6 ecosystem-config, run the disclosure scan before write, establish genesis via runEnrollmentCeremony, scaffold non-Kailash STACK.md.
/enroll procedure — register an operator into an existing ecosystem via /whoami --register (roster, PR-gated) + seed per-operator gitignored local-links, then hand off to /onboard.
| name | claude-code-patterns |
| description | Claude Code architecture — artifact design, context, agentic patterns. For CC audit/build. |
| allowed-tools | ["Read","Glob","Grep"] |
Reference patterns for designing effective Claude Code artifacts and understanding CC's internal architecture.
| Type | Layer | Purpose | Token Target | Quality Test |
|---|---|---|---|---|
| Agent | L1 Intent | Teach judgment + procedure | 150-400 lines | Completes task without clarification |
| Skill | L2 Context | Teach knowledge + reference | 150-250 lines (SKILL.md) | Answers 80% of routine questions |
| Rule | L3 Guardrails | Enforce boundaries | 50-150 lines | Zero violations in scope |
| Command | L4 Instructions | Orchestrate workflows | 50-150 lines | Predictable, verifiable output |
| Hook | L3 Guardrails | Deterministic prevention | 20-80 lines (JS) | 100% enforcement, no exceptions |
send → check stop_reason → execute tools → append → repeat
stop_reason == "end_turn" is the ONLY termination signalSubagents do NOT share memory with coordinator or each other. All context must be passed explicitly via structured metadata (source URLs, doc names, page numbers).
14+ items in single pass → inconsistent depth. Fix: per-item analysis pass, then cross-item synthesis pass.
| Strategy | When | Mechanism |
|---|---|---|
| Resume | Same task, no external changes | --resume |
| Fork | Explore alternative approach | Parallel worktrees |
| Fresh + Summary | Stale context, switching focus | New session + /wrapup notes |
Tool descriptions are for the MODEL, not humans. Include: what it does, inputs, example queries, boundaries vs similar tools.
18+ tools → <70% selection accuracy. Split into specialized subagents.
| Category | Retryable | Action |
|---|---|---|
| Transient | Yes | Wait and retry |
| Validation | After fix | Fix input, retry |
| Business | No | Alternative workflow |
| Permission | No | Escalate |
Distinguish access failure ("DB unreachable") from valid empty result ("no orders found").
"Be conservative" → fails intermittently. "Flag only when claimed behavior contradicts code" → reliable.
Include a "resist extraction" example (when NOT to act). Reasoning blocks teach generalization, not pattern matching.
"type": ["string", "null"] for optional fields (not "nullable": true)"unclear" enum value for genuine ambiguity"other" + detail field for extensible categoriesrequired fields that are always in the source — required = fabrication pressureWorks for: format errors, structural errors, misplaced values. Fails for: information not in source, fabrication, genuine ambiguity.
Transactional data ($247.83, order #8891) gets compressed to "customer wants refund." Fix: persistent case facts block, never summarized.
Critical info at beginning/end of context. Middle gets less attention. Trim tool results to needed fields.
| Stakes | Enforcement |
|---|---|
| Money, security, compliance | Hook (100% deterministic) |
| Style, formatting, preferences | Prompt (~95% probabilistic) |
rules/agents.md worktree MUSTs and rules/worktree-isolation.mdrules/agents.md § "MUST: Audit/Closure-Parity Verification Specialist Has Bash + Read"rules/governed-throughput.md + throttle-aware concurrency (rules/worktree-isolation.md Rule 4): read-only fan-out, verify→implement pipeline, schema returns, resumeFromRunId, the L2 curated-slice injection, the journal/0193 over-injection-degrades evidencerules/multi-operator-coordination.md (the always-on rule carries only the agent-facing behavioral contract)rules/multi-operator-coordination.md MUST-7rules/user-flow-validation.md (the always-on rule carries only the walk/receipts/scrub tripwires)rules/journal-author-discipline.mdrules/agents.md § "Redteam Reviewer Dispatch".claude/ directoryco-reference skill — CO methodology (principles, layers)co-reference skill — COC methodology (five-layer implementation)