pixel-and-stroke-geometry

pixel-and-stroke-geometry is a skill for Claude Code, Codex from troyjthomas/ios-agent-skills. It costs 104 tokens per session (2,086 once invoked), scanned A, original, MIT.

A guide to how lines and shapes land on screen in SwiftUI Canvas and Shape drawing. It explains pixel boundaries, anti-aliasing, and how borders are placed around paths.

In plain words
What is it for?
Use it for grid editors, drawing tools, selection boxes, charts, gauges, progress rings, and other interfaces that draw custom lines or shapes.
Why use it?
It helps diagnose borders that look too large, blurry, or flicker during animation, issues that are easy to misread as general layout bugs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for grid editors, drawing tools, selection boxes, charts, gauges, progress rings, and other interfaces that draw custom lines or shapes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/troyjthomas/ios-agent-skills/pixel-and-stroke-geometry
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add troyjthomas/ios-agent-skills --skill pixel-and-stroke-geometry
Clone the repo
git clone --depth 1 https://github.com/troyjthomas/ios-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pixel-and-stroke-geometry

README.md
[![agentmods](https://agentmods.dev/badge/skills/troyjthomas/ios-agent-skills/pixel-and-stroke-geometry/github.svg)](https://agentmods.dev/skills/troyjthomas/ios-agent-skills/pixel-and-stroke-geometry)
Your own site
<a href="https://agentmods.dev/skills/troyjthomas/ios-agent-skills/pixel-and-stroke-geometry"><img src="https://agentmods.dev/badge/skills/troyjthomas/ios-agent-skills/pixel-and-stroke-geometry/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pixel-and-stroke-geometry

Your own site · 80×15
<a href="https://agentmods.dev/skills/troyjthomas/ios-agent-skills/pixel-and-stroke-geometry"><img src="https://agentmods.dev/badge/skills/troyjthomas/ios-agent-skills/pixel-and-stroke-geometry.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 104 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,086 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00104 $0.02086
Opus 5 $0.00052 $0.01043
Sonnet 5 $0.00021 $0.00417
Haiku 4.5 $0.00010 $0.00209

Measured 11d ago against content hash 1568685832db, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

pixel-and-stroke-geometry scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/pixel-and-stroke-geometry/SKILL.md · 172 lines

How it starts

The opening of the file, as written. The whole thing — 172 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Pixel and Stroke Geometry

If your app draws on a grid, canvas, or any pixel-aligned surface, the rendering rules below are non-obvious and produce a class of bugs that are otherwise mysterious. This skill covers the rules and the recipes that prevent the bugs.

When to Use

  • Building a pattern editor, illustration tool, or any pixel-grid drawing app
  • Implementing selection rectangles, marching ants, or grid overlays
  • Drawing custom gauges, dials, charts, or progress rings
  • Stroking paths in SwiftUI.Canvas or as Shape overlays
  • Diagnosing "phantom pixel flicker" or "selection edge looks wrong" bugs

If your app is purely text-and-form-based, you can skip this skill.

The One Rule That Causes 80 % of Stroke Bugs

SwiftUI's .stroke(lineWidth: N) paints CENTERED on the path. A 2pt stroke covers 1pt INSIDE the path and 1pt OUTSIDE.

For Rectangle().path(in: rect).stroke(lineWidth: 2):

  • Inside the rect: 1pt of stroke covers the rect's edge cells
  • Outside the rect: 1pt of stroke extends past the rect's edge

This is correct rendering — exactly what CGPath does — but it's almost never what you want when you draw a border around a region.

Outset vs Inset — Which to Use

You have three choices for where the stroke sits relative to the rect's logical boundary:

You Want Recipe
Stroke entirely OUTSIDE the rect rect.insetBy(dx: -lineWidth/2, dy: -lineWidth/2) then stroke
Stroke entirely INSIDE the rect rect.insetBy(dx: lineWidth/2, dy: lineWidth/2) then stroke
Stroke centered on the rect's edge (default) No inset — .stroke(lineWidth: N)

The most common case for app developers: a selection border that should NOT visually overlap the cells inside the selection. That's "stroke entirely outside" — insetBy(dx: -lineWidth/2, dy: -lineWidth/2) to outset before stroking.

let strokeWidth: CGFloat = 2
let strokeRect = cellRect.insetBy(
    dx: -strokeWidth / 2,
    dy: -strokeWidth / 2
)
Rectangle()
    .path(in: strokeRect)
    .stroke(Color.white, lineWidth: strokeWidth)

Read the full file on GitHub · 172 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 172 lines · 104 tokens per session scan A 1568685832db

Subscribe to this mod's changes

pixel-and-stroke-geometry is a skill published in the GitHub repository troyjthomas/ios-agent-skills (2 stars, last pushed 3mo ago), licensed MIT. It adds 104 tokens to every session and 2,086 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

ios-accessibility

Build and audit SwiftUI, UIKit, and AppKit accessibility for VoiceOver, Voice Control, Switch Control, Full Keyboard Access, Dynamic Type, focus restoration, labels/traits/actions, traversal, custom rotors, NSAccessibility, XCTest checks, adaptive system preferences, and App Store accessibility declarations. Use when…

dpearson2699/swift-ios-skills · 91 tokens

pencilkit

Add Apple Pencil drawing with PKCanvasView, PKToolPicker, PKDrawing serialization/export, stroke inspection, and PencilKit/PaperKit handoffs. Use when building drawing apps, annotation features, handwriting capture, signature fields, content-version-safe ink workflows, or Apple Pencil-powered experiences on…

dpearson2699/swift-ios-skills · 70 tokens

swiftui-liquid-glass

Implement, review, or improve SwiftUI Liquid Glass effects for iOS 26+. Covers glassEffect modifier, GlassEffectContainer, glass button styles, glass toolbar/tab bar, static status badges vs interactive controls, morphing transitions, tinting, interactive glass, ToolbarSpacer, scrollEdgeEffectStyle…

dpearson2699/swift-ios-skills · 111 tokens

swift-accessibility-skill

Apply platform accessibility best practices to SwiftUI, UIKit, and AppKit code. Essential companion to any SwiftUI, UIKit, or AppKit skill — always use together. Use whenever writing, editing, or reviewing ANY SwiftUI views, UIKit view controllers, AppKit views/window controllers, or platform UI — even when the user…

JordanCoin/ios-skills-collection · 141 tokens

swiftui-design-principles

Design principles for building polished, native-feeling SwiftUI apps and widgets. Use this skill when creating or modifying SwiftUI views, iOS widgets (WidgetKit), or any native Apple UI. Ensures proper spacing, typography, colors, and widget implementations that look and feel like quality apps rather than…

JordanCoin/ios-skills-collection · 72 tokens

figma-to-swiftui

Translate Figma designs into production-ready SwiftUI code with 1:1 visual fidelity using the Figma MCP workflow. Trigger when the user provides Figma URLs or node IDs and wants iOS/SwiftUI implementation, asks to implement a design or component from Figma for an iOS app, or references Figma selections in the context…

JordanCoin/ios-skills-collection · 133 tokens