bsene/skills

explain-code

Explains code with C4 model diagrams, analogies, and step-by-step walkthroughs.

소스 보기
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

Explain Code

Workflow

  1. Start with an analogy — compare the code to something from everyday life
  2. Pick the right C4 level — match diagram depth to the question; default Level 2 (Container)
  3. Draw the diagram — render it as an ASCII box diagram directly in the response (no external tooling). Pick the C4 level per step 2, then build boxes/arrows with plain characters (+ - | v ^ <- ->), keeping lines within ~80 columns so it stays readable in a terminal or chat window. Label each box with the component name (and a one-line responsibility if it fits), and label arrows with the action or event that flows along them.
  4. Walk through the code — trace inputs to outputs in narrative form: what enters, which functions/modules touch it in order, where state changes, what exits. Name the data, not just the steps.
  5. Highlight a gotcha — what's a common mistake or misconception?

Keep explanations conversational. For complex concepts, use multiple analogies.

Example output shapes

Single function

Analogy: debounce is like a snooze button — it delays acting until you've stopped poking it. Walkthrough: Call starts the timer (setTimeout). Another call before the timer fires clears it and restarts (clearTimeout). Timer fires → callback executes once. Gotcha: The returned function captures timer via closure — each call site needs its own debounce(fn, ms) instance, or they'll share the same timer.

Multi-class system

Analogy: This auth service is like a bouncer at a club — it checks your ID (token) before letting you into any room (endpoint). `` +--------+ token +----------------+ validate +-------------+ | Client | ---------> | AuthMiddleware | -----------> | TokenCache | +--------+ +----------------+ +-------------+ | claims v +---------------+ | UserService | +---------------+ | user record / UnauthorizedError v +---------------+ | Endpoint | +---------------+ **Walkthrough:** Request arrives at the HTTP adapter → AuthMiddleware validates the JWT → decoded claims passed to UserService.resolve() → user record returned or UnauthorizedError thrown. **Gotcha:** AuthMiddleware is stateless but relies on TokenCache` — if cache is cold, every request hits the DB.

Multi-service architecture

Analogy: This checkout pipeline is like a relay race — each service passes a baton (order event) to the next leg before it can proceed. `` +---------------+ order.created +------------------+ stock.reserved +-----------------+ | OrderService | ---------------> | InventoryService | -----------------> | PaymentService | +---------------+ +------------------+ +-----------------+ ^ | | | compensating event (on failure) | | payment.captured +------------------------------------+ v +----------------------+ | NotificationService | +----------------------+ **Walkthrough:** OrderService emits order.created to the message bus → InventoryService reserves stock and emits stock.reservedPaymentService charges and emits payment.capturedNotificationService` sends confirmation email. Failure at any step emits a compensating event to roll back upstream. Gotcha: Each service is independently deployable but the saga has no central coordinator — debugging a failed order requires tracing correlation IDs across 4 service logs.

Benchmark

Scenario: .benchmarks/scenarios/explain-code-001-worker-walkthrough.md · Run: 2026-08-31 · Log: .benchmarks/runs/2026-08-31/explain-code-001-worker-walkthrough.json

ModelWithoutWithDelta
claude-opus-4-850%100%+50%
claude-sonnet-4-650%100%+50%
claude-haiku-4-550%100%+50%
PASS (run 2026-08-31). Uniform +50 — largest floor lift in this cycle. Gate per .agents/skills/skill-optimizer/rules/release-gates.md.
같은 저장소의 Skills

더 많은 Skills

모든 Skills
bsene
커뮤니티

c4-diagram

Generates C4 model architecture diagrams using Structurizr DSL (primary) or Mermaid C4 (fallback). Use when: user asks to "draw a diagram", "create a C4 diagram", "show architecture as a diagram", "generate architecture diagram", "document the system". DO NOT USE for code explanation or walkthroughs (use explain-code), class/sequence/ER diagrams (C4 is system-architecture only), or when a diagram is incidental to a code change — only when a C4 diagram is the primary deliverable.

설치 수
1
GitHub Stars
5
업데이트
9월 21일
bsene
커뮤니티

clean-code

Use when writing new code, naming modules/files/functions/classes/variables, reviewing or refactoring code for readability, assessing/reducing complexity, deciding whether an abstraction belongs, or reviewing with CUPID. For behavior-preserving refactors within a function, class, or file, route to the refactoring/ sub-skill. Trigger on requests like "name this function", "is this a good variable name", "review this for clean code", "reduce complexity", "should I add a comment here", "should I abstract this", "review with CUPID", "code smell", "extract method", or "refactor this class". Covers human-scale design, naming, complexity budgets, comments, CUPID, and in-place refactoring. Pairs with language-specific skills (typescript, go, clojurescript) for syntax/idiom concerns.

설치 수
1
GitHub Stars
5
업데이트
9월 21일
bsene
커뮤니티

clojurescript

Write, review, debug, and configure ClojureScript code and projects. Use this whenever the user mentions ClojureScript, .cljs/.cljc files, shadow-cljs, figwheel, the CLJS compiler, JS interop from Clojure, Reagent/re-frame/Reagent-style UI code, or asks to convert JS/TS logic into ClojureScript. Also use it for questions about CLJS compiler options (:optimizations, :main, :npm-deps, :externs, etc.), consuming JS/npm libraries from CLJS, source maps, Google Closure Library usage, or the newer ^:async/await function support. Also trigger for CLJS recursion/stack-overflow/trampoline questions. Trigger even if the user just pastes CLJS code with an error and asks "what's wrong here" or asks to set up a new CLJS project. Do NOT use for nbb (babashka/nbb) scripts, nbb.edn projects, or anything meant to run via nbb script.cljs/npx nbb — those have a different (SCI-interpreted, no-Closure-Compiler) language surface; those are out of scope for this skill — consult nbb's own documentation.

설치 수
1
GitHub Stars
5
업데이트
9월 21일
bsene
커뮤니티

communication

Analyze a real communication artifact (Slack/Teams message, email, meeting transcript, pitch or presentation draft, CV, or resume) and coach it sharper using seven rhetoric + structure techniques: ethos/logos/pathos, reframing tough questions, centering the other person, the Pyramid Principle, pattern interrupt, making ideas feel safe, and the cognitive-load through-line. Diagnose what works, what's missing, then rewrite. TRIGGER when: user wants to improve communication, "review my email/Slack/CV", "analyze this transcript", prep for a meeting/pitch/presentation, "how do I say this", be more persuasive/assertive, handle a tough question, talk to execs, "is this too long-winded". Also trigger for author style presets under references/authors/: DHH (blunt/direct), Uncle Bob (defend a quality/testing standard), Jessitron (reflective systems-thinking essay), Martin Fowler (measured mixed-feelings stance). DO NOT USE for raw text generation with no analysis, marketing/copywriting, translation, or code/docs.

설치 수
1
GitHub Stars
5
업데이트
9월 21일