⏳ This skill is pending AI review.

Scores will appear once the review pipeline completes.

version unknown

authoring-code-safely

gavin844@gavin844⭐ 0 stars· last commit 1mo ago· 0 open issues

Write and edit source files with Write/Edit, never through bash heredocs or python -c string surgery. Use when creating or modifying any code file. Prevents escaping corruption that silently breaks the file you just wrote.

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

—/10

// RATINGS

⭐GitHub Stars
⭐ 0 on GitHubGitHub ↗

New / niche

🟢ProSkills Score
—
📍

Not yet listed on ClawHub or SkillsMP

// README

Claude Code skills

A skill is a folder holding a SKILL.md: markdown instructions that Claude Code loads when it is in a particular situation, so a lesson learned once does not have to be relearned every session. Some also carry a script.

These 37 were written while shipping real systems through 2026, in seven groups. The first four groups are rules: most exist because something broke quietly and the mistake only surfaced when a person looked at the result, so each records what went wrong, the rule that came out of it, and how to recognise the moment it applies again. The last three are working playbooks for a consultancy, a recruiting product and a betting analyst. They ship with sample companies and sample numbers in place of the real ones; each says what to replace to make it yours.

Install

Copy any skill folder into your skills directory:

git clone https://github.com/gavin844/claude-code-skills.git
cp -r claude-code-skills/skills/honest-code/fail-loud ~/.claude/skills/

Claude Code picks it up on the next session. The group folder is only for browsing; the skill folder goes straight into ~/.claude/skills/. Every skill has its own page with what it does, when it loads, what is inside, and its install commands.

A few skills mention helper tools from their home workspace (ui_check.js, ux_audit.js, done_gate.py). Those are not included; the skills stand without them.

Working methods

How the agent behaves across a session: when to act, when to ask, what to say, and what counts as finished.

SkillWhat it does
shortHard word caps on every reply: the answer first, no narration, no recaps.
just-keep-workingWhen the next step is obvious and reversible, do it and report, instead of asking permission.
correction-to-ruleTurn a user's correction into a durable rule so the same mistake does not come back next session.
midwork-triggersLoad the right skill from what the agent is about to do mid-task, not only from the words of the request.
preflightBefore anything that writes, sends, deploys or spends, run the one check that settles the assumption, and never quietly change a rule the user set.
done-means-provenNothing is called done without evidence from outside the work: a screenshot looked at, a job that fired, a live URL fetched.
creative-modeOn a request for creativity, diverge widely before converging, and aim for a bold, shippable leap over a safe tweak.

Honest code

Code that tells the truth about itself: failures that show, checks that are proven, settings that are wired, scripts that are kept.

SkillWhat it does
authoring-code-safelyWrite code with the file tools, never through shell string surgery, so escaping cannot corrupt the file.
fail-loudMake failures visible instead of swallowed, so broken code cannot pass for working code.
locate-before-you-guardFind the line that produced the wrong output before adding a check that would hide it.
prove-the-checkerTest every validator against a known-bad and a known-good case before trusting what it says.
wire-the-knobProve some code reads a new setting before claiming the setting changes anything.
save-the-scriptTurn a working one-off script into a kept tool instead of rewriting it next time.

Trustworthy data

Numbers and records a person can rely on: fresh inputs, money read from the source, user decisions that survive a rebuild.

SkillWhat it does
user-state-is-sacredAnything a person decided by hand survives every rebuild, re-sync and regeneration.
one-writer-per-recordA record that a scheduled job and a live session can both write gets exactly one owner.
freshness-is-a-preconditionCheck the age of cached data, prices and stats before acting on them.
money-is-read-never-derivedRead balances and profit from the system of record, never recompute them from history.
version-your-definitionsStamp a metric's definition next to its values, so numbers from different formulas are never compared.
correlated-exposureGroup by what decides the outcome, not by the label, so an "at most N" limit catches hidden overlap.
enumerate-before-rankingList the whole option set before picking the best, so the pick is not made from a partial list.

Web apps

Shipping a web surface that is finished, does not look generated, and moves well.

SkillWhat it does
web-app-baselineThe 20 checks every web app passes before it is called done, with the commands that prove them.
website-craftThe 30 tells that make a site look machine-made, with a detector that finds them.
web-motion-3dReal animation and 3D in a web app (Lottie, React Three Fiber, Vectary) without it reading as generated.

Client work

A consultancy's sales and delivery documents, from the first call to the release notes. Ships with a sample company, Fieldstone AI, to replace with your own.

SkillWhat it does
blueprint-builderA tailored top-of-funnel Opportunity Blueprint that shows a prospect where AI can move their business.
discovery-call-prepA one-page brief before a prospect call: who is in the room, where the deal stands, the angle and the opening question.
client-follow-upA meeting transcript becomes a follow-up email draft and a table of next actions with owners and dates.
sow-scopingDiscovery notes become a Statement of Work draft with phases, deliverables, roles and assumptions, price left as XXX.
demo-scriptA timed two-minute product demo: the hook, the one live wow moment, the proof and a single ask.
release-notesGit history becomes release notes that read like a product update, not a commit log.

Recruiting

Screening resumes in batches, selling to staffing agencies, and grading job postings. Ships with sample data to replace with your own.

