Skip to content

Instantly share code, notes, and snippets.

View samoshkin's full-sized avatar

Alexey Samoshkin samoshkin

View GitHub Profile
@samoshkin
samoshkin / SKILL.md
Last active April 11, 2026 18:03
General purpose prompt engineering skill
name prompt-engineering
description Systematic expertise for crafting, analyzing, and improving LLM prompts. Applies to ad-hoc prompts, stored prompt templates, agent system prompts, persona definitions, and prompt evaluation. Activate when the user needs to create, improve, or debug a prompt; is building an agent profile or system prompt; asks "how do I ask AI to...", "create a prompt for...", or "why isn't my prompt working"; or when a prompt is vague, ambiguous, or underperforming.

Prompt Engineering Skill

Foundational knowledge for writing effective LLM prompts. Covers principles, techniques, writing rules, and common pitfalls. Use this skill when you need to:

  • Write a new prompt from scratch (ad-hoc instruction, reusable template, or system prompt)
@samoshkin
samoshkin / index.sql
Last active August 31, 2023 12:15
Query index properties in PosgreSQL: "hash" index
/*
===================
INDEX PROPERTIES
===================
*/
/*
NOTE: In this example, we explore "hash" index properties using PostgreSQL system catalog tables
*/
@samoshkin
samoshkin / index.md
Created April 5, 2023 20:02
Statements about Python

Statements describing Python as a language

Interpreted: Python is an interpreted language, which means that the source code is translated and executed line-by-line at runtime, rather than being compiled to machine code beforehand.

Dynamic type system: Python uses a dynamic type system, which means that variable types are determined at runtime and can change during the execution of a program.

Garbage-collected: Python automatically manages memory allocation and deallocation using garbage collection, which frees developers from having to manually manage memory in their code.

Indentation-based syntax: Python uses indentation to define code blocks, making the code more readable and less cluttered with braces or other delimiters.

@samoshkin
samoshkin / socket-io-and-redux-saga-integration.js
Last active September 12, 2023 06:32
Socket.IO and redux-saga integration. Connection management
import { io } from 'socket.io-client';
import * as SentrySDK from '@sentry/react';
import {
call,
fork,
takeEvery,
put,
race,
take,
} from 'redux-saga/effects';
@samoshkin
samoshkin / app.js
Created November 14, 2022 21:34
Node application entry point and runner based on "redux-saga" library
const Sentry = require('@sentry/node');
const {
fork,
} = require('redux-saga/effects');
async function init() {
// create any services and run all startup activites (e.g start HTTP server, connect to Db, etc)
const dbConn = await mongoDb.connect(config.services.mongo);
Basic.db = dbConn;
@samoshkin
samoshkin / index.js
Created November 4, 2021 08:58
Process items from Iterable in parallel with given concurrency factor
async function eachParallel(iterable, action, concurrencyFactor) {
const evt = new EventEmitter();
let runningCount = 0;
let cancelled = false;
const errors = new Map();
let ended = false;
const emit = evt.emit.bind(evt);
const on = evt.on.bind(evt);
const until = eventName => new Promise(res => evt.once(eventName, res));
@samoshkin
samoshkin / jira_ticket_status_diagram_in_mermaid.mmd
Created August 28, 2021 06:30
JIRA ticket state diagram written in Mermaid DSL
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@samoshkin
samoshkin / conditionally_build_array_using_if_else_blocks.js
Created August 20, 2021 19:05
Conditionally build an array using if..else blocks
const deployment = {
debug: process.env.NODE_ENV === 'development',
};
const defaultIntegrations = integrations.filter(x => x.name !== 'Dedupe');
const integrations = [
// add all the default integrations but those which were excluded using spread syntax
...defaultIntegrations,
@samoshkin
samoshkin / conditionally_build_array_using_logical_and_operator_1.js
Created August 20, 2021 18:44
Conditionally build array using logical AND operator
const deployment = {
debug: process.env.NODE_ENV === 'development',
};
const defaultIntegrations = integrations.filter(x => x.name !== 'Dedupe');
return [
// add all the default integrations but those which were excluded using spread syntax
...defaultIntegrations,
@samoshkin
samoshkin / conditional_rendering_in_react.jsx
Created August 20, 2021 18:17
Conditional rendering in React and JSX
import React, { useCallback } from "react";
import { createEventPageUrl } from "app/packages/error-handling";
function ErrorBoundaryFallback(props) {
const { error, componentStack, resetError, eventId } = props;
const renderEventId = useCallback(eventId => (
<a href="createEventPageUrl(eventId))">{eventId}</a>
), []);