advanced-coding
Skill1 starsChanged 6 months agoMITView on GitHub
Expert-level coding skill for Go, Python, and Rust. Use this skill whenever the user asks to write, review, refactor, debug, optimize, or architect code in Go, Python, or Rust. Triggers on: writing functions/structs/modules, CLI tools, systems programming, concurrency, performance optimization, error handling, testing, API design, data pipelines, async code, memory safety, generics, type systems, and idiomatic patterns in any of these three languages. Also triggers when comparing these languages, porting code between them, or discussing trade-offs. Don't wait to be explicitly asked — proactively use this skill whenever Go, Python, or Rust code quality matters.
In this repository5 other files it gives its agents.
- codebase-radarSkill
- extended-frontendSkill
- project-forgeSkill
- project-indexerSkill
- ruthless-mentorSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 3 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Use errors.Is / errors.As for error inspection.
- Very specific: line 36
Prefer table-driven tests with t.Run
- Very specific: line 37
Use context.Context as the first argument in all I/O and long-running functions
- Very specific: line 41
Prefer slog for structured logging (Go 1.21+)
- Very specific: line 42
Use errgroup for concurrent goroutine fan-out with error collection
- Very specific: line 74
Use pathlib.Path not os.path
- Very specific: line 78
Use logging not print; configure with logging.config.dictConfig
- Very specific: line 112
Use thiserror for library errors, anyhow for application errors
- Very specific: line 113
Prefer impl Trait in function args, -> impl Trait in return when one type.
- Distinctive: line 117
Prefer iterators + adapters over manual loops.
- Distinctive: line 179
When porting between languages, read the relevant reference file:
- Distinctive: line 188
Before presenting code, verify:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Advanced Coding — Go · Python · Rust
You are an expert engineer in Go, Python, and Rust. Write code that is production-grade, idiomatic, and battle-tested. No toy examples. No hand-waving. No half-measures.
Core Principles (all languages)
- Write what's needed — no over-engineering, no premature abstraction
- Error paths are first-class — never ignore errors; handle or propagate explicitly
- Performance is a feature — choose the right data structure, algorithm, and memory strategy
- Tests are part of the code — write them unless explicitly asked not to
- Idiomatic > clever — readable, maintainable code beats terse tricks
- Comments explain WHY, not WHAT — code should be self-explanatory
Go
Patterns to follow
- Use
errors.Is/errors.Asfor error inspection; wrap withfmt.Errorf("context: %w", err) - Prefer table-driven tests with
t.Run - Use
context.Contextas the first argument in all I/O and long-running functions - Interfaces belong in the consumer package, not the implementor
- Struct embedding for behavior composition, not deep inheritance trees
sync.Poolfor frequently-allocated objects under load- Prefer
slogfor structured logging (Go 1.21+) - Use
errgroupfor concurrent goroutine fan-out with error collection
Project layout (standard)
cmd/
myapp/main.go # entry point; thin, wires dependencies
internal/
domain/ # core types & logic
infra/ # DB, HTTP, messaging adapters
pkg/ # re-usable exported packagesCommon pitfalls to avoid
- Goroutine leaks: always ensure goroutines can exit (context cancellation / done channel)
- Nil map write panics:
make(map[K]V)before writing - Loop variable capture in goroutines: copy or use
range val(Go 1.22+) - Interface nil trap: typed nil ≠ nil interface
Concurrency checklist
- Channel directions typed (
chan<-,<-chan) - Select default case to prevent blocking
- WaitGroup
Addbefore spawning goroutine - Mutex protects data, not code blocks
Python
Patterns to follow
- Type-annotate everything (use
from __future__ import annotationsfor forward refs) dataclassesorpydanticfor structured data; avoid raw dicts as domain types- Async: use
asyncio+anyiofor structured concurrency; avoidasyncio.gatherraw - Use
pathlib.Pathnotos.path contextlib.contextmanager/asynccontextmanagerfor resource management- Protocols for duck-typing without inheritance
__slots__for perf-critical, frequently-instantiated classes- Use
loggingnotprint; configure withlogging.config.dictConfig
Toolchain (opinionated)
| Purpose | Tool |
| Package management | uv (preferred) or poetry |
| Linting/formatting | ruff |
| Type checking | mypy --strict or pyright |
| Testing | pytest + pytest-asyncio |
| HTTP client | httpx |
| CLI | typer |
| Config | pydantic-settings |
Async patterns
# Structured concurrency — prefer over raw gather
async with asyncio.TaskGroup() as tg:
task_a = tg.create_task(fetch_a())
task_b = tg.create_task(fetch_b())
# Both results available, exceptions propagated cleanlyCommon pitfalls to avoid
- Mutable default arguments:
def f(items: list = None)→ useNoneand assign inside - Late binding closures in loops: capture with default arg or
functools.partial - Shadowing builtins: never name variables
list,id,type,input, etc. except Exceptionswallowing: always log or re-raise; never silent swallow
Rust
Patterns to follow
- Model invalid state as unrepresentable via the type system
- Use
thiserrorfor library errors,anyhowfor application errors - Prefer
impl Traitin function args,-> impl Traitin return when one type; use generics when multiple callers need different types - Newtype pattern to enforce domain invariants:
struct UserId(u64) - Builder pattern for structs with many optional fields
#[must_use]on functions returningResult/ important values- Prefer iterators + adapters over manual loops; trust the optimizer
tokiofor async runtime;axumfor HTTP;sqlxfor async DB- Try using zig(if available) cc, clang, etc when needed
Ownership mental model (quick ref)
- Move semantics by default — if you need reuse, clone or borrow
&Tfor read-only borrow,&mut Tfor exclusive mutation- Lifetime annotations only when the compiler asks — don't over-annotate
Arc<Mutex<T>>for shared mutable state across threads;Rc<RefCell<T>>for single-thread
Error handling
// Library: define your errors
#[derive(Debug, thiserror::Error)]
pub enum AppError {
#[error("database error: {0}")]
Db(#[from] sqlx::Error),
#[error("not found: {0}")]
NotFound(String),
}
// Application: use anyhow for ergonomic ?-chaining
fn run() -> anyhow::Result<()> {
let conn = connect().context("failed to connect to DB")?;
Ok(())
}Performance checklist
cargo build --releasefor benchmarks- Profile with
cargo flamegraphorperfbefore optimizing - Avoid
.clone()in hot paths — audit withcargo clippy - Use
BufReader/BufWriterfor I/O SmallVec/tinyvecfor small collections that usually stay small- SIMD via
std::simdorpacked_simd2only after profiling proves it's needed
Async patterns
// Spawn concurrent tasks with join!
let (a, b) = tokio::join!(fetch_a(), fetch_b());
// Fan-out with error handling
let handles: Vec<_> = items.iter().map(|i| tokio::spawn(process(i))).collect();
let results: Vec<_> = futures::future::try_join_all(handles).await?;Language Selection Guide
| Need | Reach for |
| Fast iteration, data work, scripting, ML | Python |
| Network services, CLIs, DevOps tooling | Go |
| Systems, performance-critical, memory safety | Rust |
| Embedding in other systems, WASM | Rust |
| Rapid API server | Go or Python (FastAPI) |
Cross-language: porting patterns
When porting between languages, read the relevant reference file:
- Go ↔ Rust patterns:
references/go-rust.md - Python ↔ Go patterns:
references/python-go.md - Python ↔ Rust (PyO3):
references/python-rust.md
Code Review Checklist
Before presenting code, verify:
- All error paths handled
- No panics / unchecked unwraps in library code
- No unbounded memory growth under load
- Secrets/configs from env, not hardcoded
- Graceful shutdown implemented for servers
- Tests cover the happy path and at least 2 failure modes
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

