debugging-with-opensrc
Debugging with OpenSrc
Overview
Debug external library behavior by reading source first.
Treat OpenSrc mirrors as the source of truth for installed versions.
When to Use This Skill
- Investigate an integration issue where application code depends on third-party library internals.
- Resolve a mismatch between documentation and observed runtime behavior.
- Confirm expected function signatures, defaults, error paths, or edge-case handling in an installed dependency.
OpenSrc Commands
# Sync all repos (run after git clone)
bun run opensrc:sync
# Fetch new package
bun run opensrc:use <package> # npm package
bun run opensrc:use owner/repo # GitHub repo
Available Repos (opensrc/repos/github.com/)
| Library | Path | What to look for |
|---|---|---|
| Effect | Effect-TS/effect/packages/effect/src/ |
Schema, Effect.gen, Layer, Context |
| TanStack Router | TanStack/router/packages/react-router/src/ |
createFileRoute, loader, useParams |
| TanStack Query | TanStack/query/packages/react-query/src/ |
useSuspenseQuery, queryOptions |
| TanStack Form | TanStack/form/packages/react-form/src/ |
useForm, validation |
| TanStack Start | TanStack/router/packages/start/src/ |
SSR, server functions |
| TRPC | trpc/trpc/packages/server/src/ |
procedures, middleware, routers |
| Drizzle ORM | drizzle-team/drizzle-orm/drizzle-orm/src/ |
pgTable, relations, queries |
| Better Auth | better-auth/better-auth/packages/better-auth/src/ |
auth config, plugins, sessions |
| OpenCode | sst/opencode/packages/opencode/src/ |
skills, commands, plugins |
| Pino | pinojs/pino/lib/ |
logger, transports |
| Sentry | getsentry/sentry-javascript/packages/ |
SDK, integrations, tracing |
Debugging Workflow
- Define the failing behavior in one sentence (input, observed output, expected output).
- Identify the exact dependency and package area involved.
- Locate relevant source files in
opensrc/repos/github.com/using available project search tools. - Read implementation and related types before changing app code.
- Trace call flow from public API to internal helpers.
- Extract concrete expectations:
- Function signatures and return types
- Required wrappers/builders/options
- Defaults and optional parameter behavior
- Error handling and edge cases
- Apply the fix in app code based on verified behavior.
- Validate with targeted tests or reproduction steps.
Common Debugging Scenarios
Scenario: TanStack Form Validation Not Working
- Read
opensrc/repos/github.com/TanStack/form/packages/react-form/src/useForm.ts. - Inspect validator interface and expected return type.
- Verify how Standard Schema integration is wired in the installed version.
- Fix application code from verified behavior.
Scenario: TRPC Procedure Not Receiving Context
- Read
opensrc/repos/github.com/trpc/trpc/packages/server/src/core/middleware.ts. - Trace how context flows through middleware chain.
- Verify middleware returns and
opts.next()behavior in the active version.
Scenario: Effect Layer Not Providing Service
- Read
opensrc/repos/github.com/Effect-TS/effect/packages/effect/src/Layer.ts. - Compare
Layer.effectandLayer.succeedbehavior. - Verify
Context.Tagusage against library patterns.
Scenario: Better Auth Session Not Persisting
- Read
opensrc/repos/github.com/better-auth/better-auth/packages/better-auth/src/. - Trace session handling and persistence flow.
- Verify cookie/storage expectations in the installed code.
Key Principle
Source code is the truth.
- Documentation can be outdated
- Stack Overflow answers may not apply to your version
- Blog posts may use different configurations
- Only the source code shows exactly what happens
Example: Full Debugging Session
Problem: useSuspenseQuery returns undefined despite cached data.
- Read
opensrc/repos/github.com/TanStack/query/packages/react-query/src/useSuspenseQuery.tsand nearby type definitions. - Verify what input shape is expected in the installed version.
- Confirm successful usage patterns in project code.
- Apply a fix that matches verified expectations.
Note: A previous investigation in one version found that wrapping inputs via queryOptions() solved the issue. Treat this as an example finding, not a universal rule.
OpenCode-Specific Internals
Use references/opencode-skill-testing.md when debugging OpenCode skill loading or autoload testing internals.
Remember
- Read source FIRST - before asking, before web searching
- Exact version matters - opensrc has YOUR installed version
- Follow the code path - trace from entry point to implementation
- Check types - TypeScript types often reveal expected usage
- Look at tests - library tests show correct usage patterns
More from blogic-cz/blogic-marketplace
marketing-expert
This skill should be used when writing or rewriting marketing copy for software products, including positioning, messaging, homepage rewrite work, landing pages, product descriptions, conversion-focused updates, and sales-enablement content. Produces clear, truthful, high-performing SaaS copy.
97requirements
This skill should be used when clarifying a feature, writing a requirements spec, running a structured discovery session, or when users mention requirements-start, requirements-status, requirements-current, requirements-list, requirements-remind, or requirements-end.
78frontend-design
This skill should be used when a task requires designing or implementing frontend UI (components, pages, layouts, styling) and no more specialized frontend skill is a better fit. It guides production-grade, brand-consistent visual implementation with distinctive but controlled aesthetics.
78testing-patterns
This skill should be used when implementing or reviewing testing workflows in template-ts projects, especially for testing, Vitest, Playwright, integration test, and mocking scenarios.
76git-workflow
Automates the full PR lifecycle — create or update a pull request, then aggressively monitor CI checks and review feedback in a continuous loop, fixing failures and addressing comments until the PR is fully green. Also covers push, branch creation, and branch sync workflows.
76update-packages
This skill should be used when upgrading dependencies, bumping packages, resolving outdated dependencies, or performing dependency updates. It guides safe Bun-based package upgrades with breaking-change handling, runtime pin alignment, and grouped version coordination.
75