github.com/n-r-w/ctxlog guidelines
Guidelines and examples for using the ctxlog logging package.
Best use case
github.com/n-r-w/ctxlog guidelines is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Guidelines and examples for using the ctxlog logging package.
Teams using github.com/n-r-w/ctxlog guidelines should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/github.com-n-r-w-ctxlog-guidelines/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How github.com/n-r-w/ctxlog guidelines Compares
| Feature / Agent | github.com/n-r-w/ctxlog guidelines | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Guidelines and examples for using the ctxlog logging package.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
<ctxlog name="github.com/n-r-w/ctxlog guidelines">
<instructions>
- Import path: `github.com/n-r-w/ctxlog`.
- Primary workflow:
- Parse log level from environment variable or config: `ctxlog.ParseLogLevel()`
- Create a logger once (app startup, request entrypoint, job runner) and store it in a context
- Log everywhere via context-based helpers: `ctxlog.Debug/Info/Warn/Error(ctx, msg, ...)`
- Enrich the context logger when you need extra fields: `ctx = ctxlog.With(ctx, ...)`
- Group related fields: `ctx = ctxlog.WithGroup(ctx, "group")`
- Passing structured fields:
- You can pass key/value pairs: `"user_id", "12345"`
- You can pass `slog.Attr` values: `slog.String("host", "localhost")`
- When passing key/value pairs, the number of arguments must be even (key-value-key-value...)
- Optional: extract the logger from context for direct usage: `logger := ctxlog.FromContext(ctx)`
- For external dependencies that should not depend on the concrete logger type, use `ctxlog.ILogger` via `ctxlog.NewWrapper()` (real) or `ctxlog.NewStubWrapper()` (no-op)
</instructions>
<example>
```go
package main
import (
"context"
"log/slog"
"github.com/n-r-w/ctxlog"
)
func main() {
// Parse level from environment variable
// (here we hardcode it for demonstration)
level, err := ctxlog.ParseLogLevel("DEBUG")
if err != nil {
panic(err)
}
// create context with logger
ctx := ctxlog.MustContext(
context.Background(),
ctxlog.WithName("myapp"),
ctxlog.WithLevel(level),
)
// simple format (key/value pairs)
ctxlog.Info(ctx, "starting application", "version", "1.0.0")
// slog attr fields
ctxlog.Debug(ctx, "connecting to database",
slog.String("host", "localhost"),
slog.Int("port", 5432),
)
// enrich context with more fields
ctx = ctxlog.WithGroup(ctx, "database")
ctx = ctxlog.With(ctx, "user_id", "12345", "ip", "192.168.1.1")
ctxlog.Error(ctx, "some error occurred")
// extract logger from context for direct usage
logger := ctxlog.FromContext(ctx)
logger.Warn(ctx, "direct usage of logger")
}
```
</example>
</ctxlog>Related Skills
github-workflows
Initialize or update GitHub Actions workflows for Go projects with comprehensive CI/CD pipelines including linting, testing, coverage, snapshot builds, and releases. Use when setting up GitHub Actions automation for Go projects. Trigger with "setup github actions", "add github workflows", or "configure ci/cd".
github-search
Search GitHub for repos, code, and usage examples using gh CLI. Capabilities: repo discovery, code search, finding library usage patterns, issue/PR search. Actions: search, find, discover repos/code/examples. Keywords: gh, github, search repos, search code, find examples, how to use library, stars, language filter. Use when: finding repositories, searching code patterns, discovering how libraries are used, exploring open source.
github-repo-skill
Guide for creating new GitHub repos and best practice for existing GitHub repos, applicable to both code and non-code projects
github-repo-analysis
Analyze GitHub repositories to extract insights about commit frequency, outstanding contributors, release timeline, and project health metrics. Use when users request repository analysis, commit history investigation, contributor identification, release tracking, or development activity assessment for any GitHub project.
github-pr-review-comments
Comprehensive workflow for managing GitHub PR review comments using gh CLI and GraphQL API. Use when asked to address review comments, find unreplied comments, reply to review threads, or resolve/unresolve review conversations. Supports finding ALL comments across pagination boundaries, replying to threads, and resolving conversations.
github-navigator
GitHub operations via gh CLI. CRITICAL: Always use instead of WebFetch for ANY github.com URL. Use when user provides GitHub URL, says 'facebook/react', 'show README', 'list issues', 'check PR', 'clone repo', 'analyze this repo', 'understand the architecture', 'how is X structured', 'explore the codebase'. For deep analysis of external repos, clones locally.
github-issues
Manage GitHub issues - create, edit, close, comment, assign, and delegate to Copilot. Uses GitHub MCP.
github-issue-triage
Analyze GitHub issues for the Nx repository and provide assignment recommendations based on technology stack, team expertise, and priority classification rules.
github-issue-resolver
Strategically resolves GitHub Actions failures, failed pull requests, and Dependabot issues using the gh CLI with intelligent analysis and automated fixes.
github-issue-creator
Creates well-structured GitHub issues for the MCPSpy project using the gh CLI tool. Use when asked to create issues, report bugs, or document features. Follows conventional naming with feat/chore/fix prefixes and maintains appropriate detail levels.
github-copilot-agent-tips-and-tricks
Tips and Tricks for Working with GitHub Copilot Agent PRs
github-commit
Create a well-formatted git commit following best practices