Skip to content
Back to skills

Powershell Profiles

ASecurity

Use when customizing PowerShell profile scripts.

  • 2 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 10, 2026
ai-agentsgoshellexpressdockerazuregit

Works with

  • terminal
  • cli

Security analysis

A100/100

Scanned September 10, 2026

npx -y skills add LoopyLuci/Skills --skill powershell-profiles --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Powershell Profiles?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Powershell Profiles
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/loopyluci-powershell-profiles/badge)](https://www.skillsdirectory.com/skills/loopyluci-powershell-profiles)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: powershell-profiles
description: "Use when customizing PowerShell profile scripts."
category: software-development
tags: [powershell, profile, customization, prompt, aliases]
---
# PowerShell Profiles

Customizing PowerShell startup profiles.

## Profile Locations

```powershell
# Check which profiles exist
$PROFILE | Get-Member -MemberType NoteProperty | Select-Object Name

# Profile paths:
$PROFILE.AllUsersAllHosts   # All users, all hosts
$PROFILE.AllUsersCurrentHost # All users, current host
$PROFILE.CurrentUserAllHosts # Current user, all hosts
$PROFILE.CurrentUserCurrentHost # Current user, current host (most common)
```

## Typical Profile Structure

```powershell
# ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
# ~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 (PS5)

# ── Appearance ───────────────────────────────────────────
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\cloud-native-azure.omp.json" | Invoke-Expression

# ── Aliases ──────────────────────────────────────────────
Set-Alias g git
Set-Alias ll Get-ChildItem
Set-Alias dc docker compose
Set-Alias dps "docker ps"
New-Alias -Name which -Value Get-Command

# ── Functions ────────────────────────────────────────────
function .. { Set-Location .. }
function ... { Set-Location ..\.. }
function grep { $args | Select-String -Pattern $args[0] }
function mkcd { New-Item -ItemType Directory -Path $args[0] -Force; Set-Location $args[0] }
function touch { New-Item -ItemType File -Path $args[0] -Force }

# ── Prompt Customization ─────────────────────────────────
function prompt {
    $path = (Get-Location).Path.Replace($HOME, '~')
    "$path> "
}

# ── Startup Banner ──────────────────────────────────────
$host.UI.RawUI.WindowTitle = "PowerShell $($PSVersionTable.PSVersion)"
Write-Host "Profile loaded. $(Get-Date -Format 'HH:mm:ss')" -ForegroundColor Cyan
```

## Module Auto-Loading

```powershell
# Modules to import at startup
$modules = @('DockerCompletion', 'PSReadLine', 'Terminal-Icons')
foreach ($m in $modules) {
    if (Get-Module -ListAvailable -Name $m) {
        Import-Module $m -ErrorAction SilentlyContinue
    }
}

# PSReadLine configuration
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -Colors @{ Command = 'Yellow'; String = 'Green' }
Set-PSReadLineKeyHandler -Key Ctrl+SpaceBar -Function MenuComplete
```

## Environment Variables

```powershell
# Docker
$env:DOCKER_HOST = "tcp://localhost:2375"
$env:DOCKER_BUILDKIT = "1"
$env:COMPOSE_DOCKER_CLI_BUILD = "1"

# Path additions
$userPaths = @(
    "$env:USERPROFILE\.cargo\bin",
    "$env:USERPROFILE\AppData\Local\Programs\Microsoft VS Code\bin"
)
foreach ($p in $userPaths) {
    if (Test-Path $p -and $env:Path -notlike "*$p*") {
        $env:Path = "$p;$env:Path"
    }
}
```

## Conditional Loading

```powershell
# Only load if module is available
if (Get-Command starship -ErrorAction SilentlyContinue) {
    Invoke-Expression (&starship init powershell)
}

# Only on certain hosts
if ($host.Name -eq 'ConsoleHost') {
    Import-Module PSReadLine
}

# Conditional by OS
if ($IsWindows) {
    Import-Module DockerCompletion
}
```

## Pitfalls

- Profile runs on EVERY PowerShell startup -- keep it fast (<100ms)
- Errors in profile prevent the rest from loading -- use try/catch
- Different profiles for PS5 (WindowsPowerShell) and PS7 (PowerShell)
- Dot-source profile changes with `. $PROFILE` without restarting
- Profile scripts are plain text -- don't store credentials in them

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.