agentleFS
imMamdouhaboammarimMamdouhaboammar/get-fable/skills/fable-native-code/SKILL.md

fable-native-code

Skill6 starsChanged 3 months agoMITView on GitHub

Use when writing or editing code in an existing codebase — before adding comments, docstrings, try/catch blocks, validation, logging, or TODOs the surrounding file doesn't have, and before explaining your style choices in the reply.

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 14 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When writing or editing code in an existing repository.

    line 41
  2. Distinctive:

    Before adding docstrings, comments, type annotations, or validations to a file that lacks them.

    line 42
  3. Distinctive:

    When choosing naming conventions, error-handling patterns, or import structures.

    line 43
  4. Distinctive:

    When reviewing a completed diff before finalizing the turn.

    line 44
  5. Very specific:

    When bootstrapping a brand new project from scratch with no established idioms (use fable-architecture or fable-execute).

    line 48
  6. Distinctive:

    Match the File: Follow naming, error-handling idiom, comment density, formatting, and import organization.

    line 64
  7. Distinctive:

    Suppress Defensive Bloat: No try/catch around code that works, no validating invariants the types or callers already guarantee, no logging, …

    line 66
  8. Distinctive:

    Clean Exit: No debug prints, no commented-out code, no TODO crumbs you created.

    line 68
  9. Distinctive:

    If surrounding code uses early returns, use early returns.

    line 105
  10. Distinctive:

    If surrounding code lets errors bubble up, bubble them up.

    line 106
  11. Distinctive:

    Never add a docstring unless the enclosing interface or file strictly enforces docstrings on all exported symbols.

    line 107
  12. Distinctive:

    Read neighboring functions before editing to absorb file conventions.

    line 111
  13. Very specific:

    Use precise line replacement tools (replace_file_content) to prevent whitespace and indentation drift.

    line 112
  14. Distinctive:

    Do not reformat untouched lines in the same file.

    line 113
  15. Distinctive:

    If linter flags a style mismatch, conform strictly to the project's linter rules.

    line 122
  16. Distinctive:

    If an unneeded comment or debug print slipped into the diff, remove it immediately before completing the turn.

    line 123

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Fable Native Code

Your diff should read like the file's longtime owner wrote it. The file has a style — naming, error handling, comment density, formatting. Write in it. Your personal preferences are not improvements; they're an accent.

Purpose

Enforce codebase idioms and suppress foreign AI patterns. Eliminate defensive bloat, excessive comments, unnecessary try/catch blocks, unrequested logging, and conversational justification of coding style.

When to Use

  • When writing or editing code in an existing repository.
  • Before adding docstrings, comments, type annotations, or validations to a file that lacks them.
  • When choosing naming conventions, error-handling patterns, or import structures.
  • When reviewing a completed diff before finalizing the turn.

When NOT to Use

  • When bootstrapping a brand new project from scratch with no established idioms (use fable-architecture or fable-execute).
  • Refactoring architectural boundaries or decoupling modules (use fable-simplify).
  • Performance benchmarking and algorithmic optimization (use fable-review).

Inputs

  • source_diff: The proposed code modification.
  • target_file: The existing source file, its surrounding conventions, and neighboring modules.

Expected Outputs

  • idiomatic_code: Clean, minimal, idiom-matched code edits that blend seamlessly with surrounding style.
  • clean_diff: A diff free of cosmetic churn, gratuitous comments, and defensive wrapping.

Procedure

  1. Match the File: Follow naming, error-handling idiom, comment density, formatting, and import organization. If the file has one comment per 200 lines, your addition almost certainly has zero.
  2. Comment Invariants Only: Comments state only constraints the code cannot show — invariants, gotchas, why-not-the-obvious-way. Never what the next line does, never narration of your change ("now correctly handles X"), never justification aimed at a reviewer.
  3. Suppress Defensive Bloat: No try/catch around code that works, no validating invariants the types or callers already guarantee, no logging, config, or flags nobody asked for.
  4. Don't Narrate Restraint: The urge to explain what you didn't add ("note: I deliberately left out the doc comment because…") is the same urge that adds it — displaced into the reply. Deliver the code; mention style only if the user asks.
  5. Clean Exit: No debug prints, no commented-out code, no TODO crumbs you created.
  6. Codebase Vocabulary: Names come from the codebase's existing vocabulary. Don't coin a second name for an existing concept.

Decision Rules

Contrast Example: Terse Go File

Task: add clampWindow to a terse Go file whose only comment in 200 lines marks a sorting invariant; callers guarantee max >= 0.

Foreign (AI habits, not the file's):

// clampWindow clamps start and end into the valid range [0, max] and
// normalizes inverted windows. Returns (start, start) when end < start.
func clampWindow(start, end, max int) (int, int) {
    if max < 0 {
        return 0, 0 // defensive: should never happen
    }
    ...
}

Native (what the file's owner would write):

func clampWindow(start, end, max int) (int, int) {
    if start < 0 {
        start = 0
    }
    if end > max {
        end = max
    }
    if end < start {
        end = start
    }
    return start, end
}
  • If surrounding code uses early returns, use early returns.
  • If surrounding code lets errors bubble up, bubble them up; do not swallow or wrap them in unrequested custom errors.
  • Never add a docstring unless the enclosing interface or file strictly enforces docstrings on all exported symbols.

Tool Policy

  • Read neighboring functions before editing to absorb file conventions.
  • Use precise line replacement tools (replace_file_content) to prevent whitespace and indentation drift.
  • Do not reformat untouched lines in the same file.

Evidence Requirements

  • Provide the exact diff showing changes integrate natively with the file.
  • Passing test suite and linter confirming zero stylistic or typing violations.

Failure Handling

  • If linter flags a style mismatch, conform strictly to the project's linter rules.
  • If an unneeded comment or debug print slipped into the diff, remove it immediately before completing the turn.

Completion Criteria

  • Diff reads as if authored by the repository's primary maintainer.
  • Zero defensive bloat, zero unrequested logging, zero artificial comments.
  • Code compiles, passes existing style checks, and passes all unit tests.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.