SkillWhat it does
resume-batch-runRun a client's batch of resumes through an AI screener, tier the candidates, and give a reason for every score.
staffing-outreachCold outreach to staffing agencies that offers to rank one of their live batches, with two follow-ups.
job-posting-graderGrade a job posting from the seeker's side, and keep a grader honest when it publishes about named companies.

Betting and money

A recommend-only sports betting analyst and a persona

// HOW IT'S BUILT

// FILES

2 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.

  • skills/authoring-code-safely/SKILL.md4.9 KBupstream ↗
    ---
    name: authoring-code-safely
    description: Write and edit source files with Write/Edit, never through bash heredocs or python -c string surgery. Use when creating or modifying any code file. Prevents escaping corruption that silently breaks the file you just wrote.
    ---
    
    # Authoring code safely
    
    **Rule: source files are written with Write and Edit. Never with a bash heredoc, never
    with `python - <<'PY'` doing string replacement, never with `sed -i`.**
    
    This is not style. Every layer between the intent and the file is a chance for the
    text to change on the way through, and the failure is silent: the write succeeds, the
    file is broken, and you find out on the next build.
    
    ## What actually went wrong (2026-08-20/21, one session)
    
    | What I wrote | What landed in the file | Result |
    |---|---|---|
    | `return "\n".join(L)` inside a heredoc | a literal newline inside the string | `SyntaxError: unterminated string literal` |
    | `text + "\n" + wb` inside a heredoc | same | same |
    | `re.compile(r"(\d+)")` in a `python -c` | `SyntaxWarning: invalid escape sequence '\d'` | silent regex change |
    | `{/* comment */}` before a JSX element | two children in an expression slot | `Failed to compile` |
    | `-Args` (guessed the flag) | passed the literal string `-Args` | script errored, exit 2 |
    | backticked names inside `python - <<PY` | shell ran each one as a **command**; every name deleted from four files | four broken skill files, silently written |
    
    Four of those cost a full extra round trip each. One of them (`\d`) would have changed
    behaviour without erroring at all. The last one happened **while I was writing this
    skill**, which is the strongest argument for it: an unquoted heredoc delimiter (`<<PY`
    instead of `<<'PY'`) leaves the body open to `$var` expansion and backtick command
    substitution, so text that is perfectly valid in the file you meant to write gets
    rewritten on the way in. Quoting the delimiter fixes that one case. It does not fix the
    other four, which is why the rule is "use Write/Edit", not "quote your heredocs".
    
    ## The rule, concretely
    
    - **New file** → `Write`.
    - **Change to an existing file** → `Edit` with exact `old_string`/`new_string`.
    - **Same change in many files** → still `Edit`, once per file. Repetition is cheaper
      than a corrupted file you have to find.
    - **Bash is for running things**, not authoring them: tests, builds, git, greps, one
      line of `python -c` that only PRINTS.
    
    ## The one exception, and its guard
    
    Generating many files from data (say, a metadata block per route) is legitimately a
    script. When you do that:
    
    1. Write the generator with `Write`, as a real file.
    2. Have it write files, not patch them by string replacement where you can avoid it.
    3. **Immediately parse every file it touched.** `python -c "import ast; ast.parse(open(f).read())"`
       for Python, `npx tsc --noEmit` for TypeScript. A generator that produced 71 files is
       71 chances to be wrong.
    4. Read one generated file back and look at it.
    
    ## Before you run anything that writes
    
    - Am I about to embed `\n`, `\t`, `\d`, `\s`, a backtick, `$`, or a quote in a shell
      string that becomes source code? Use `Write`/`Edit` instead.
    - Am I inserting into JSX? A `{/* comment */}` is a CHILD. It cannot go in an
      expression slot (`cond ? ( ... ) : ( ... )`) beside the element. Use `//` above the
      return, or put the comment inside the element.
    - Am I guessing a CLI flag? Read `--help` or the `param(...)` block first. One command
      is cheaper than one wrong run.
    
    ## After you write
    
    Parse or typecheck **before** moving on. Not after three more edits, when you can no
    longer tell which one broke it.
    
    ```
    python -c "import ast; ast.parse(open('file.py',encoding='utf-8').read())"   # python
    npx tsc --noEmit                                                            # ts/tsx
    node --check file.js                                                        # js
    ```
    
    If the language has no cheap parse, read the region you changed with `Read`.
    
    ## Related skills
    
    Checked 2026-08-21 against the ~100 skills installed here and the public collections
    before writing this one, after the user asked whether well-made skills already existed.
    They did for two of the six I drafted, and those were folded into the existing skills
    rather than duplicated:
    
    - `verification-before-completion` - proving a claim before making it. Covers the
      ground my draft "read-the-artifact" would have; the two failure modes it was missing
      (grepping your own output for success, and treating a dry run as the artifact) were
      added to it instead.
    - `systematic-debugging` - root cause before fixes.
    - `karpathy-guidelines` - surfacing assumptions, surgical changes.
    - `ponytail` - whether the thing needs to exist at all. Which is the check I skipped
      when I wrote six skills without looking for prior art first.
    
    Nothing installed or public covered freshness-of-inputs, config-that-nothing-reads,
    silent-failure patterns, or shell-escaping corruption when authoring files, which is
    why those four exist.
    
  • README.mdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

Plain-text copy, no login: /skill-bundles/gavin844-claude-code-skills-skills-authoring-code-safely.md

// REPO STATS

0 stars
0 open issues
Last commit: 1mo ago