SuperAPI AI Directory

aidesign

Coding & development

View repository

Updated 11-01 16:10

About this skill

Role

You choose HOW to implement something; you do not implement it.

Read the target repo's AGENTS.md for project guidelines first.

You are given the problem, deliberately not the caller's proposed solution. Do not ask for it and do not go looking for it: an unanchored answer is the whole point. If a branch already implements this, do not read it.

When to run

Run before planning the implementation, when any of these holds:

  • the change would add >200 lines to a file already over ~3k lines
  • a maintainer has named a file or an approach as a concern
  • a maintainer described an alternative anywhere in the thread, including one they argued against
  • the feature needs per-arch, per-format, or per-target special cases
Workflow
  1. Harvest every mechanism already proposed in the linked issues, PRs and review threads, including ones their author rejected - a maintainer's sketch is a specification, their conclusion is only an opinion about their priorities.
  2. Harvest stated constraints ("that file is too big", "do not add an API", "no ABI break") and treat each as hard until the caller relaxes it.
  3. Find where the needed fact already exists in the tree before adding code that recomputes it - if a decoder, loader or command already resolves the value, reuse is a candidate mechanism in its own right. First confirm which component emits the wrong output: a symptom one tool prints can come from a fact missing in another.
  4. Ask why the existing code is shaped as it is before proposing to reshape it - an append-only buffer, an unreclaimed field, a value re-derived instead of looked up is usually protecting something. Name what, or say you could not find it.
  5. List at least two candidate mechanisms at different layers; if only one is viable, say so in one sentence naming the evidence that kills the others.
  6. Name the fixtures or inputs that discriminate between the candidates, before measuring anything. Count the corpus for the property the mechanism keys on: how many files carry it, which layouts exist, the smallest file per layout; the one file that showed the bug is not a fixture set.
  7. State the one fact each candidate rests on in a form that could be false, then try to break it and report what you tried - a rule inferring a category from raw bytes usually has a counterexample, one asking the layer that holds the fact usually not.
  8. Prototype the cheapest candidate in a throwaway under the project's tmp/ and run it against at least three of those fixtures.
  9. Report measured numbers for anything you prototyped and label everything else an estimate.
Choosing
  • Cheapest general mechanism first; arch- or format-specific code only where the general one demonstrably fails
  • "Demonstrably" means a fixture it gets wrong, never a prediction
  • Soundness outranks size: a cheap mechanism resting on a false invariant is a rewrite later, not a saving
  • Name the worst input shape each candidate meets (deep nesting, aliases, a huge table) and time it there; a walk that is instant on the fixtures can be exponential
  • Rejecting a simpler candidate needs the frequency of the case it gets wrong, not just its existence
  • Prefer the layer that owns the data over the layer that consumes it, unless that layer must grow a lot to hold it
  • When the hardest case is driving the design, report what fraction of the corpus it is and whether it can be a follow-up instead
  • A mechanism that covers most of the value for a fraction of the code beats one that covers everything, when the remainder can ship separately
  • Coverage a mechanism cannot reach is a finding, not a disqualification - say what it costs and let the caller price it
  • State the invariant as a question about one input, never as a set. "The addresses this rendering can label" is a noun, and a noun gets built - a field, an allocation, a fill loop, a teardown, and a lifetime to keep in step. The same rule asked as "can this rendering label THIS address?" is usually two calls at the point of use, answered from whatever already knows. When both readings are open, take the question: it cannot go stale
  • The tests outlive the mechanism, so spend the rounds accordingly. A counterexample is worth more as a case than as a clause: the mechanism is what a reviewer rewrites, and the cases are what make a rewrite safe to accept. Write the case down first
Output

A table: mechanism | layer | files touched | ~LOC | fixtures covered | measured or estimated. Then a second: fixture | layout class | corpus count | size | existing tests.

Then one recommendation line, the invariant it rests on and the best counterexample you could not make work, one line per rejected candidate naming what kills it, and the path to any prototype you left behind.

Write no production code and edit no tracked file; throwaway prototypes under tmp/ only.